@boltic/cli 1.0.24 → 1.0.25
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/helper/folder.js +30 -16
- package/package.json +1 -4
package/helper/folder.js
CHANGED
|
@@ -86,12 +86,22 @@ export const createIntegrationFolderStructure = async (
|
|
|
86
86
|
export const createExistingIntegrationsFolder = async (payload) => {
|
|
87
87
|
const {
|
|
88
88
|
integration,
|
|
89
|
-
authentication,
|
|
90
|
-
webhook,
|
|
91
|
-
configuration,
|
|
92
|
-
resources,
|
|
93
|
-
operations,
|
|
94
|
-
} = payload;
|
|
89
|
+
authentication = {},
|
|
90
|
+
webhook = {},
|
|
91
|
+
configuration = {},
|
|
92
|
+
resources = [],
|
|
93
|
+
operations = [],
|
|
94
|
+
} = payload || {};
|
|
95
|
+
|
|
96
|
+
// Validate required payload fields early to prevent null dereferences
|
|
97
|
+
if (!integration || !integration.name) {
|
|
98
|
+
console.error(
|
|
99
|
+
chalk.red(
|
|
100
|
+
"\n❌ Invalid integration payload received. Missing integration or name."
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
95
105
|
|
|
96
106
|
const {
|
|
97
107
|
id,
|
|
@@ -137,15 +147,17 @@ export const createExistingIntegrationsFolder = async (payload) => {
|
|
|
137
147
|
const resourcesDir = path.join(schemasDir, "resources");
|
|
138
148
|
fs.mkdirSync(resourcesDir, { recursive: true });
|
|
139
149
|
|
|
140
|
-
const authentication_documentation = authentication
|
|
150
|
+
const authentication_documentation = authentication?.documentation || "";
|
|
141
151
|
|
|
142
152
|
// Define files and content
|
|
143
153
|
const files = {
|
|
144
|
-
|
|
145
|
-
authentication.
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
...(authentication && {
|
|
155
|
+
"schemas/authentication.json": JSON.stringify(
|
|
156
|
+
authentication?.content || {},
|
|
157
|
+
null,
|
|
158
|
+
4
|
|
159
|
+
),
|
|
160
|
+
}),
|
|
149
161
|
"schemas/base.json": JSON.stringify(
|
|
150
162
|
configuration?.content || {},
|
|
151
163
|
null,
|
|
@@ -153,7 +165,9 @@ export const createExistingIntegrationsFolder = async (payload) => {
|
|
|
153
165
|
),
|
|
154
166
|
"schemas/webhook.json": JSON.stringify(webhook?.content || {}, null, 4),
|
|
155
167
|
"spec.json": JSON.stringify(spec, null, 4),
|
|
156
|
-
|
|
168
|
+
...(authentication && {
|
|
169
|
+
"Authentication.mdx": authentication_documentation || "",
|
|
170
|
+
}),
|
|
157
171
|
"Documentation.mdx": documentation || "",
|
|
158
172
|
};
|
|
159
173
|
|
|
@@ -163,7 +177,7 @@ export const createExistingIntegrationsFolder = async (payload) => {
|
|
|
163
177
|
const resourceName = resource.name.toLowerCase().replace(/\s+/g, "-");
|
|
164
178
|
const resourcePath = path.join(resourcesDir, `${resourceName}.json`);
|
|
165
179
|
|
|
166
|
-
const resourceOperations = operations.filter(
|
|
180
|
+
const resourceOperations = (operations || []).filter(
|
|
167
181
|
(operation) => operation.resource_id === resource_id
|
|
168
182
|
);
|
|
169
183
|
|
|
@@ -172,14 +186,14 @@ export const createExistingIntegrationsFolder = async (payload) => {
|
|
|
172
186
|
const operationName = operation.name
|
|
173
187
|
.toLowerCase()
|
|
174
188
|
.replace(/\s+/g, "-");
|
|
175
|
-
acc[operationName] = operation
|
|
189
|
+
acc[operationName] = operation?.content;
|
|
176
190
|
return acc;
|
|
177
191
|
},
|
|
178
192
|
{}
|
|
179
193
|
);
|
|
180
194
|
|
|
181
195
|
const resourceFileContent = {
|
|
182
|
-
...resource
|
|
196
|
+
...resource?.content,
|
|
183
197
|
...operationsContent,
|
|
184
198
|
};
|
|
185
199
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@boltic/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "A powerful CLI tool for managing Boltic Workflow integrations - create, sync, test, and publish integrations with ease",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -129,9 +129,6 @@
|
|
|
129
129
|
"nodemon": "^3.1.10",
|
|
130
130
|
"prettier": "^3.6.2"
|
|
131
131
|
},
|
|
132
|
-
"peerDependencies": {
|
|
133
|
-
"node": ">=18.0.0"
|
|
134
|
-
},
|
|
135
132
|
"os": [
|
|
136
133
|
"darwin",
|
|
137
134
|
"linux",
|