@uniformdev/project-map
Advanced tools
Comparing version
import { ApiClient } from '@uniformdev/context/api'; | ||
declare type ProjectMapNodeWithProjectMapReference = ProjectMapNodeWithId & { | ||
projectMapId: string; | ||
}; | ||
/** | ||
@@ -8,29 +12,11 @@ * This file was auto-generated by openapi-typescript. | ||
interface paths$1 { | ||
"/api/v1/project-map-nodes": { | ||
/** Called to get a list of nodes belonging to a specific path or Id */ | ||
"/api/v1/project-map": { | ||
/** Called to retrieve a list of project maps related to a project or a specific project map by id */ | ||
get: { | ||
parameters: { | ||
query: { | ||
/** The project map id that the desired nodes belong */ | ||
projectMapId: string; | ||
/** The project id that contains the project map tree that this node belongs to */ | ||
/** The project to fetch project map for */ | ||
projectId: string; | ||
/** The id of the node to retrieve, cannot have both this parameter and Path */ | ||
id?: string; | ||
/** The path of the root node to retrieve, cannot have both this parameter and Id */ | ||
path?: string; | ||
/** Composition id to find associated sitemap nodes for */ | ||
compositionId?: string; | ||
/** Limit the number or records returned by a number */ | ||
limit?: number; | ||
/** Number of records to skip before returning nodes */ | ||
offset?: number; | ||
/** Depth of the tree to fetch */ | ||
depth?: number; | ||
/** should the data be returned as a json tree object */ | ||
tree?: boolean; | ||
/** text search filter */ | ||
search?: string; | ||
/** include expanded helper computed properties, includes isLeaf, parentPath, pathSegment */ | ||
expanded?: boolean; | ||
/** The id of the project map to fetch */ | ||
projectMapId?: string; | ||
}; | ||
@@ -43,4 +29,3 @@ }; | ||
"application/json": { | ||
nodes?: components$1["schemas"]["ProjectMapNodeDefinition"][]; | ||
tree?: external$1["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"]; | ||
projectMaps: components$1["schemas"]["ProjectMapDefinition"][]; | ||
}; | ||
@@ -56,6 +41,17 @@ }; | ||
}; | ||
/** Called to insert or update a node or nodes */ | ||
put: { | ||
responses: { | ||
/** OK */ | ||
200: { | ||
content: { | ||
"application/json": { | ||
/** | ||
* Format: uuid | ||
* @description Id of the projectMap | ||
*/ | ||
projectMapId: string; | ||
}; | ||
}; | ||
}; | ||
/** OK */ | ||
204: never; | ||
@@ -71,20 +67,9 @@ 400: external$1["swagger.yml"]["components"]["responses"]["BadRequestError"]; | ||
"application/json": { | ||
/** @description An array of projectMap node objects to be updated or inserted */ | ||
nodes: { | ||
node: components$1["schemas"]["ProjectMapNodeUpdate"]; | ||
/** @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 */ | ||
previousSibling?: string; | ||
/** @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 */ | ||
nextSibling?: string; | ||
}[]; | ||
/** @description Project map object to insert */ | ||
projectMap: components$1["schemas"]["ProjectMapDefinition"]; | ||
/** | ||
* Format: uuid | ||
* @description The project id of the project that the projectMap belongs to | ||
* @description Project id to insert the projectMap into | ||
*/ | ||
projectId: string; | ||
/** | ||
* Format: uuid | ||
* @description The projectMap id that the changing or inserting nodes belong to | ||
*/ | ||
projectMapId: string; | ||
}; | ||
@@ -94,3 +79,3 @@ }; | ||
}; | ||
/** Called to delete a particular projectMap node by id or path */ | ||
/** Called to delete a projectMap */ | ||
delete: { | ||
@@ -111,35 +96,10 @@ responses: { | ||
* Format: uuid | ||
* @description Id of the projectMap node to delete | ||
* @description Id of the project that this projectMap belongs to | ||
*/ | ||
nodeId?: string; | ||
/** @description Path to the projectMap node to delete */ | ||
path: string; | ||
/** | ||
* Format: uuid | ||
* @description Project map id that the node to delete belongs to | ||
*/ | ||
projectMapId: string; | ||
/** | ||
* Format: uuid | ||
* @description Project id that the project map belongs to | ||
*/ | ||
projectId: string; | ||
} | { | ||
/** | ||
* Format: uuid | ||
* @description Id of the projectMap node to delete | ||
* @description Id of the projectMap to delete | ||
*/ | ||
nodeId: string; | ||
/** @description Path to the projectMap node to delete */ | ||
path?: string; | ||
/** | ||
* Format: uuid | ||
* @description Project map id that the node to delete belongs to | ||
*/ | ||
projectMapId: string; | ||
/** | ||
* Format: uuid | ||
* @description Project id that the project map belongs to | ||
*/ | ||
projectId: string; | ||
}; | ||
@@ -153,65 +113,12 @@ }; | ||
schemas: { | ||
ProjectMapNodeDefinition: { | ||
/** | ||
* Format: uuid | ||
* @description The id of the projectMap entry | ||
*/ | ||
id: string; | ||
/** @description Dot delimited path representing the path to the current node */ | ||
path: string; | ||
/** @description Ordering of the node, higher numbers go after lower numbers. */ | ||
order?: number; | ||
/** @description Data associated with this projectMap node */ | ||
data?: { | ||
[key: string]: unknown; | ||
}; | ||
/** @description The name of the projectMap entry */ | ||
name: string; | ||
/** | ||
* @description The type of the projectMap entry | ||
* @enum {string} | ||
*/ | ||
type: "composition" | "redirect" | "placeholder"; | ||
/** | ||
* Format: uuid | ||
* @description The composition id related to the projectMap entry | ||
*/ | ||
compositionId?: string; | ||
/** @description Description of the projectMap node */ | ||
description?: string; | ||
/** @description Parent path of the current node, only included if requested with the expanded flag */ | ||
parentPath?: string; | ||
/** @description Last segment of the url, only included if requested with the expanded flag */ | ||
pathSegment?: string; | ||
/** @description returns true if the node is a leaf node, meaning having no children, only included if requested with the expanded flag */ | ||
isLeaf?: boolean; | ||
}; | ||
ProjectMapNodeUpdate: { | ||
/** | ||
* Format: uuid | ||
* @description The id of the projectMap entry | ||
*/ | ||
ProjectMapDefinition: { | ||
/** @description The id of the projectMap node */ | ||
id?: string; | ||
/** @description Dot delimited path representing the path to the current node */ | ||
path: string; | ||
/** @description Ordering of the node, higher numbers go after lower numbers. */ | ||
order?: number; | ||
/** @description Data associated with this projectMap node */ | ||
data?: { | ||
[key: string]: unknown; | ||
}; | ||
/** @description The name of the projectMap entry */ | ||
/** @description The name of the projectMap node */ | ||
name: string; | ||
/** | ||
* @description The type of the projectMap entry | ||
* @enum {string} | ||
*/ | ||
type: "composition" | "redirect" | "placeholder"; | ||
/** | ||
* Format: uuid | ||
* @description The composition id related to the projectMap entry | ||
*/ | ||
compositionId?: string; | ||
/** @description Description of the projectMap node */ | ||
description?: string; | ||
/** @description The prefix of the url generated by this projectMap */ | ||
baseUrl?: string; | ||
default?: boolean; | ||
}; | ||
@@ -263,16 +170,2 @@ }; | ||
}; | ||
"v1-project-map-tree.swagger.yml": { | ||
paths: {}; | ||
components: { | ||
schemas: { | ||
ProjectMapTreeNodeDefinition: components$1["schemas"]["ProjectMapNodeDefinition"] & { | ||
/** @description Children of the node */ | ||
children?: external$1["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"][]; | ||
} & { | ||
name: unknown; | ||
}; | ||
}; | ||
}; | ||
operations: {}; | ||
}; | ||
} | ||
@@ -285,11 +178,29 @@ | ||
interface paths { | ||
"/api/v1/project-map": { | ||
/** Called to retrieve a list of project maps related to a project or a specific project map by id */ | ||
"/api/v1/project-map-nodes": { | ||
/** Called to get a list of nodes belonging to a specific path or Id */ | ||
get: { | ||
parameters: { | ||
query: { | ||
/** The project to fetch project map for */ | ||
/** The project map id that the desired nodes belong */ | ||
projectMapId: string; | ||
/** The project id that contains the project map tree that this node belongs to */ | ||
projectId: string; | ||
/** The id of the project map to fetch */ | ||
projectMapId?: string; | ||
/** The id of the node to retrieve, cannot have both this parameter and Path */ | ||
id?: string; | ||
/** The path of the root node to retrieve, cannot have both this parameter and Id */ | ||
path?: string; | ||
/** Composition id to find associated sitemap nodes for */ | ||
compositionId?: string; | ||
/** Limit the number or records returned by a number */ | ||
limit?: number; | ||
/** Number of records to skip before returning nodes */ | ||
offset?: number; | ||
/** Depth of the tree to fetch */ | ||
depth?: number; | ||
/** should the data be returned as a json tree object */ | ||
tree?: boolean; | ||
/** text search filter */ | ||
search?: string; | ||
/** include expanded helper computed properties, includes isLeaf, parentPath, pathSegment */ | ||
expanded?: boolean; | ||
}; | ||
@@ -302,3 +213,4 @@ }; | ||
"application/json": { | ||
projectMaps: components["schemas"]["ProjectMapDefinition"][]; | ||
nodes?: components["schemas"]["ProjectMapNodeDefinition"][]; | ||
tree?: external["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"]; | ||
}; | ||
@@ -314,17 +226,6 @@ }; | ||
}; | ||
/** Called to insert or update a node or nodes */ | ||
put: { | ||
responses: { | ||
/** OK */ | ||
200: { | ||
content: { | ||
"application/json": { | ||
/** | ||
* Format: uuid | ||
* @description Id of the projectMap | ||
*/ | ||
projectMapId: string; | ||
}; | ||
}; | ||
}; | ||
/** OK */ | ||
204: never; | ||
@@ -340,9 +241,20 @@ 400: external["swagger.yml"]["components"]["responses"]["BadRequestError"]; | ||
"application/json": { | ||
/** @description Project map object to insert */ | ||
projectMap: components["schemas"]["ProjectMapDefinition"]; | ||
/** @description An array of projectMap node objects to be updated or inserted */ | ||
nodes: { | ||
node: components["schemas"]["ProjectMapNodeUpdate"]; | ||
/** @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 */ | ||
previousSibling?: string; | ||
/** @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 */ | ||
nextSibling?: string; | ||
}[]; | ||
/** | ||
* Format: uuid | ||
* @description Project id to insert the projectMap into | ||
* @description The project id of the project that the projectMap belongs to | ||
*/ | ||
projectId: string; | ||
/** | ||
* Format: uuid | ||
* @description The projectMap id that the changing or inserting nodes belong to | ||
*/ | ||
projectMapId: string; | ||
}; | ||
@@ -352,3 +264,3 @@ }; | ||
}; | ||
/** Called to delete a projectMap */ | ||
/** Called to delete a particular projectMap node by id or path */ | ||
delete: { | ||
@@ -369,10 +281,35 @@ responses: { | ||
* Format: uuid | ||
* @description Id of the project that this projectMap belongs to | ||
* @description Id of the projectMap node to delete | ||
*/ | ||
nodeId?: string; | ||
/** @description Path to the projectMap node to delete */ | ||
path: string; | ||
/** | ||
* Format: uuid | ||
* @description Project map id that the node to delete belongs to | ||
*/ | ||
projectMapId: string; | ||
/** | ||
* Format: uuid | ||
* @description Project id that the project map belongs to | ||
*/ | ||
projectId: string; | ||
} | { | ||
/** | ||
* Format: uuid | ||
* @description Id of the projectMap to delete | ||
* @description Id of the projectMap node to delete | ||
*/ | ||
nodeId: string; | ||
/** @description Path to the projectMap node to delete */ | ||
path?: string; | ||
/** | ||
* Format: uuid | ||
* @description Project map id that the node to delete belongs to | ||
*/ | ||
projectMapId: string; | ||
/** | ||
* Format: uuid | ||
* @description Project id that the project map belongs to | ||
*/ | ||
projectId: string; | ||
}; | ||
@@ -386,12 +323,65 @@ }; | ||
schemas: { | ||
ProjectMapDefinition: { | ||
/** @description The id of the projectMap node */ | ||
ProjectMapNodeDefinition: { | ||
/** | ||
* Format: uuid | ||
* @description The id of the projectMap entry | ||
*/ | ||
id: string; | ||
/** @description Dot delimited path representing the path to the current node */ | ||
path: string; | ||
/** @description Ordering of the node, higher numbers go after lower numbers. */ | ||
order?: number; | ||
/** @description Data associated with this projectMap node */ | ||
data?: { | ||
[key: string]: unknown; | ||
}; | ||
/** @description The name of the projectMap entry */ | ||
name: string; | ||
/** | ||
* @description The type of the projectMap entry | ||
* @enum {string} | ||
*/ | ||
type: "composition" | "redirect" | "placeholder"; | ||
/** | ||
* Format: uuid | ||
* @description The composition id related to the projectMap entry | ||
*/ | ||
compositionId?: string; | ||
/** @description Description of the projectMap node */ | ||
description?: string; | ||
/** @description Parent path of the current node, only included if requested with the expanded flag */ | ||
parentPath?: string; | ||
/** @description Last segment of the url, only included if requested with the expanded flag */ | ||
pathSegment?: string; | ||
/** @description returns true if the node is a leaf node, meaning having no children, only included if requested with the expanded flag */ | ||
isLeaf?: boolean; | ||
}; | ||
ProjectMapNodeUpdate: { | ||
/** | ||
* Format: uuid | ||
* @description The id of the projectMap entry | ||
*/ | ||
id?: string; | ||
/** @description The name of the projectMap node */ | ||
/** @description Dot delimited path representing the path to the current node */ | ||
path: string; | ||
/** @description Ordering of the node, higher numbers go after lower numbers. */ | ||
order?: number; | ||
/** @description Data associated with this projectMap node */ | ||
data?: { | ||
[key: string]: unknown; | ||
}; | ||
/** @description The name of the projectMap entry */ | ||
name: string; | ||
/** | ||
* @description The type of the projectMap entry | ||
* @enum {string} | ||
*/ | ||
type: "composition" | "redirect" | "placeholder"; | ||
/** | ||
* Format: uuid | ||
* @description The composition id related to the projectMap entry | ||
*/ | ||
compositionId?: string; | ||
/** @description Description of the projectMap node */ | ||
description?: string; | ||
/** @description The prefix of the url generated by this projectMap */ | ||
baseUrl?: string; | ||
default?: boolean; | ||
}; | ||
@@ -443,22 +433,32 @@ }; | ||
}; | ||
"v1-project-map-tree.swagger.yml": { | ||
paths: {}; | ||
components: { | ||
schemas: { | ||
ProjectMapTreeNodeDefinition: components["schemas"]["ProjectMapNodeDefinition"] & { | ||
/** @description Children of the node */ | ||
children?: external["v1-project-map-tree.swagger.yml"]["components"]["schemas"]["ProjectMapTreeNodeDefinition"][]; | ||
} & { | ||
name: unknown; | ||
}; | ||
}; | ||
}; | ||
operations: {}; | ||
}; | ||
} | ||
declare type ProjectMapNodeWithProjectMapReference = ProjectMapNodeWithId & { | ||
projectMapId: string; | ||
}; | ||
declare type ProjectMapNodeUpsertRequest = paths$1['/api/v1/project-map-nodes']['put']['requestBody']['content']['application/json']; | ||
declare type ProjectMapNodeUpsertRequest = paths['/api/v1/project-map-nodes']['put']['requestBody']['content']['application/json']; | ||
declare type ProjectMapNodeUpsertRequestNode = ProjectMapNodeUpsertRequest['nodes'][0]['node']; | ||
declare type ProjectMapNodeDeleteRequest = paths$1['/api/v1/project-map-nodes']['delete']['requestBody']['content']['application/json']; | ||
declare type ProjectMapNodeGetRequest = paths$1['/api/v1/project-map-nodes']['get']['parameters']['query']; | ||
declare type ProjectMapNodeGetResponse = paths$1['/api/v1/project-map-nodes']['get']['responses']['200']['content']['application/json']; | ||
declare type ProjectMapNodeDeleteRequest = paths['/api/v1/project-map-nodes']['delete']['requestBody']['content']['application/json']; | ||
declare type ProjectMapNodeGetRequest = paths['/api/v1/project-map-nodes']['get']['parameters']['query']; | ||
declare type ProjectMapNodeGetResponse = paths['/api/v1/project-map-nodes']['get']['responses']['200']['content']['application/json']; | ||
declare type ProjectMapNode = NonNullable<ProjectMapNodeGetResponse['nodes']>[0]; | ||
declare type ProjectMapNodeWithId = ProjectMapNode & Required<Pick<ProjectMapNode, 'id' | 'name'>>; | ||
declare type ProjectMapGetRequest = paths['/api/v1/project-map']['get']['parameters']['query']; | ||
declare type ProjectMapGetResponse = paths['/api/v1/project-map']['get']['responses']['200']['content']['application/json']; | ||
declare type ProjectMapUpsertRequest = paths['/api/v1/project-map']['put']['requestBody']['content']['application/json']; | ||
declare type ProjectMapDeleteRequest = paths['/api/v1/project-map']['delete']['requestBody']['content']['application/json']; | ||
declare type ProjectMapGetRequest = paths$1['/api/v1/project-map']['get']['parameters']['query']; | ||
declare type ProjectMapGetResponse = paths$1['/api/v1/project-map']['get']['responses']['200']['content']['application/json']; | ||
declare type ProjectMapUpsertRequest = paths$1['/api/v1/project-map']['put']['requestBody']['content']['application/json']; | ||
declare type ProjectMapDeleteRequest = paths$1['/api/v1/project-map']['delete']['requestBody']['content']['application/json']; | ||
declare type ProjectMapDefinition = ProjectMapGetResponse['projectMaps'][0]; | ||
declare type ProjectMapDefinitionWithId = ProjectMapDefinition & Required<Pick<ProjectMapDefinition, 'id'>>; | ||
declare type ProjectMapUpsertResponse = paths['/api/v1/project-map']['put']['responses']['200']['content']['application/json']; | ||
declare type ProjectMapUpsertResponse = paths$1['/api/v1/project-map']['put']['responses']['200']['content']['application/json']; | ||
declare type NodeType = 'placeholder' | 'composition' | 'redirect'; | ||
@@ -465,0 +465,0 @@ declare type ProjectMapDefinitions = { |
@@ -1,1 +0,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}; | ||
import{g as o,h as r,i as e}from"./chunk-XBKQWBOO.mjs";export{r as ProjectMapClient,o as ROOT_NODE_PATH,e as UncachedProjectMapClient}; |
@@ -1,1 +0,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}); | ||
"use strict";var j=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var R=(a,p)=>{for(var e in p)j(a,e,{get:p[e],enumerable:!0})},g=(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=P(p,r))||t.enumerable});return a};var I=a=>g(j({},"__esModule",{value:!0}),a);var U={};R(U,{ProjectMapClient:()=>d,ROOT_NODE_PATH:()=>y,UncachedProjectMapClient:()=>u});module.exports=I(U);var l=require("@uniformdev/context/api"),y="/",d=class extends l.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={projectId:e.projectId,projectMapId:e.projectMapId};e.search?t.search=e.search:e.id?t.id=e.id: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},i=[M];for(;i&&i.length>0;){let o=i.pop(),s;(f=o==null?void 0:o.children)==null||f.forEach(c=>{c.parent=h(o),c.previousSibling=h(s),s&&(s.nextSibling=h(c)),s=c,i.push(c)})}return M};this.getNodes=async e=>{let t={};t.projectId=e.projectId,e.projectMapId&&(t.projectMapId=e.projectMapId),e.search?t.search=e.search: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,n;return{id:((n=(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?n: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}},u=class extends d{constructor(p){super({...p,bypassCache:!0})}},h=a=>a?{...a,parent:void 0,children:void 0}:void 0;0&&(module.exports={ProjectMapClient,ROOT_NODE_PATH,UncachedProjectMapClient}); |
{ | ||
"name": "@uniformdev/project-map", | ||
"version": "17.5.1-alpha.105+9b3f152e7", | ||
"version": "17.5.1-alpha.130+3fac779b1", | ||
"description": "Uniform Project Map", | ||
@@ -49,4 +49,4 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"dependencies": { | ||
"@uniformdev/canvas": "^17.5.1-alpha.105+9b3f152e7", | ||
"@uniformdev/context": "^17.5.1-alpha.105+9b3f152e7", | ||
"@uniformdev/canvas": "^17.5.1-alpha.130+3fac779b1", | ||
"@uniformdev/context": "^17.5.1-alpha.130+3fac779b1", | ||
"p-limit": "^3.1.0" | ||
@@ -56,3 +56,3 @@ }, | ||
"@types/yargs": "17.0.14", | ||
"@uniformdev/cli": "^17.5.1-alpha.105+9b3f152e7", | ||
"@uniformdev/cli": "^17.5.1-alpha.130+3fac779b1", | ||
"yargs": "17.6.2" | ||
@@ -63,3 +63,3 @@ }, | ||
}, | ||
"gitHead": "9b3f152e7455f37fd8609004bab4ded4a9a88bc7" | ||
"gitHead": "3fac779b1b42a1afeb05156cb51768a98573438f" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
2030888
0.01%8477
0.01%