@superblocksteam/sdk 1.14.3 → 1.14.4
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/client.js +5 -8
- package/package.json +2 -2
- package/src/client.ts +7 -11
package/dist/client.js
CHANGED
|
@@ -291,7 +291,6 @@ async function fetchApis(cliVersion, token, superblocksBaseUrl) {
|
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
async function validateGitSetup(cliVersion, resourceId, resourceType, event, localGitRepoState, token, superblocksBaseUrl, injectedHeaders) {
|
|
294
|
-
let resourceName;
|
|
295
294
|
try {
|
|
296
295
|
const requestBody = {
|
|
297
296
|
event,
|
|
@@ -323,9 +322,6 @@ async function validateGitSetup(cliVersion, resourceId, resourceType, event, loc
|
|
|
323
322
|
const response = await (0, axios_1.default)(config);
|
|
324
323
|
const { validationResult } = response.data.data;
|
|
325
324
|
if (validationResult.errors.length > 0) {
|
|
326
|
-
if (validationResult.resourceName) {
|
|
327
|
-
resourceName = validationResult.resourceName;
|
|
328
|
-
}
|
|
329
325
|
throw new Error(validationResult.errors.join("\n"));
|
|
330
326
|
}
|
|
331
327
|
return {
|
|
@@ -344,14 +340,15 @@ async function validateGitSetup(cliVersion, resourceId, resourceType, event, loc
|
|
|
344
340
|
else {
|
|
345
341
|
message = `${e?.message ? e.message : e}`;
|
|
346
342
|
}
|
|
347
|
-
const errorMessage = `Could not validate your git setup against Superblocks for ${resourceType.toLowerCase()} ${resourceName ?? resourceId}${message ? "\n" + message : ""}`;
|
|
348
343
|
// TODO(@taha-au @gpoulios-sb) Replace this check with a more robust one that uses error codes once
|
|
349
344
|
// the backend starts returning them as part of the response body
|
|
350
|
-
if (message.includes("Please initialize git locally")
|
|
351
|
-
|
|
345
|
+
if (message.includes("Please initialize git locally") ||
|
|
346
|
+
message.includes("Superblocks does not have a reference to") ||
|
|
347
|
+
message.includes("Branching is not enabled")) {
|
|
348
|
+
throw new errors_1.ValidateGitSetupError(message);
|
|
352
349
|
}
|
|
353
350
|
else {
|
|
354
|
-
throw new Error(
|
|
351
|
+
throw new Error(message);
|
|
355
352
|
}
|
|
356
353
|
}
|
|
357
354
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/sdk",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.4",
|
|
4
4
|
"description": "Superblocks JS SDK",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"form-data": "^4.0.0",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
31
|
"ws": "^8.17.0",
|
|
32
|
-
"@superblocksteam/util": "1.14.
|
|
32
|
+
"@superblocksteam/util": "1.14.4"
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://www.superblocks.com",
|
|
35
35
|
"engines": {
|
package/src/client.ts
CHANGED
|
@@ -481,7 +481,6 @@ export async function validateGitSetup(
|
|
|
481
481
|
superblocksBaseUrl: string,
|
|
482
482
|
injectedHeaders?: Record<string, string>,
|
|
483
483
|
) {
|
|
484
|
-
let resourceName: string | undefined;
|
|
485
484
|
try {
|
|
486
485
|
const requestBody: ValidateGitSetupRequestBody = {
|
|
487
486
|
event,
|
|
@@ -516,9 +515,6 @@ export async function validateGitSetup(
|
|
|
516
515
|
const response = await axios(config);
|
|
517
516
|
const { validationResult } = response.data.data;
|
|
518
517
|
if (validationResult.errors.length > 0) {
|
|
519
|
-
if (validationResult.resourceName) {
|
|
520
|
-
resourceName = validationResult.resourceName;
|
|
521
|
-
}
|
|
522
518
|
throw new Error(validationResult.errors.join("\n"));
|
|
523
519
|
}
|
|
524
520
|
return {
|
|
@@ -536,16 +532,16 @@ export async function validateGitSetup(
|
|
|
536
532
|
message = `${e?.message ? e.message : e}`;
|
|
537
533
|
}
|
|
538
534
|
|
|
539
|
-
const errorMessage = `Could not validate your git setup against Superblocks for ${resourceType.toLowerCase()} ${
|
|
540
|
-
resourceName ?? resourceId
|
|
541
|
-
}${message ? "\n" + message : ""}`;
|
|
542
|
-
|
|
543
535
|
// TODO(@taha-au @gpoulios-sb) Replace this check with a more robust one that uses error codes once
|
|
544
536
|
// the backend starts returning them as part of the response body
|
|
545
|
-
if (
|
|
546
|
-
|
|
537
|
+
if (
|
|
538
|
+
message.includes("Please initialize git locally") ||
|
|
539
|
+
message.includes("Superblocks does not have a reference to") ||
|
|
540
|
+
message.includes("Branching is not enabled")
|
|
541
|
+
) {
|
|
542
|
+
throw new ValidateGitSetupError(message);
|
|
547
543
|
} else {
|
|
548
|
-
throw new Error(
|
|
544
|
+
throw new Error(message);
|
|
549
545
|
}
|
|
550
546
|
}
|
|
551
547
|
}
|