@cipherly/plane-cli 1.0.0 → 1.0.1
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/package.json +7 -7
- package/src/estimates/index.ts +1 -0
- package/src/estimates/list.estimates.ts +42 -0
- package/src/plane.ts +9 -1
- package/src/projects/index.ts +1 -1
- package/src/projects/members/index.ts +1 -0
- package/src/projects/members/list.members.projects.ts +34 -0
- package/src/utils.ts +1 -0
- package/src/work-items/create.work-items.ts +3 -3
- package/src/work-items/update.work-items.ts +2 -2
- package/dist/cycles/create.cycles.js +0 -44
- package/dist/cycles/delete.cycles.js +0 -30
- package/dist/cycles/index.js +0 -21
- package/dist/cycles/list.cycles.js +0 -42
- package/dist/cycles/update.cycles.js +0 -46
- package/dist/cycles/work-items/index.js +0 -17
- package/dist/cycles/work-items/list.cycles.work-items.js +0 -43
- package/dist/labels/create.labels.js +0 -34
- package/dist/labels/delete.labels.js +0 -30
- package/dist/labels/index.js +0 -20
- package/dist/labels/list.labels.js +0 -36
- package/dist/labels/update.labels.js +0 -36
- package/dist/plane.js +0 -60
- package/dist/projects/create.projects.js +0 -38
- package/dist/projects/delete.projects.js +0 -28
- package/dist/projects/index.js +0 -20
- package/dist/projects/list.projects.js +0 -35
- package/dist/projects/update.projects.js +0 -39
- package/dist/states/create.states.js +0 -37
- package/dist/states/delete.states.js +0 -30
- package/dist/states/index.js +0 -20
- package/dist/states/list.states.js +0 -36
- package/dist/states/update.states.js +0 -36
- package/dist/users/index.js +0 -17
- package/dist/users/me.users.js +0 -36
- package/dist/utils.js +0 -63
- package/dist/work-items/create.work-items.js +0 -51
- package/dist/work-items/delete.work-items.js +0 -30
- package/dist/work-items/index.js +0 -21
- package/dist/work-items/list.work-items.js +0 -44
- package/dist/work-items/types/index.js +0 -17
- package/dist/work-items/types/list.types.work-items.js +0 -40
- package/dist/work-items/update.work-items.js +0 -41
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createProject = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const list_projects_1 = require("./list.projects");
|
|
7
|
-
exports.createProject = new commander_1.Command("create")
|
|
8
|
-
.description("Create a new project")
|
|
9
|
-
.requiredOption("-n, --name <name>", "Project's name")
|
|
10
|
-
.requiredOption("-i, --identifier <identifier>", "Project' identifier")
|
|
11
|
-
.option("-d, --description [description]", "Project's description")
|
|
12
|
-
.action(async (__, cmd) => {
|
|
13
|
-
if (cmd.parent == null)
|
|
14
|
-
return;
|
|
15
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
16
|
-
const name = cmd.getOptionValue("name");
|
|
17
|
-
const identifier = cmd.getOptionValue("identifier");
|
|
18
|
-
const description = cmd.getOptionValue("description");
|
|
19
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
20
|
-
apiBase,
|
|
21
|
-
apiKey,
|
|
22
|
-
endpoint: `workspaces/${workspaceSlug}/projects/`,
|
|
23
|
-
method: "POST",
|
|
24
|
-
body: {
|
|
25
|
-
name,
|
|
26
|
-
identifier,
|
|
27
|
-
description,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
if (json)
|
|
31
|
-
console.log(JSON.stringify(result));
|
|
32
|
-
else {
|
|
33
|
-
if (status !== 201)
|
|
34
|
-
console.table(result);
|
|
35
|
-
else
|
|
36
|
-
console.table((0, list_projects_1.renderProject)(result));
|
|
37
|
-
}
|
|
38
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteProject = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
exports.deleteProject = new commander_1.Command("delete")
|
|
7
|
-
.description("Delete a project")
|
|
8
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
9
|
-
.action(async (__, cmd) => {
|
|
10
|
-
if (cmd.parent == null)
|
|
11
|
-
return;
|
|
12
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
13
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
14
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
15
|
-
apiBase,
|
|
16
|
-
apiKey,
|
|
17
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/`,
|
|
18
|
-
method: "DELETE",
|
|
19
|
-
});
|
|
20
|
-
if (json)
|
|
21
|
-
console.log(JSON.stringify(result));
|
|
22
|
-
else {
|
|
23
|
-
if (status !== 204)
|
|
24
|
-
console.table(result);
|
|
25
|
-
else
|
|
26
|
-
console.table(result);
|
|
27
|
-
}
|
|
28
|
-
});
|
package/dist/projects/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./list.projects"), exports);
|
|
18
|
-
__exportStar(require("./create.projects"), exports);
|
|
19
|
-
__exportStar(require("./update.projects"), exports);
|
|
20
|
-
__exportStar(require("./delete.projects"), exports);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderProject = exports.listProjects = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
exports.listProjects = new commander_1.Command("list")
|
|
7
|
-
.description("List projects")
|
|
8
|
-
.action(async (__, cmd) => {
|
|
9
|
-
if (cmd.parent == null)
|
|
10
|
-
return;
|
|
11
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
12
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
13
|
-
apiBase,
|
|
14
|
-
apiKey,
|
|
15
|
-
endpoint: `workspaces/${workspaceSlug}/projects/`,
|
|
16
|
-
method: "GET",
|
|
17
|
-
});
|
|
18
|
-
if (json)
|
|
19
|
-
console.log(JSON.stringify(result));
|
|
20
|
-
else {
|
|
21
|
-
if (status !== 200)
|
|
22
|
-
console.table(result);
|
|
23
|
-
else
|
|
24
|
-
console.table(result.results.map(exports.renderProject));
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const renderProject = (project) => {
|
|
28
|
-
return {
|
|
29
|
-
id: project.id,
|
|
30
|
-
name: project.name,
|
|
31
|
-
description: project.description,
|
|
32
|
-
total_members: project.total_members,
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
exports.renderProject = renderProject;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateProject = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const list_projects_1 = require("./list.projects");
|
|
7
|
-
exports.updateProject = new commander_1.Command("update")
|
|
8
|
-
.description("Update a project")
|
|
9
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
10
|
-
.option("-n, --name [name]", "Project's name")
|
|
11
|
-
.option("-d, --description [description]", "Project's description")
|
|
12
|
-
.action(async (__, cmd) => {
|
|
13
|
-
if (cmd.parent == null)
|
|
14
|
-
return;
|
|
15
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
16
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
17
|
-
const name = cmd.getOptionValue("name");
|
|
18
|
-
const description = cmd.getOptionValue("description");
|
|
19
|
-
const body = {};
|
|
20
|
-
if (name !== undefined)
|
|
21
|
-
body.name = name;
|
|
22
|
-
if (description !== undefined)
|
|
23
|
-
body.description = description;
|
|
24
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
25
|
-
apiBase,
|
|
26
|
-
apiKey,
|
|
27
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/`,
|
|
28
|
-
method: "PATCH",
|
|
29
|
-
body,
|
|
30
|
-
});
|
|
31
|
-
if (json)
|
|
32
|
-
console.log(JSON.stringify(result));
|
|
33
|
-
else {
|
|
34
|
-
if (status !== 200)
|
|
35
|
-
console.table(result);
|
|
36
|
-
else
|
|
37
|
-
console.table((0, list_projects_1.renderProject)(result));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createState = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const list_states_1 = require("./list.states");
|
|
7
|
-
exports.createState = new commander_1.Command("create")
|
|
8
|
-
.description("Create a new state")
|
|
9
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
10
|
-
.requiredOption("-n, --name <name>", "State's name")
|
|
11
|
-
.requiredOption("-c, --color <color>", "State's color")
|
|
12
|
-
.action(async (__, cmd) => {
|
|
13
|
-
if (cmd.parent == null)
|
|
14
|
-
return;
|
|
15
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
16
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
17
|
-
const name = cmd.getOptionValue("name");
|
|
18
|
-
const color = cmd.getOptionValue("color");
|
|
19
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
20
|
-
apiBase,
|
|
21
|
-
apiKey,
|
|
22
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/states/`,
|
|
23
|
-
method: "POST",
|
|
24
|
-
body: {
|
|
25
|
-
name,
|
|
26
|
-
color,
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
if (json)
|
|
30
|
-
console.log(JSON.stringify(result));
|
|
31
|
-
else {
|
|
32
|
-
if (status !== 201)
|
|
33
|
-
console.table(result);
|
|
34
|
-
else
|
|
35
|
-
console.table((0, list_states_1.renderState)(result));
|
|
36
|
-
}
|
|
37
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteState = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
exports.deleteState = new commander_1.Command("delete")
|
|
7
|
-
.description("Delete a state")
|
|
8
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
9
|
-
.requiredOption("-s, --state-id <stateId>", "State's ID")
|
|
10
|
-
.action(async (__, cmd) => {
|
|
11
|
-
if (cmd.parent == null)
|
|
12
|
-
return;
|
|
13
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
14
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
15
|
-
const stateId = cmd.getOptionValue("stateId");
|
|
16
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
17
|
-
apiBase,
|
|
18
|
-
apiKey,
|
|
19
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/states/${stateId}/`,
|
|
20
|
-
method: "DELETE",
|
|
21
|
-
});
|
|
22
|
-
if (json)
|
|
23
|
-
console.log(JSON.stringify(result));
|
|
24
|
-
else {
|
|
25
|
-
if (status !== 204)
|
|
26
|
-
console.table(result);
|
|
27
|
-
else
|
|
28
|
-
console.table(result);
|
|
29
|
-
}
|
|
30
|
-
});
|
package/dist/states/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./list.states"), exports);
|
|
18
|
-
__exportStar(require("./create.states"), exports);
|
|
19
|
-
__exportStar(require("./update.states"), exports);
|
|
20
|
-
__exportStar(require("./delete.states"), exports);
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderState = exports.listStates = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
exports.listStates = new commander_1.Command("list")
|
|
7
|
-
.description("List states")
|
|
8
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
9
|
-
.action(async (__, cmd) => {
|
|
10
|
-
if (cmd.parent == null)
|
|
11
|
-
return;
|
|
12
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
13
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
14
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
15
|
-
apiBase,
|
|
16
|
-
apiKey,
|
|
17
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/states/`,
|
|
18
|
-
method: "GET",
|
|
19
|
-
});
|
|
20
|
-
if (json)
|
|
21
|
-
console.log(JSON.stringify(result));
|
|
22
|
-
else {
|
|
23
|
-
if (status !== 200)
|
|
24
|
-
console.table(result);
|
|
25
|
-
else
|
|
26
|
-
console.table(result.results.map(exports.renderState));
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const renderState = (state) => {
|
|
30
|
-
return {
|
|
31
|
-
id: state.id,
|
|
32
|
-
name: state.name,
|
|
33
|
-
description: state.description,
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
exports.renderState = renderState;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateState = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const list_states_1 = require("./list.states");
|
|
7
|
-
exports.updateState = new commander_1.Command("update")
|
|
8
|
-
.description("Update a state")
|
|
9
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
10
|
-
.requiredOption("-s, --state-id <stateId>", "State's ID")
|
|
11
|
-
.requiredOption("-n, --name <name>", "State's name")
|
|
12
|
-
.action(async (__, cmd) => {
|
|
13
|
-
if (cmd.parent == null)
|
|
14
|
-
return;
|
|
15
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
16
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
17
|
-
const stateId = cmd.getOptionValue("stateId");
|
|
18
|
-
const name = cmd.getOptionValue("name");
|
|
19
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
20
|
-
apiBase,
|
|
21
|
-
apiKey,
|
|
22
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/states/${stateId}/`,
|
|
23
|
-
method: "PATCH",
|
|
24
|
-
body: {
|
|
25
|
-
name,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
if (json)
|
|
29
|
-
console.log(JSON.stringify(result));
|
|
30
|
-
else {
|
|
31
|
-
if (status !== 200)
|
|
32
|
-
console.table(result);
|
|
33
|
-
else
|
|
34
|
-
console.table((0, list_states_1.renderState)(result));
|
|
35
|
-
}
|
|
36
|
-
});
|
package/dist/users/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./me.users"), exports);
|
package/dist/users/me.users.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderUser = exports.getCurrentUser = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
exports.getCurrentUser = new commander_1.Command("me")
|
|
7
|
-
.description("Get current user")
|
|
8
|
-
.action(async (__, cmd) => {
|
|
9
|
-
if (cmd.parent == null)
|
|
10
|
-
return;
|
|
11
|
-
const { apiKey, apiBase, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
12
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
13
|
-
apiBase,
|
|
14
|
-
apiKey,
|
|
15
|
-
endpoint: `users/me/`,
|
|
16
|
-
method: "GET",
|
|
17
|
-
});
|
|
18
|
-
if (json)
|
|
19
|
-
console.log(JSON.stringify(result));
|
|
20
|
-
else {
|
|
21
|
-
if (status !== 200)
|
|
22
|
-
console.table(result);
|
|
23
|
-
else
|
|
24
|
-
console.table((0, exports.renderUser)(result));
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
const renderUser = (user) => {
|
|
28
|
-
return {
|
|
29
|
-
id: user.id,
|
|
30
|
-
first_name: user.first_name,
|
|
31
|
-
last_name: user.last_name,
|
|
32
|
-
email: user.email,
|
|
33
|
-
display_name: user.display_name,
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
exports.renderUser = renderUser;
|
package/dist/utils.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requestPlaneAPI = exports.checkRequiredOptionsAndReturn = exports.checkWorkspaceSlug = exports.checkApiBase = exports.checkApiKey = void 0;
|
|
4
|
-
const checkApiKey = (apiKey) => {
|
|
5
|
-
if (!apiKey) {
|
|
6
|
-
console.error("No API key provided. Use: plane <command> --api-key <API_KEY> or set PLANE_API_KEY environment variable");
|
|
7
|
-
process.exit(1);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
exports.checkApiKey = checkApiKey;
|
|
11
|
-
const checkApiBase = (apiBase) => {
|
|
12
|
-
if (!apiBase) {
|
|
13
|
-
console.error("No API base provided. Use: plane <command> --api-base <API_BASE> or set PLANE_API_BASE environment variable");
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
exports.checkApiBase = checkApiBase;
|
|
18
|
-
const checkWorkspaceSlug = (workspaceSlug) => {
|
|
19
|
-
if (!workspaceSlug) {
|
|
20
|
-
console.error("No workspace slug provided. Use: plane <command> --workspace-slug <SLUG> or set PLANE_WORKSPACE_SLUG environment variable");
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
exports.checkWorkspaceSlug = checkWorkspaceSlug;
|
|
25
|
-
const checkRequiredOptionsAndReturn = (cmd) => {
|
|
26
|
-
const apiKey = cmd.parent.getOptionValue("apiKey");
|
|
27
|
-
const apiBase = cmd.parent.getOptionValue("apiBase");
|
|
28
|
-
const workspaceSlug = cmd.parent.getOptionValue("workspaceSlug");
|
|
29
|
-
(0, exports.checkApiKey)(apiKey);
|
|
30
|
-
(0, exports.checkApiBase)(apiBase);
|
|
31
|
-
(0, exports.checkWorkspaceSlug)(workspaceSlug);
|
|
32
|
-
const json = cmd.parent.getOptionValue("json");
|
|
33
|
-
return {
|
|
34
|
-
apiKey,
|
|
35
|
-
apiBase,
|
|
36
|
-
workspaceSlug,
|
|
37
|
-
json,
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
exports.checkRequiredOptionsAndReturn = checkRequiredOptionsAndReturn;
|
|
41
|
-
const requestPlaneAPI = async ({ apiKey, apiBase, endpoint, method, body, params, no_v1, }) => {
|
|
42
|
-
let url = `${apiBase}/api${(!!!no_v1 && "/v1") || ""}/${endpoint}`;
|
|
43
|
-
if (params) {
|
|
44
|
-
const qs = new URLSearchParams(params).toString();
|
|
45
|
-
url += `?${qs}`;
|
|
46
|
-
}
|
|
47
|
-
const headers = {
|
|
48
|
-
"X-API-Key": apiKey,
|
|
49
|
-
"Content-Type": "application/json",
|
|
50
|
-
};
|
|
51
|
-
const opts = { method, headers, body };
|
|
52
|
-
if (body)
|
|
53
|
-
opts.body = JSON.stringify(body);
|
|
54
|
-
try {
|
|
55
|
-
const res = await fetch(url, opts);
|
|
56
|
-
return { result: await res.json(), status: res.status };
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
console.error("Request failed:", err.message);
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
exports.requestPlaneAPI = requestPlaneAPI;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWorkItem = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
const list_work_items_1 = require("./list.work-items");
|
|
7
|
-
exports.createWorkItem = new commander_1.Command("create")
|
|
8
|
-
.description("Create a new work-item")
|
|
9
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
10
|
-
.requiredOption("-n, --name <name>", "Work item's name")
|
|
11
|
-
.option("-d, --description [description_html]", "Work item's description in HTML")
|
|
12
|
-
.option("-s, --state <state>", "Work item's state ID")
|
|
13
|
-
.option("-a, --assignees <assignees>", "Work item's assignees IDs (comma seperated)")
|
|
14
|
-
.addOption(new commander_1.Option("-u, --priority <priority>", "Work item's priority").choices([
|
|
15
|
-
"none",
|
|
16
|
-
"urgent",
|
|
17
|
-
"high",
|
|
18
|
-
"medium",
|
|
19
|
-
"low",
|
|
20
|
-
]))
|
|
21
|
-
.option("-l, --labels <labels>", "Work item's labels IDs (comma seperated)")
|
|
22
|
-
.option("--parent <parent>", "Work item's parent ID")
|
|
23
|
-
.option("-ep, --estimate-point <estimatePoint>", "Work item's estimate point")
|
|
24
|
-
.action(async (__, cmd) => {
|
|
25
|
-
if (cmd.parent == null)
|
|
26
|
-
return;
|
|
27
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
28
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
29
|
-
const name = cmd.getOptionValue("name");
|
|
30
|
-
const description_html = cmd.getOptionValue("description");
|
|
31
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
32
|
-
apiBase,
|
|
33
|
-
apiKey,
|
|
34
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/issues/`,
|
|
35
|
-
method: "POST",
|
|
36
|
-
body: {
|
|
37
|
-
name,
|
|
38
|
-
description_html,
|
|
39
|
-
project_id: projectId,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
if (json) {
|
|
43
|
-
console.log(JSON.stringify(result));
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
if (status !== 201)
|
|
47
|
-
console.table(result);
|
|
48
|
-
else
|
|
49
|
-
console.table((0, list_work_items_1.renderWorkItem)(result));
|
|
50
|
-
}
|
|
51
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteWorkItem = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
exports.deleteWorkItem = new commander_1.Command("delete")
|
|
7
|
-
.description("Delete a work-item")
|
|
8
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
9
|
-
.requiredOption("-w, --work-item-id <workItemId>", "Work item's ID")
|
|
10
|
-
.action(async (__, cmd) => {
|
|
11
|
-
if (cmd.parent == null)
|
|
12
|
-
return;
|
|
13
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
14
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
15
|
-
const workItemId = cmd.getOptionValue("workItemId");
|
|
16
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
17
|
-
apiBase,
|
|
18
|
-
apiKey,
|
|
19
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/work-items/${workItemId}/`,
|
|
20
|
-
method: "DELETE",
|
|
21
|
-
});
|
|
22
|
-
if (json)
|
|
23
|
-
console.log(JSON.stringify(result));
|
|
24
|
-
else {
|
|
25
|
-
if (status !== 204)
|
|
26
|
-
console.table(result);
|
|
27
|
-
else
|
|
28
|
-
console.table(result);
|
|
29
|
-
}
|
|
30
|
-
});
|
package/dist/work-items/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./list.work-items"), exports);
|
|
18
|
-
__exportStar(require("./create.work-items"), exports);
|
|
19
|
-
__exportStar(require("./update.work-items"), exports);
|
|
20
|
-
__exportStar(require("./delete.work-items"), exports);
|
|
21
|
-
__exportStar(require("./types"), exports);
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderWorkItem = exports.listWorkItems = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../utils");
|
|
6
|
-
exports.listWorkItems = new commander_1.Command("list")
|
|
7
|
-
.description("List work items")
|
|
8
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
9
|
-
.action(async (__, cmd) => {
|
|
10
|
-
if (cmd.parent == null)
|
|
11
|
-
return;
|
|
12
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
13
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
14
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
15
|
-
apiBase,
|
|
16
|
-
apiKey,
|
|
17
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/work-items/`,
|
|
18
|
-
method: "GET",
|
|
19
|
-
params: {
|
|
20
|
-
expand: "state,labels,assignees",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
if (json)
|
|
24
|
-
console.log(JSON.stringify(result));
|
|
25
|
-
else {
|
|
26
|
-
if (status !== 200)
|
|
27
|
-
console.table(result);
|
|
28
|
-
else
|
|
29
|
-
console.table(result.results.map(exports.renderWorkItem));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const renderWorkItem = (workItem) => {
|
|
33
|
-
return {
|
|
34
|
-
id: workItem.id,
|
|
35
|
-
name: workItem.name,
|
|
36
|
-
state: (workItem.state && workItem.state.name) || null,
|
|
37
|
-
labels: (workItem.labels && workItem.labels.map((label) => label.name)) ||
|
|
38
|
-
[],
|
|
39
|
-
assignees: (workItem.assignees &&
|
|
40
|
-
workItem.assignees.map((user) => `${user.first_name} ${user.last_name}`.trim())) ||
|
|
41
|
-
[],
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
exports.renderWorkItem = renderWorkItem;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./list.types.work-items"), exports);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderWorkItemType = exports.listWorkItemTypes = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
exports.listWorkItemTypes = new commander_1.Command("list")
|
|
7
|
-
.description("List work item types")
|
|
8
|
-
.requiredOption("-p, --project-id <projectId>", "Project's ID")
|
|
9
|
-
.action(async (__, cmd) => {
|
|
10
|
-
if (cmd.parent == null)
|
|
11
|
-
return;
|
|
12
|
-
const { apiKey, apiBase, workspaceSlug, json } = (0, utils_1.checkRequiredOptionsAndReturn)(cmd);
|
|
13
|
-
const projectId = cmd.getOptionValue("projectId");
|
|
14
|
-
const { result, status } = await (0, utils_1.requestPlaneAPI)({
|
|
15
|
-
apiBase,
|
|
16
|
-
apiKey,
|
|
17
|
-
endpoint: `workspaces/${workspaceSlug}/projects/${projectId}/work-item-types/`,
|
|
18
|
-
method: "GET",
|
|
19
|
-
});
|
|
20
|
-
if (json)
|
|
21
|
-
console.log(JSON.stringify(result));
|
|
22
|
-
else {
|
|
23
|
-
if (status !== 200)
|
|
24
|
-
console.table(result);
|
|
25
|
-
else
|
|
26
|
-
console.table(result.results.map(exports.renderWorkItemType));
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const renderWorkItemType = (workItemType) => {
|
|
30
|
-
return {
|
|
31
|
-
id: workItemType.id,
|
|
32
|
-
name: workItemType.name,
|
|
33
|
-
description: workItemType.description,
|
|
34
|
-
is_epic: workItemType.is_epic,
|
|
35
|
-
is_default: workItemType.is_default,
|
|
36
|
-
is_active: workItemType.is_active,
|
|
37
|
-
level: workItemType.level,
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
exports.renderWorkItemType = renderWorkItemType;
|