@uniformdev/project-map
Advanced tools
Comparing version
@@ -1,1 +0,10 @@ | ||
import{g as o,h as r,i as e}from"./chunk-IEPGH77W.mjs";export{r as ProjectMapClient,o as ROOT_NODE_PATH,e as UncachedProjectMapClient}; | ||
import { | ||
ProjectMapClient, | ||
ROOT_NODE_PATH, | ||
UncachedProjectMapClient | ||
} from "./chunk-VEO6RNDL.mjs"; | ||
export { | ||
ProjectMapClient, | ||
ROOT_NODE_PATH, | ||
UncachedProjectMapClient | ||
}; |
@@ -1,1 +0,209 @@ | ||
"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(a=>({...a,node:{...this.cleanProjectMapNode(a.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 a=this.createUrl("/api/v1/project-map-nodes",t),P={...(await this.apiClient(a)).tree},s=[P];for(;s&&s.length>0;){let p=s.pop(),n;(f=p==null?void 0:p.children)==null||f.forEach(c=>{c.parent=u(p),c.previousSibling=u(n),n&&(n.nextSibling=u(c)),n=c,s.push(c)})}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 a=this.createUrl("/api/v1/project-map-nodes",t);return await this.apiClient(a)}}cleanProjectMapNode(e){var r,t,a;return{id:((a=(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?a:0)==1?e.id:void 0,path:e.path,name:e.name,type:e.type,order:e.order,data:e.data,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}); | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
ProjectMapClient: () => ProjectMapClient, | ||
ROOT_NODE_PATH: () => ROOT_NODE_PATH, | ||
UncachedProjectMapClient: () => UncachedProjectMapClient | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/projectMapClient.ts | ||
var import_api = require("@uniformdev/context/api"); | ||
var ROOT_NODE_PATH = "/"; | ||
var ProjectMapClient = class extends import_api.ApiClient { | ||
constructor(options) { | ||
super(options); | ||
this.getProjectMapDefinitions = async () => { | ||
const { projectId } = this.options; | ||
const fetchUri = this.createUrl("/api/v1/project-map", { projectId }); | ||
return await this.apiClient(fetchUri); | ||
}; | ||
this.getProjectMapDefinition = async (options) => { | ||
const { projectId } = this.options; | ||
const fetchUri = this.createUrl("/api/v1/project-map", { | ||
...options, | ||
projectId | ||
}); | ||
return await this.apiClient(fetchUri); | ||
}; | ||
this.upsertProjectMap = async (options) => { | ||
const { projectId } = this.options; | ||
const fetchUri = this.createUrl("/api/v1/project-map"); | ||
const result = await this.apiClient(fetchUri, { | ||
method: "PUT", | ||
body: JSON.stringify({ ...options, projectId }) | ||
}); | ||
return result.projectMapId; | ||
}; | ||
this.deleteProjectMap = async (options) => { | ||
const { projectId } = this.options; | ||
const fetchUri = this.createUrl("/api/v1/project-map"); | ||
await this.apiClient(fetchUri, { | ||
method: "DELETE", | ||
body: JSON.stringify({ ...options, projectId }), | ||
expectNoContent: true | ||
}); | ||
}; | ||
this.upsertProjectMapNodes = async (options) => { | ||
const { projectId } = this.options; | ||
const fetchUri = this.createUrl("/api/v1/project-map-nodes"); | ||
await this.apiClient(fetchUri, { | ||
method: "PUT", | ||
body: JSON.stringify({ | ||
...options, | ||
projectId, | ||
nodes: options.nodes.map((n) => { | ||
return { | ||
...n, | ||
node: { ...this.cleanProjectMapNode(n.node) } | ||
}; | ||
}) | ||
}), | ||
expectNoContent: true | ||
}); | ||
}; | ||
this.deleteProjectMapNode = async (options) => { | ||
const { projectId } = this.options; | ||
const fetchUri = this.createUrl("/api/v1/project-map-nodes"); | ||
if (!options.path || this.validatePath(options.path)) { | ||
await this.apiClient(fetchUri, { | ||
method: "DELETE", | ||
body: JSON.stringify({ | ||
...options, | ||
projectId | ||
}), | ||
expectNoContent: true | ||
}); | ||
} | ||
}; | ||
this.getSubtree = async (options) => { | ||
var _a; | ||
const { projectId } = this.options; | ||
const fetchOptions = { | ||
projectId, | ||
projectMapId: options.projectMapId | ||
}; | ||
if (options.search) { | ||
fetchOptions["search"] = options.search; | ||
} else if (options.id) { | ||
fetchOptions["id"] = options.id; | ||
} else if (options.path && this.validatePath(options.path)) { | ||
fetchOptions["path"] = options.path; | ||
} else if (options.compositionId) { | ||
fetchOptions["compositionId"] = options.compositionId; | ||
} | ||
if (options.depth) { | ||
fetchOptions["depth"] = options.depth.toString(); | ||
} | ||
if (options.expanded) { | ||
fetchOptions["expanded"] = "true"; | ||
} | ||
fetchOptions["tree"] = "true"; | ||
const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions); | ||
const result = await this.apiClient(fetchUri); | ||
const root = { | ||
...result.tree | ||
}; | ||
const nodes = [root]; | ||
while (nodes && nodes.length > 0) { | ||
const currentNode = nodes.pop(); | ||
let lastChild = void 0; | ||
(_a = currentNode == null ? void 0 : currentNode.children) == null ? void 0 : _a.forEach((child) => { | ||
child.parent = cutReferences(currentNode); | ||
child.previousSibling = cutReferences(lastChild); | ||
if (lastChild) { | ||
lastChild.nextSibling = cutReferences(child); | ||
} | ||
lastChild = child; | ||
nodes.push(child); | ||
}); | ||
} | ||
return root; | ||
}; | ||
this.getNodes = async (options) => { | ||
const { projectId } = this.options; | ||
const fetchOptions = { | ||
projectId | ||
}; | ||
if (options.projectMapId) { | ||
fetchOptions["projectMapId"] = options.projectMapId; | ||
} | ||
if (options.search) { | ||
fetchOptions["search"] = options.search; | ||
} else if (options.id) { | ||
fetchOptions["id"] = options.id; | ||
} else if (options.path && this.validatePath(options.path)) { | ||
fetchOptions["path"] = options.path; | ||
} else if (options.compositionId) { | ||
fetchOptions["compositionId"] = options.compositionId; | ||
} | ||
if (options.limit) { | ||
fetchOptions["limit"] = options.limit.toString(); | ||
} | ||
if (options.offset) { | ||
fetchOptions["offset"] = options.offset.toString(); | ||
} | ||
if (options.expanded) { | ||
fetchOptions["expanded"] = "true"; | ||
} | ||
const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions); | ||
return await this.apiClient(fetchUri); | ||
}; | ||
} | ||
cleanProjectMapNode(node) { | ||
var _a, _b, _c; | ||
return { | ||
id: ((_c = (_b = (_a = node.id) == null ? void 0 : _a.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 : _b.length) != null ? _c : 0) == 1 ? node.id : void 0, | ||
path: node.path, | ||
name: node.name, | ||
type: node.type, | ||
order: node.order, | ||
data: node.data, | ||
compositionId: node.compositionId, | ||
description: node.description | ||
}; | ||
} | ||
validatePath(path) { | ||
const regex = /[*%!&@]/g; | ||
const match = path == null ? void 0 : path.match(regex); | ||
if (match) { | ||
throw "Path cannot contain reserved characters * % ! & @"; | ||
} | ||
return true; | ||
} | ||
}; | ||
var UncachedProjectMapClient = class extends ProjectMapClient { | ||
constructor(options) { | ||
super({ ...options, bypassCache: true }); | ||
} | ||
}; | ||
var cutReferences = (node) => node ? { | ||
...node, | ||
parent: void 0, | ||
children: void 0 | ||
} : void 0; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
ProjectMapClient, | ||
ROOT_NODE_PATH, | ||
UncachedProjectMapClient | ||
}); |
{ | ||
"name": "@uniformdev/project-map", | ||
"version": "17.7.1-alpha.140+80ab6baf9", | ||
"version": "17.7.1-alpha.167+a358adea9", | ||
"description": "Uniform Project Map", | ||
@@ -36,3 +36,3 @@ "license": "SEE LICENSE IN LICENSE.txt", | ||
"build": "run-s update-openapi build:ts", | ||
"build:ts": "tsup --minify", | ||
"build:ts": "tsup", | ||
"dev": "run-s update-openapi dev:ts", | ||
@@ -50,4 +50,4 @@ "dev:ts": "tsup --watch", | ||
"dependencies": { | ||
"@uniformdev/canvas": "^17.7.1-alpha.140+80ab6baf9", | ||
"@uniformdev/context": "^17.7.1-alpha.140+80ab6baf9", | ||
"@uniformdev/canvas": "^17.7.1-alpha.167+a358adea9", | ||
"@uniformdev/context": "^17.7.1-alpha.167+a358adea9", | ||
"p-limit": "^3.1.0" | ||
@@ -57,3 +57,3 @@ }, | ||
"@types/yargs": "17.0.19", | ||
"@uniformdev/cli": "^17.7.1-alpha.140+80ab6baf9", | ||
"@uniformdev/cli": "^17.7.1-alpha.167+a358adea9", | ||
"yargs": "17.6.2" | ||
@@ -64,3 +64,3 @@ }, | ||
}, | ||
"gitHead": "80ab6baf9edea6b520738bd3dff5c6afc882bf77" | ||
"gitHead": "a358adea91b24a877e577be784d56b794c4cfab8" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
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
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 18 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2791601
37.43%42936
406.14%2
-50%4
-94.74%2
-77.78%