@uniformdev/project-map 18.16.1-alpha.6 → 18.17.1-alpha.13

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,9 +1,5 @@
1
1
  import { ApiClient } from '@uniformdev/context/api';
2
2
 
3
- type ProjectMapNodeWithProjectMapReference = ProjectMapNodeWithId & {
4
- projectMapId: string;
5
- };
6
-
7
3
  /**
8
4
  * This file was auto-generated by openapi-typescript.
9
5
  * Do not make direct changes to the file.
@@ -497,6 +493,9 @@ type ProjectMapDefinition = ProjectMapGetResponse['projectMaps'][0];
497
493
  type ProjectMapDefinitionWithId = ProjectMapDefinition & Required<Pick<ProjectMapDefinition, 'id'>>;
498
494
  type ProjectMapUpsertResponse = paths$1['/api/v1/project-map']['put']['responses']['200']['content']['application/json'];
499
495
  type NodeType = 'placeholder' | 'composition' | 'redirect';
496
+ type ProjectMapNodeWithProjectMapReference = ProjectMapNodeWithId & {
497
+ projectMapId: string;
498
+ };
500
499
  type ProjectMapDefinitions = {
501
500
  projectMaps: ProjectMapDefinitionWithId[];
502
501
  projectMapNodes: ProjectMapNodeWithProjectMapReference[];
@@ -560,4 +559,4 @@ declare class UncachedProjectMapClient extends ProjectMapClient {
560
559
  constructor(options: Omit<ProjectMapClientOptions, 'bypassCache'>);
561
560
  }
562
561
 
563
- export { NodeType, ProjectMapClient, ProjectMapClientOptions, ProjectMapDefinition, ProjectMapDefinitionWithId, ProjectMapDefinitions, ProjectMapDeleteRequest, ProjectMapGetRequest, ProjectMapGetResponse, ProjectMapNode, ProjectMapNodeDeleteRequest, ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapNodeUpsertRequest, ProjectMapNodeUpsertRequestNode, ProjectMapNodeWithId, ProjectMapSubtree, ProjectMapUpsertRequest, ProjectMapUpsertResponse, ROOT_NODE_PATH, UncachedProjectMapClient };
562
+ export { NodeType, ProjectMapClient, ProjectMapClientOptions, ProjectMapDefinition, ProjectMapDefinitionWithId, ProjectMapDefinitions, ProjectMapDeleteRequest, ProjectMapGetRequest, ProjectMapGetResponse, ProjectMapNode, ProjectMapNodeDeleteRequest, ProjectMapNodeGetRequest, ProjectMapNodeGetResponse, ProjectMapNodeUpsertRequest, ProjectMapNodeUpsertRequestNode, ProjectMapNodeWithId, ProjectMapNodeWithProjectMapReference, ProjectMapSubtree, ProjectMapUpsertRequest, ProjectMapUpsertResponse, ROOT_NODE_PATH, UncachedProjectMapClient };
package/dist/index.esm.js CHANGED
@@ -1,8 +1,170 @@
1
- import {
2
- ProjectMapClient,
3
- ROOT_NODE_PATH,
4
- UncachedProjectMapClient
5
- } from "./chunk-4GWDA2EG.mjs";
1
+ // src/projectMapClient.ts
2
+ import { ApiClient } from "@uniformdev/context/api";
3
+ var ROOT_NODE_PATH = "/";
4
+ var ProjectMapClient = class extends ApiClient {
5
+ constructor(options) {
6
+ super(options);
7
+ this.getProjectMapDefinitions = async () => {
8
+ const { projectId } = this.options;
9
+ const fetchUri = this.createUrl("/api/v1/project-map", { projectId });
10
+ return await this.apiClient(fetchUri);
11
+ };
12
+ this.getProjectMapDefinition = async (options) => {
13
+ const { projectId } = this.options;
14
+ const fetchUri = this.createUrl("/api/v1/project-map", {
15
+ ...options,
16
+ projectId
17
+ });
18
+ return await this.apiClient(fetchUri);
19
+ };
20
+ this.upsertProjectMap = async (options) => {
21
+ const { projectId } = this.options;
22
+ const fetchUri = this.createUrl("/api/v1/project-map");
23
+ const result = await this.apiClient(fetchUri, {
24
+ method: "PUT",
25
+ body: JSON.stringify({ ...options, projectId })
26
+ });
27
+ return result.projectMapId;
28
+ };
29
+ this.deleteProjectMap = async (options) => {
30
+ const { projectId } = this.options;
31
+ const fetchUri = this.createUrl("/api/v1/project-map");
32
+ await this.apiClient(fetchUri, {
33
+ method: "DELETE",
34
+ body: JSON.stringify({ ...options, projectId }),
35
+ expectNoContent: true
36
+ });
37
+ };
38
+ this.upsertProjectMapNodes = async (options) => {
39
+ const { projectId } = this.options;
40
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes");
41
+ await this.apiClient(fetchUri, {
42
+ method: "PUT",
43
+ body: JSON.stringify({
44
+ ...options,
45
+ projectId,
46
+ nodes: options.nodes.map((n) => {
47
+ return {
48
+ ...n,
49
+ node: { ...this.cleanProjectMapNode(n.node) }
50
+ };
51
+ })
52
+ }),
53
+ expectNoContent: true
54
+ });
55
+ };
56
+ this.deleteProjectMapNode = async (options) => {
57
+ const { projectId } = this.options;
58
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes");
59
+ if (!options.path || this.validatePath(options.path)) {
60
+ await this.apiClient(fetchUri, {
61
+ method: "DELETE",
62
+ body: JSON.stringify({
63
+ ...options,
64
+ projectId
65
+ }),
66
+ expectNoContent: true
67
+ });
68
+ }
69
+ };
70
+ this.getSubtree = async (options) => {
71
+ var _a;
72
+ const fetchOptions = this.setFetchOptions(options);
73
+ fetchOptions["tree"] = "true";
74
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions);
75
+ const result = await this.apiClient(fetchUri);
76
+ const root = {
77
+ ...result.tree
78
+ };
79
+ const nodes = [root];
80
+ while (nodes && nodes.length > 0) {
81
+ const currentNode = nodes.pop();
82
+ let lastChild = void 0;
83
+ (_a = currentNode == null ? void 0 : currentNode.children) == null ? void 0 : _a.forEach((child) => {
84
+ child.parent = cutReferences(currentNode);
85
+ child.previousSibling = cutReferences(lastChild);
86
+ if (lastChild) {
87
+ lastChild.nextSibling = cutReferences(child);
88
+ }
89
+ lastChild = child;
90
+ nodes.push(child);
91
+ });
92
+ }
93
+ return root;
94
+ };
95
+ this.getNodes = async (options) => {
96
+ const fetchOptions = this.setFetchOptions(options);
97
+ if (options.limit) {
98
+ fetchOptions["limit"] = options.limit.toString();
99
+ }
100
+ if (options.offset) {
101
+ fetchOptions["offset"] = options.offset.toString();
102
+ }
103
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions);
104
+ return await this.apiClient(fetchUri);
105
+ };
106
+ }
107
+ setFetchOptions(options) {
108
+ const { projectId } = this.options;
109
+ const fetchOptions = {
110
+ projectId,
111
+ projectMapId: options.projectMapId
112
+ };
113
+ if (options.search) {
114
+ fetchOptions["search"] = options.search;
115
+ } else if (options.id) {
116
+ fetchOptions["id"] = options.id;
117
+ } else if (options.path && this.validatePath(options.path)) {
118
+ fetchOptions["path"] = options.path;
119
+ } else if (options.compositionId) {
120
+ fetchOptions["compositionId"] = options.compositionId;
121
+ }
122
+ if (options.withCompositionData) {
123
+ fetchOptions["withCompositionData"] = "true";
124
+ }
125
+ if (options.withCompositionUIStatus) {
126
+ fetchOptions["withCompositionUIStatus"] = "true";
127
+ }
128
+ if (options.depth) {
129
+ fetchOptions["depth"] = options.depth.toString();
130
+ }
131
+ if (options.expanded) {
132
+ fetchOptions["expanded"] = "true";
133
+ }
134
+ return fetchOptions;
135
+ }
136
+ cleanProjectMapNode(node) {
137
+ var _a, _b, _c;
138
+ return {
139
+ 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,
140
+ path: node.path,
141
+ name: node.name,
142
+ type: node.type,
143
+ order: node.order,
144
+ data: node.data,
145
+ compositionId: node.compositionId,
146
+ description: node.description
147
+ };
148
+ }
149
+ validatePath(path) {
150
+ const regex = /[*%!&@]/g;
151
+ const match = path == null ? void 0 : path.match(regex);
152
+ if (match) {
153
+ throw "Path cannot contain reserved characters * % ! & @";
154
+ }
155
+ return true;
156
+ }
157
+ };
158
+ var UncachedProjectMapClient = class extends ProjectMapClient {
159
+ constructor(options) {
160
+ super({ ...options, bypassCache: true });
161
+ }
162
+ };
163
+ var cutReferences = (node) => node ? {
164
+ ...node,
165
+ parent: void 0,
166
+ children: void 0
167
+ } : void 0;
6
168
  export {
7
169
  ProjectMapClient,
8
170
  ROOT_NODE_PATH,
package/dist/index.mjs CHANGED
@@ -1,8 +1,170 @@
1
- import {
2
- ProjectMapClient,
3
- ROOT_NODE_PATH,
4
- UncachedProjectMapClient
5
- } from "./chunk-4GWDA2EG.mjs";
1
+ // src/projectMapClient.ts
2
+ import { ApiClient } from "@uniformdev/context/api";
3
+ var ROOT_NODE_PATH = "/";
4
+ var ProjectMapClient = class extends ApiClient {
5
+ constructor(options) {
6
+ super(options);
7
+ this.getProjectMapDefinitions = async () => {
8
+ const { projectId } = this.options;
9
+ const fetchUri = this.createUrl("/api/v1/project-map", { projectId });
10
+ return await this.apiClient(fetchUri);
11
+ };
12
+ this.getProjectMapDefinition = async (options) => {
13
+ const { projectId } = this.options;
14
+ const fetchUri = this.createUrl("/api/v1/project-map", {
15
+ ...options,
16
+ projectId
17
+ });
18
+ return await this.apiClient(fetchUri);
19
+ };
20
+ this.upsertProjectMap = async (options) => {
21
+ const { projectId } = this.options;
22
+ const fetchUri = this.createUrl("/api/v1/project-map");
23
+ const result = await this.apiClient(fetchUri, {
24
+ method: "PUT",
25
+ body: JSON.stringify({ ...options, projectId })
26
+ });
27
+ return result.projectMapId;
28
+ };
29
+ this.deleteProjectMap = async (options) => {
30
+ const { projectId } = this.options;
31
+ const fetchUri = this.createUrl("/api/v1/project-map");
32
+ await this.apiClient(fetchUri, {
33
+ method: "DELETE",
34
+ body: JSON.stringify({ ...options, projectId }),
35
+ expectNoContent: true
36
+ });
37
+ };
38
+ this.upsertProjectMapNodes = async (options) => {
39
+ const { projectId } = this.options;
40
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes");
41
+ await this.apiClient(fetchUri, {
42
+ method: "PUT",
43
+ body: JSON.stringify({
44
+ ...options,
45
+ projectId,
46
+ nodes: options.nodes.map((n) => {
47
+ return {
48
+ ...n,
49
+ node: { ...this.cleanProjectMapNode(n.node) }
50
+ };
51
+ })
52
+ }),
53
+ expectNoContent: true
54
+ });
55
+ };
56
+ this.deleteProjectMapNode = async (options) => {
57
+ const { projectId } = this.options;
58
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes");
59
+ if (!options.path || this.validatePath(options.path)) {
60
+ await this.apiClient(fetchUri, {
61
+ method: "DELETE",
62
+ body: JSON.stringify({
63
+ ...options,
64
+ projectId
65
+ }),
66
+ expectNoContent: true
67
+ });
68
+ }
69
+ };
70
+ this.getSubtree = async (options) => {
71
+ var _a;
72
+ const fetchOptions = this.setFetchOptions(options);
73
+ fetchOptions["tree"] = "true";
74
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions);
75
+ const result = await this.apiClient(fetchUri);
76
+ const root = {
77
+ ...result.tree
78
+ };
79
+ const nodes = [root];
80
+ while (nodes && nodes.length > 0) {
81
+ const currentNode = nodes.pop();
82
+ let lastChild = void 0;
83
+ (_a = currentNode == null ? void 0 : currentNode.children) == null ? void 0 : _a.forEach((child) => {
84
+ child.parent = cutReferences(currentNode);
85
+ child.previousSibling = cutReferences(lastChild);
86
+ if (lastChild) {
87
+ lastChild.nextSibling = cutReferences(child);
88
+ }
89
+ lastChild = child;
90
+ nodes.push(child);
91
+ });
92
+ }
93
+ return root;
94
+ };
95
+ this.getNodes = async (options) => {
96
+ const fetchOptions = this.setFetchOptions(options);
97
+ if (options.limit) {
98
+ fetchOptions["limit"] = options.limit.toString();
99
+ }
100
+ if (options.offset) {
101
+ fetchOptions["offset"] = options.offset.toString();
102
+ }
103
+ const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions);
104
+ return await this.apiClient(fetchUri);
105
+ };
106
+ }
107
+ setFetchOptions(options) {
108
+ const { projectId } = this.options;
109
+ const fetchOptions = {
110
+ projectId,
111
+ projectMapId: options.projectMapId
112
+ };
113
+ if (options.search) {
114
+ fetchOptions["search"] = options.search;
115
+ } else if (options.id) {
116
+ fetchOptions["id"] = options.id;
117
+ } else if (options.path && this.validatePath(options.path)) {
118
+ fetchOptions["path"] = options.path;
119
+ } else if (options.compositionId) {
120
+ fetchOptions["compositionId"] = options.compositionId;
121
+ }
122
+ if (options.withCompositionData) {
123
+ fetchOptions["withCompositionData"] = "true";
124
+ }
125
+ if (options.withCompositionUIStatus) {
126
+ fetchOptions["withCompositionUIStatus"] = "true";
127
+ }
128
+ if (options.depth) {
129
+ fetchOptions["depth"] = options.depth.toString();
130
+ }
131
+ if (options.expanded) {
132
+ fetchOptions["expanded"] = "true";
133
+ }
134
+ return fetchOptions;
135
+ }
136
+ cleanProjectMapNode(node) {
137
+ var _a, _b, _c;
138
+ return {
139
+ 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,
140
+ path: node.path,
141
+ name: node.name,
142
+ type: node.type,
143
+ order: node.order,
144
+ data: node.data,
145
+ compositionId: node.compositionId,
146
+ description: node.description
147
+ };
148
+ }
149
+ validatePath(path) {
150
+ const regex = /[*%!&@]/g;
151
+ const match = path == null ? void 0 : path.match(regex);
152
+ if (match) {
153
+ throw "Path cannot contain reserved characters * % ! & @";
154
+ }
155
+ return true;
156
+ }
157
+ };
158
+ var UncachedProjectMapClient = class extends ProjectMapClient {
159
+ constructor(options) {
160
+ super({ ...options, bypassCache: true });
161
+ }
162
+ };
163
+ var cutReferences = (node) => node ? {
164
+ ...node,
165
+ parent: void 0,
166
+ children: void 0
167
+ } : void 0;
6
168
  export {
7
169
  ProjectMapClient,
8
170
  ROOT_NODE_PATH,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/project-map",
3
- "version": "18.16.1-alpha.6+644024d8a",
3
+ "version": "18.17.1-alpha.13+77f2eaabc",
4
4
  "description": "Uniform Project Map",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -12,24 +12,9 @@
12
12
  "default": "./dist/index.esm.js"
13
13
  },
14
14
  "require": "./dist/index.js"
15
- },
16
- "./cli": {
17
- "types": "./dist/cli/cli.d.ts",
18
- "import": "./dist/cli/cli.mjs",
19
- "require": "./dist/cli/cli.js"
20
15
  }
21
16
  },
22
17
  "types": "./dist/index.d.ts",
23
- "typesVersions": {
24
- "*": {
25
- "*": [
26
- "./dist/index.d.ts"
27
- ],
28
- "cli": [
29
- "./dist/cli/cli.d.ts"
30
- ]
31
- }
32
- },
33
18
  "sideEffects": false,
34
19
  "scripts": {
35
20
  "build": "run-s update-openapi build:ts",
@@ -46,17 +31,11 @@
46
31
  "/dist"
47
32
  ],
48
33
  "dependencies": {
49
- "@uniformdev/canvas": "18.16.1-alpha.6+644024d8a",
50
- "@uniformdev/context": "18.16.1-alpha.6+644024d8a",
51
- "p-limit": "^3.1.0"
52
- },
53
- "devDependencies": {
54
- "@types/yargs": "17.0.22",
55
- "@uniformdev/cli": "18.16.1-alpha.6+644024d8a",
56
- "yargs": "17.6.2"
34
+ "@uniformdev/canvas": "18.17.1-alpha.13+77f2eaabc",
35
+ "@uniformdev/context": "18.17.1-alpha.13+77f2eaabc"
57
36
  },
58
37
  "publishConfig": {
59
38
  "access": "public"
60
39
  },
61
- "gitHead": "644024d8ad8a3f1f9341039c8813f03058068e9b"
40
+ "gitHead": "77f2eaabc380a8251c040f8bdd21d5451351022f"
62
41
  }
@@ -1,216 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined")
11
- return require.apply(this, arguments);
12
- throw new Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __esm = (fn, res) => function __init() {
15
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
- };
17
- var __commonJS = (cb, mod) => function __require2() {
18
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
- };
20
- var __export = (target, all) => {
21
- for (var name in all)
22
- __defProp(target, name, { get: all[name], enumerable: true });
23
- };
24
- var __copyProps = (to, from, except, desc) => {
25
- if (from && typeof from === "object" || typeof from === "function") {
26
- for (let key of __getOwnPropNames(from))
27
- if (!__hasOwnProp.call(to, key) && key !== except)
28
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
29
- }
30
- return to;
31
- };
32
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
-
38
- // src/projectMapClient.ts
39
- import { ApiClient } from "@uniformdev/context/api";
40
- var ROOT_NODE_PATH = "/";
41
- var ProjectMapClient = class extends ApiClient {
42
- constructor(options) {
43
- super(options);
44
- this.getProjectMapDefinitions = async () => {
45
- const { projectId } = this.options;
46
- const fetchUri = this.createUrl("/api/v1/project-map", { projectId });
47
- return await this.apiClient(fetchUri);
48
- };
49
- this.getProjectMapDefinition = async (options) => {
50
- const { projectId } = this.options;
51
- const fetchUri = this.createUrl("/api/v1/project-map", {
52
- ...options,
53
- projectId
54
- });
55
- return await this.apiClient(fetchUri);
56
- };
57
- this.upsertProjectMap = async (options) => {
58
- const { projectId } = this.options;
59
- const fetchUri = this.createUrl("/api/v1/project-map");
60
- const result = await this.apiClient(fetchUri, {
61
- method: "PUT",
62
- body: JSON.stringify({ ...options, projectId })
63
- });
64
- return result.projectMapId;
65
- };
66
- this.deleteProjectMap = async (options) => {
67
- const { projectId } = this.options;
68
- const fetchUri = this.createUrl("/api/v1/project-map");
69
- await this.apiClient(fetchUri, {
70
- method: "DELETE",
71
- body: JSON.stringify({ ...options, projectId }),
72
- expectNoContent: true
73
- });
74
- };
75
- this.upsertProjectMapNodes = async (options) => {
76
- const { projectId } = this.options;
77
- const fetchUri = this.createUrl("/api/v1/project-map-nodes");
78
- await this.apiClient(fetchUri, {
79
- method: "PUT",
80
- body: JSON.stringify({
81
- ...options,
82
- projectId,
83
- nodes: options.nodes.map((n) => {
84
- return {
85
- ...n,
86
- node: { ...this.cleanProjectMapNode(n.node) }
87
- };
88
- })
89
- }),
90
- expectNoContent: true
91
- });
92
- };
93
- this.deleteProjectMapNode = async (options) => {
94
- const { projectId } = this.options;
95
- const fetchUri = this.createUrl("/api/v1/project-map-nodes");
96
- if (!options.path || this.validatePath(options.path)) {
97
- await this.apiClient(fetchUri, {
98
- method: "DELETE",
99
- body: JSON.stringify({
100
- ...options,
101
- projectId
102
- }),
103
- expectNoContent: true
104
- });
105
- }
106
- };
107
- this.getSubtree = async (options) => {
108
- var _a;
109
- const fetchOptions = this.setFetchOptions(options);
110
- fetchOptions["tree"] = "true";
111
- const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions);
112
- const result = await this.apiClient(fetchUri);
113
- const root = {
114
- ...result.tree
115
- };
116
- const nodes = [root];
117
- while (nodes && nodes.length > 0) {
118
- const currentNode = nodes.pop();
119
- let lastChild = void 0;
120
- (_a = currentNode == null ? void 0 : currentNode.children) == null ? void 0 : _a.forEach((child) => {
121
- child.parent = cutReferences(currentNode);
122
- child.previousSibling = cutReferences(lastChild);
123
- if (lastChild) {
124
- lastChild.nextSibling = cutReferences(child);
125
- }
126
- lastChild = child;
127
- nodes.push(child);
128
- });
129
- }
130
- return root;
131
- };
132
- this.getNodes = async (options) => {
133
- const fetchOptions = this.setFetchOptions(options);
134
- if (options.limit) {
135
- fetchOptions["limit"] = options.limit.toString();
136
- }
137
- if (options.offset) {
138
- fetchOptions["offset"] = options.offset.toString();
139
- }
140
- const fetchUri = this.createUrl("/api/v1/project-map-nodes", fetchOptions);
141
- return await this.apiClient(fetchUri);
142
- };
143
- }
144
- setFetchOptions(options) {
145
- const { projectId } = this.options;
146
- const fetchOptions = {
147
- projectId,
148
- projectMapId: options.projectMapId
149
- };
150
- if (options.search) {
151
- fetchOptions["search"] = options.search;
152
- } else if (options.id) {
153
- fetchOptions["id"] = options.id;
154
- } else if (options.path && this.validatePath(options.path)) {
155
- fetchOptions["path"] = options.path;
156
- } else if (options.compositionId) {
157
- fetchOptions["compositionId"] = options.compositionId;
158
- }
159
- if (options.withCompositionData) {
160
- fetchOptions["withCompositionData"] = "true";
161
- }
162
- if (options.withCompositionUIStatus) {
163
- fetchOptions["withCompositionUIStatus"] = "true";
164
- }
165
- if (options.depth) {
166
- fetchOptions["depth"] = options.depth.toString();
167
- }
168
- if (options.expanded) {
169
- fetchOptions["expanded"] = "true";
170
- }
171
- return fetchOptions;
172
- }
173
- cleanProjectMapNode(node) {
174
- var _a, _b, _c;
175
- return {
176
- 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,
177
- path: node.path,
178
- name: node.name,
179
- type: node.type,
180
- order: node.order,
181
- data: node.data,
182
- compositionId: node.compositionId,
183
- description: node.description
184
- };
185
- }
186
- validatePath(path) {
187
- const regex = /[*%!&@]/g;
188
- const match = path == null ? void 0 : path.match(regex);
189
- if (match) {
190
- throw "Path cannot contain reserved characters * % ! & @";
191
- }
192
- return true;
193
- }
194
- };
195
- var UncachedProjectMapClient = class extends ProjectMapClient {
196
- constructor(options) {
197
- super({ ...options, bypassCache: true });
198
- }
199
- };
200
- var cutReferences = (node) => node ? {
201
- ...node,
202
- parent: void 0,
203
- children: void 0
204
- } : void 0;
205
-
206
- export {
207
- __require,
208
- __esm,
209
- __commonJS,
210
- __export,
211
- __toESM,
212
- __toCommonJS,
213
- ROOT_NODE_PATH,
214
- ProjectMapClient,
215
- UncachedProjectMapClient
216
- };
package/dist/cli/cli.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import { UniformCLIPlugin } from '@uniformdev/cli';
2
-
3
- declare const uniformCLI: UniformCLIPlugin;
4
-
5
- export { uniformCLI };