@@ -2,9 +2,10 @@ const { Command } = require("commander");
2
2
const inquirer = require("inquirer");
3
3
const { projectsCreate } = require("./projects");
4
4
const { storageCreateBucket } = require("./storage");
5
+ const { messagingCreateTopic } = require("./messaging");
5
6
const { sdkForConsole } = require("../sdks");
6
7
const { localConfig } = require("../config");
7
- const { questionsCreateProject, questionsCreateBucket } = require("../questions");
8
+ const { questionsCreateProject, questionsCreateBucket, questionsCreateMessagingTopic } = require("../questions");
8
9
const { success, error, actionRunner, commandDescriptions } = require("../parser");
9
10
10
11
const create = new Command("create")
@@ -32,7 +33,6 @@ const createProject = async () => {
32
33
success();
33
34
}
34
35
35
-
36
36
const createBucket = async () => {
37
37
let response = {}
38
38
const answers = await inquirer.prompt(questionsCreateBucket)
@@ -54,18 +54,37 @@ const createBucket = async () => {
54
54
}
55
55
};
56
56
57
- const createFunction = async () => {
57
+ const createCollection = async () => {
58
58
59
59
};
60
60
61
- const createCollection = async () => {
61
+ const createTopic = async () => {
62
+ let response = {}
63
+ const answers = await inquirer.prompt(questionsCreateMessagingTopic)
64
+ if (!answers.topic || !answers.id) process.exit(1)
65
+
66
+ try {
67
+ response = await messagingCreateTopic({
68
+ topicId: answers.id,
69
+ name: answers.topic,
70
+ parseOutput: false
71
+ })
62
72
73
+ {# localConfig.addMessagingTopic(response);#}
74
+ success();
75
+ } catch (e) {
76
+ error(e.getMessage ?? 'Unknown error occurred. Please try again');
77
+ }
63
78
};
64
79
65
- const createTopic = async () => {
80
+ const createFunction = async () => {
66
81
67
82
};
68
83
84
+
85
+
86
+
87
+
69
88
create
70
89
.command("project")
71
90
.description("Create a new {{ spec .title | caseUcfirst }} project")
0 commit comments