@uniformdev/project-map
Advanced tools
Comparing version
@@ -462,2 +462,4 @@ import { ApiClient } from '@uniformdev/context/api'; | ||
bearerToken?: string | undefined; | ||
/** The Uniform project ID to connect to */ | ||
projectId?: string | null; | ||
/** Specify a fetch implementation to use when fetching data. Useful if you want to only polyfill selectively. */ | ||
@@ -474,5 +476,8 @@ fetch?: typeof fetch; | ||
}; | ||
declare type WithoutProjectId<T extends { | ||
projectId: string; | ||
}> = Omit<T, 'projectId'>; | ||
declare class ProjectMapClient extends ApiClient<ProjectMapClientOptions> { | ||
constructor(options: ProjectMapClientOptions); | ||
getProjectMapDefinitions: (projectId: string) => Promise<{ | ||
getProjectMapDefinitions: () => Promise<{ | ||
projectMaps: { | ||
@@ -486,3 +491,3 @@ id?: string | undefined; | ||
}>; | ||
getProjectMapDefinition: (options: ProjectMapGetRequest) => Promise<{ | ||
getProjectMapDefinition: (options: WithoutProjectId<ProjectMapGetRequest>) => Promise<{ | ||
projectMaps: { | ||
@@ -496,8 +501,8 @@ id?: string | undefined; | ||
}>; | ||
upsertProjectMap: (options: ProjectMapUpsertRequest) => Promise<string>; | ||
deleteProjectMap: (options: ProjectMapDeleteRequest) => Promise<void>; | ||
upsertProjectMapNodes: (options: ProjectMapNodeUpsertRequest) => Promise<void>; | ||
deleteProjectMapNode: (options: ProjectMapNodeDeleteRequest) => Promise<void>; | ||
getSubtree: (options: ProjectMapNodeGetRequest) => Promise<ProjectMapSubtree | undefined>; | ||
getNodes: (options: ProjectMapNodeGetRequest) => Promise<ProjectMapNodeGetResponse>; | ||
upsertProjectMap: (options: WithoutProjectId<ProjectMapUpsertRequest>) => Promise<string>; | ||
deleteProjectMap: (options: WithoutProjectId<ProjectMapDeleteRequest>) => Promise<void>; | ||
upsertProjectMapNodes: (options: WithoutProjectId<ProjectMapNodeUpsertRequest>) => Promise<void>; | ||
deleteProjectMapNode: (options: WithoutProjectId<ProjectMapNodeDeleteRequest>) => Promise<void>; | ||
getSubtree: (options: WithoutProjectId<ProjectMapNodeGetRequest>) => Promise<ProjectMapSubtree | undefined>; | ||
getNodes: (options: WithoutProjectId<ProjectMapNodeGetRequest>) => Promise<ProjectMapNodeGetResponse>; | ||
private cleanProjectMapNode; | ||
@@ -504,0 +509,0 @@ private validatePath; |
@@ -1,1 +0,1 @@ | ||
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}; | ||
import{g as o,h as r,i as e}from"./chunk-OIOFUJKY.mjs";export{r as ProjectMapClient,o as ROOT_NODE_PATH,e as UncachedProjectMapClient}; |
@@ -1,1 +0,1 @@ | ||
"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}); | ||
"use strict";var h=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var N=(o,i)=>{for(var e in i)h(o,e,{get:i[e],enumerable:!0})},g=(o,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of m(i))!I.call(o,t)&&t!==e&&h(o,t,{get:()=>i[t],enumerable:!(r=M(i,t))||r.enumerable});return o};var R=o=>g(h({},"__esModule",{value:!0}),o);var U={};N(U,{ProjectMapClient:()=>d,ROOT_NODE_PATH:()=>y,UncachedProjectMapClient:()=>j});module.exports=R(U);var l=require("@uniformdev/context/api"),y="/",d=class extends l.ApiClient{constructor(e){super(e);this.getProjectMapDefinitions=async()=>{let{projectId:e}=this.options,r=this.createUrl("/api/v1/project-map",{projectId:e});return await this.apiClient(r)};this.getProjectMapDefinition=async e=>{let{projectId:r}=this.options,t=this.createUrl("/api/v1/project-map",{...e,projectId:r});return await this.apiClient(t)};this.upsertProjectMap=async e=>{let{projectId:r}=this.options,t=this.createUrl("/api/v1/project-map");return(await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:r})})).projectMapId};this.deleteProjectMap=async e=>{let{projectId:r}=this.options,t=this.createUrl("/api/v1/project-map");await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:r}),expectNoContent:!0})};this.upsertProjectMapNodes=async e=>{let{projectId:r}=this.options,t=this.createUrl("/api/v1/project-map-nodes");await this.apiClient(t,{method:"PUT",body:JSON.stringify({...e,projectId:r,nodes:e.nodes.map(c=>({...c,node:{...this.cleanProjectMapNode(c.node)}}))}),expectNoContent:!0})};this.deleteProjectMapNode=async e=>{let{projectId:r}=this.options,t=this.createUrl("/api/v1/project-map-nodes");(!e.path||this.validatePath(e.path))&&await this.apiClient(t,{method:"DELETE",body:JSON.stringify({...e,projectId:r}),expectNoContent:!0})};this.getSubtree=async e=>{var f;let{projectId:r}=this.options,t={projectId:r,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 c=this.createUrl("/api/v1/project-map-nodes",t),P={...(await this.apiClient(c)).tree},s=[P];for(;s&&s.length>0;){let p=s.pop(),n;(f=p==null?void 0:p.children)==null||f.forEach(a=>{a.parent=u(p),a.previousSibling=u(n),n&&(n.nextSibling=u(a)),n=a,s.push(a)})}return P};this.getNodes=async e=>{let{projectId:r}=this.options,t={projectId:r};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 c=this.createUrl("/api/v1/project-map-nodes",t);return await this.apiClient(c)}}cleanProjectMapNode(e){var r,t,c;return{id:((c=(t=(r=e.id)==null?void 0:r.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:t.length)!=null?c:0)==1?e.id:void 0,path:e.path,name:e.name,type:e.type,compositionId:e.compositionId,description:e.description}}validatePath(e){let r=/[*%!&@]/g;if(e==null?void 0:e.match(r))throw"Path cannot contain reserved characters * % ! & @";return!0}},j=class extends d{constructor(i){super({...i,bypassCache:!0})}},u=o=>o?{...o,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.130+3fac779b1", | ||
"version": "17.5.1-alpha.131+1a06e230b", | ||
"description": "Uniform Project Map", | ||
@@ -49,9 +49,9 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"dependencies": { | ||
"@uniformdev/canvas": "^17.5.1-alpha.130+3fac779b1", | ||
"@uniformdev/context": "^17.5.1-alpha.130+3fac779b1", | ||
"@uniformdev/canvas": "^17.5.1-alpha.131+1a06e230b", | ||
"@uniformdev/context": "^17.5.1-alpha.131+1a06e230b", | ||
"p-limit": "^3.1.0" | ||
}, | ||
"devDependencies": { | ||
"@types/yargs": "17.0.14", | ||
"@uniformdev/cli": "^17.5.1-alpha.130+3fac779b1", | ||
"@types/yargs": "17.0.15", | ||
"@uniformdev/cli": "^17.5.1-alpha.131+1a06e230b", | ||
"yargs": "17.6.2" | ||
@@ -62,3 +62,3 @@ }, | ||
}, | ||
"gitHead": "3fac779b1b42a1afeb05156cb51768a98573438f" | ||
"gitHead": "1a06e230be7112298a5d5bf6d93bd66c9cbc39f6" | ||
} |
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
2031366
0.02%8483
0.07%