playcademy 0.14.18 → 0.14.19
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/db.js +63 -20
- package/dist/index.js +86 -41
- package/dist/utils.js +64 -21
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/db.js
CHANGED
|
@@ -2043,7 +2043,7 @@ import {
|
|
|
2043
2043
|
gray,
|
|
2044
2044
|
green,
|
|
2045
2045
|
greenBright,
|
|
2046
|
-
red
|
|
2046
|
+
red,
|
|
2047
2047
|
yellow,
|
|
2048
2048
|
yellowBright
|
|
2049
2049
|
} from "colorette";
|
|
@@ -2636,34 +2636,77 @@ var eraseLine = ESC + "2K";
|
|
|
2636
2636
|
import colors3 from "yoctocolors-cjs";
|
|
2637
2637
|
|
|
2638
2638
|
// src/lib/core/error.ts
|
|
2639
|
-
import { bold as bold2, dim as dim2,
|
|
2639
|
+
import { bold as bold2, dim as dim2, redBright } from "colorette";
|
|
2640
2640
|
import { ApiError, extractApiErrorInfo } from "@playcademy/sdk";
|
|
2641
2641
|
function isConfigError(error) {
|
|
2642
2642
|
return error !== null && typeof error === "object" && "name" in error && error.name === "ConfigError" && "message" in error;
|
|
2643
2643
|
}
|
|
2644
|
+
function extractEmbeddedJson(message) {
|
|
2645
|
+
const jsonMatch = message.match(/(\{.+\})$/);
|
|
2646
|
+
if (!jsonMatch) {
|
|
2647
|
+
return { cleanMessage: message };
|
|
2648
|
+
}
|
|
2649
|
+
try {
|
|
2650
|
+
const json = JSON.parse(jsonMatch[1]);
|
|
2651
|
+
const cleanMessage = message.slice(0, jsonMatch.index).trim();
|
|
2652
|
+
return { cleanMessage, json };
|
|
2653
|
+
} catch {
|
|
2654
|
+
return { cleanMessage: message };
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
function cleanMessageSuffix(message) {
|
|
2658
|
+
let cleaned = message.replace(/:\s*\d{3}\s*$/, "").trim();
|
|
2659
|
+
if (cleaned.endsWith(":")) {
|
|
2660
|
+
cleaned = cleaned.slice(0, -1).trim();
|
|
2661
|
+
}
|
|
2662
|
+
return cleaned;
|
|
2663
|
+
}
|
|
2664
|
+
function removeStatusPrefix(message, statusCode) {
|
|
2665
|
+
if (message.startsWith(`${statusCode} `)) {
|
|
2666
|
+
return message.slice(`${statusCode} `.length);
|
|
2667
|
+
}
|
|
2668
|
+
return message;
|
|
2669
|
+
}
|
|
2644
2670
|
function displayApiError(error, indent) {
|
|
2645
2671
|
const spaces = " ".repeat(indent);
|
|
2646
2672
|
const errorInfo = extractApiErrorInfo(error);
|
|
2647
|
-
if (errorInfo) {
|
|
2648
|
-
console.error(`${spaces}${
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
} else if (errorInfo.error) {
|
|
2653
|
-
console.error(`${spaces} ${errorInfo.error}`);
|
|
2673
|
+
if (!errorInfo) {
|
|
2674
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(error.message)}`);
|
|
2675
|
+
if (process.env.DEBUG && error.details) {
|
|
2676
|
+
console.error("");
|
|
2677
|
+
logger.json(error.details, indent + 1);
|
|
2654
2678
|
}
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2679
|
+
return;
|
|
2680
|
+
}
|
|
2681
|
+
const statusCode = errorInfo.status;
|
|
2682
|
+
let displayMessage = errorInfo.statusText;
|
|
2683
|
+
displayMessage = removeStatusPrefix(displayMessage, statusCode);
|
|
2684
|
+
const { cleanMessage, json: embeddedJson } = extractEmbeddedJson(displayMessage);
|
|
2685
|
+
displayMessage = cleanMessageSuffix(cleanMessage);
|
|
2686
|
+
let errorCode;
|
|
2687
|
+
if (error.details && typeof error.details === "object") {
|
|
2688
|
+
const details = error.details;
|
|
2689
|
+
if ("code" in details && typeof details.code === "string") {
|
|
2690
|
+
errorCode = details.code;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
let errorHeader = "API Error";
|
|
2694
|
+
if (errorCode) {
|
|
2695
|
+
errorHeader += ` ${redBright(`[${errorCode}]`)}`;
|
|
2696
|
+
}
|
|
2697
|
+
errorHeader += `: ${displayMessage} ${redBright(`[${statusCode}]`)}`;
|
|
2698
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(errorHeader)}`);
|
|
2699
|
+
if (process.env.DEBUG) {
|
|
2700
|
+
const detailsToShow = embeddedJson || error.details || errorInfo.details;
|
|
2701
|
+
if (detailsToShow) {
|
|
2702
|
+
console.error("");
|
|
2703
|
+
logger.json(detailsToShow, indent + 1);
|
|
2659
2704
|
}
|
|
2660
|
-
} else {
|
|
2661
|
-
console.error(`${spaces}${red("\u2716")} ${bold2(error.message)}`);
|
|
2662
2705
|
}
|
|
2663
2706
|
}
|
|
2664
2707
|
function displayConfigError(error, indent) {
|
|
2665
2708
|
const spaces = " ".repeat(indent);
|
|
2666
|
-
console.error(`${spaces}${
|
|
2709
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(error.message)}`);
|
|
2667
2710
|
if (error.field) {
|
|
2668
2711
|
console.error(`${spaces} ${dim2("Field:")} ${error.field}`);
|
|
2669
2712
|
}
|
|
@@ -2673,7 +2716,7 @@ function displayConfigError(error, indent) {
|
|
|
2673
2716
|
}
|
|
2674
2717
|
function displayGenericError(error, indent) {
|
|
2675
2718
|
const spaces = " ".repeat(indent);
|
|
2676
|
-
console.error(`${spaces}${
|
|
2719
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(error.message)}`);
|
|
2677
2720
|
if (error.stack && process.env.DEBUG) {
|
|
2678
2721
|
console.error(`${spaces} ${dim2("Stack:")}`);
|
|
2679
2722
|
console.error(
|
|
@@ -2695,7 +2738,7 @@ function formatError(error, indent = 0) {
|
|
|
2695
2738
|
displayGenericError(error, indent);
|
|
2696
2739
|
return;
|
|
2697
2740
|
}
|
|
2698
|
-
console.error(`${spaces}${
|
|
2741
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(String(error))}`);
|
|
2699
2742
|
}
|
|
2700
2743
|
|
|
2701
2744
|
// src/lib/core/logger.ts
|
|
@@ -2790,7 +2833,7 @@ var logger = {
|
|
|
2790
2833
|
*/
|
|
2791
2834
|
error: (message, indent = 0) => {
|
|
2792
2835
|
const spaces = " ".repeat(indent);
|
|
2793
|
-
console.error(`${spaces}${
|
|
2836
|
+
console.error(`${spaces}${red("\u2716")} ${customTransform(message)}`);
|
|
2794
2837
|
},
|
|
2795
2838
|
bold: (message, indent = 0) => {
|
|
2796
2839
|
const spaces = " ".repeat(indent);
|
|
@@ -2858,7 +2901,7 @@ var logger = {
|
|
|
2858
2901
|
const oldSize = formatSize(previousSize);
|
|
2859
2902
|
const newSize = formatSize(currentSize);
|
|
2860
2903
|
const delta = dim3(`(${formatDelta(currentSize - previousSize)})`);
|
|
2861
|
-
const value = `${
|
|
2904
|
+
const value = `${red(oldSize)} \u2192 ${green(newSize)} ${delta}`;
|
|
2862
2905
|
console.log(`${spaces}${dim3(label + ":")} ${bold3(value)}`);
|
|
2863
2906
|
},
|
|
2864
2907
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3390,34 +3390,77 @@ var init_esm3 = __esm({
|
|
|
3390
3390
|
});
|
|
3391
3391
|
|
|
3392
3392
|
// src/lib/core/error.ts
|
|
3393
|
-
import { bold as bold2, dim as dim2,
|
|
3393
|
+
import { bold as bold2, dim as dim2, redBright } from "colorette";
|
|
3394
3394
|
import { ApiError, extractApiErrorInfo } from "@playcademy/sdk";
|
|
3395
3395
|
function isConfigError(error) {
|
|
3396
3396
|
return error !== null && typeof error === "object" && "name" in error && error.name === "ConfigError" && "message" in error;
|
|
3397
3397
|
}
|
|
3398
|
+
function extractEmbeddedJson(message) {
|
|
3399
|
+
const jsonMatch = message.match(/(\{.+\})$/);
|
|
3400
|
+
if (!jsonMatch) {
|
|
3401
|
+
return { cleanMessage: message };
|
|
3402
|
+
}
|
|
3403
|
+
try {
|
|
3404
|
+
const json = JSON.parse(jsonMatch[1]);
|
|
3405
|
+
const cleanMessage = message.slice(0, jsonMatch.index).trim();
|
|
3406
|
+
return { cleanMessage, json };
|
|
3407
|
+
} catch {
|
|
3408
|
+
return { cleanMessage: message };
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
function cleanMessageSuffix(message) {
|
|
3412
|
+
let cleaned = message.replace(/:\s*\d{3}\s*$/, "").trim();
|
|
3413
|
+
if (cleaned.endsWith(":")) {
|
|
3414
|
+
cleaned = cleaned.slice(0, -1).trim();
|
|
3415
|
+
}
|
|
3416
|
+
return cleaned;
|
|
3417
|
+
}
|
|
3418
|
+
function removeStatusPrefix(message, statusCode) {
|
|
3419
|
+
if (message.startsWith(`${statusCode} `)) {
|
|
3420
|
+
return message.slice(`${statusCode} `.length);
|
|
3421
|
+
}
|
|
3422
|
+
return message;
|
|
3423
|
+
}
|
|
3398
3424
|
function displayApiError(error, indent) {
|
|
3399
3425
|
const spaces = " ".repeat(indent);
|
|
3400
3426
|
const errorInfo = extractApiErrorInfo(error);
|
|
3401
|
-
if (errorInfo) {
|
|
3402
|
-
console.error(`${spaces}${
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
}
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3427
|
+
if (!errorInfo) {
|
|
3428
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(error.message)}`);
|
|
3429
|
+
if (process.env.DEBUG && error.details) {
|
|
3430
|
+
console.error("");
|
|
3431
|
+
logger.json(error.details, indent + 1);
|
|
3432
|
+
}
|
|
3433
|
+
return;
|
|
3434
|
+
}
|
|
3435
|
+
const statusCode = errorInfo.status;
|
|
3436
|
+
let displayMessage = errorInfo.statusText;
|
|
3437
|
+
displayMessage = removeStatusPrefix(displayMessage, statusCode);
|
|
3438
|
+
const { cleanMessage, json: embeddedJson } = extractEmbeddedJson(displayMessage);
|
|
3439
|
+
displayMessage = cleanMessageSuffix(cleanMessage);
|
|
3440
|
+
let errorCode;
|
|
3441
|
+
if (error.details && typeof error.details === "object") {
|
|
3442
|
+
const details = error.details;
|
|
3443
|
+
if ("code" in details && typeof details.code === "string") {
|
|
3444
|
+
errorCode = details.code;
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
let errorHeader = "API Error";
|
|
3448
|
+
if (errorCode) {
|
|
3449
|
+
errorHeader += ` ${redBright(`[${errorCode}]`)}`;
|
|
3450
|
+
}
|
|
3451
|
+
errorHeader += `: ${displayMessage} ${redBright(`[${statusCode}]`)}`;
|
|
3452
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(errorHeader)}`);
|
|
3453
|
+
if (process.env.DEBUG) {
|
|
3454
|
+
const detailsToShow = embeddedJson || error.details || errorInfo.details;
|
|
3455
|
+
if (detailsToShow) {
|
|
3456
|
+
console.error("");
|
|
3457
|
+
logger.json(detailsToShow, indent + 1);
|
|
3413
3458
|
}
|
|
3414
|
-
} else {
|
|
3415
|
-
console.error(`${spaces}${red("\u2716")} ${bold2(error.message)}`);
|
|
3416
3459
|
}
|
|
3417
3460
|
}
|
|
3418
3461
|
function displayConfigError(error, indent) {
|
|
3419
3462
|
const spaces = " ".repeat(indent);
|
|
3420
|
-
console.error(`${spaces}${
|
|
3463
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(error.message)}`);
|
|
3421
3464
|
if (error.field) {
|
|
3422
3465
|
console.error(`${spaces} ${dim2("Field:")} ${error.field}`);
|
|
3423
3466
|
}
|
|
@@ -3427,7 +3470,7 @@ function displayConfigError(error, indent) {
|
|
|
3427
3470
|
}
|
|
3428
3471
|
function displayGenericError(error, indent) {
|
|
3429
3472
|
const spaces = " ".repeat(indent);
|
|
3430
|
-
console.error(`${spaces}${
|
|
3473
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(error.message)}`);
|
|
3431
3474
|
if (error.stack && process.env.DEBUG) {
|
|
3432
3475
|
console.error(`${spaces} ${dim2("Stack:")}`);
|
|
3433
3476
|
console.error(
|
|
@@ -3449,7 +3492,7 @@ function formatError(error, indent = 0) {
|
|
|
3449
3492
|
displayGenericError(error, indent);
|
|
3450
3493
|
return;
|
|
3451
3494
|
}
|
|
3452
|
-
console.error(`${spaces}${
|
|
3495
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold2(String(error))}`);
|
|
3453
3496
|
}
|
|
3454
3497
|
function setupGlobalErrorHandlers() {
|
|
3455
3498
|
let sigintReceived = false;
|
|
@@ -3481,6 +3524,7 @@ var init_error = __esm({
|
|
|
3481
3524
|
"src/lib/core/error.ts"() {
|
|
3482
3525
|
"use strict";
|
|
3483
3526
|
init_esm3();
|
|
3527
|
+
init_logger();
|
|
3484
3528
|
}
|
|
3485
3529
|
});
|
|
3486
3530
|
|
|
@@ -3494,7 +3538,7 @@ import {
|
|
|
3494
3538
|
gray,
|
|
3495
3539
|
green,
|
|
3496
3540
|
greenBright,
|
|
3497
|
-
red
|
|
3541
|
+
red,
|
|
3498
3542
|
yellow,
|
|
3499
3543
|
yellowBright
|
|
3500
3544
|
} from "colorette";
|
|
@@ -3595,7 +3639,7 @@ var init_logger = __esm({
|
|
|
3595
3639
|
*/
|
|
3596
3640
|
error: (message, indent = 0) => {
|
|
3597
3641
|
const spaces = " ".repeat(indent);
|
|
3598
|
-
console.error(`${spaces}${
|
|
3642
|
+
console.error(`${spaces}${red("\u2716")} ${customTransform(message)}`);
|
|
3599
3643
|
},
|
|
3600
3644
|
bold: (message, indent = 0) => {
|
|
3601
3645
|
const spaces = " ".repeat(indent);
|
|
@@ -3663,7 +3707,7 @@ var init_logger = __esm({
|
|
|
3663
3707
|
const oldSize = formatSize2(previousSize);
|
|
3664
3708
|
const newSize = formatSize2(currentSize);
|
|
3665
3709
|
const delta = dim3(`(${formatDelta2(currentSize - previousSize)})`);
|
|
3666
|
-
const value = `${
|
|
3710
|
+
const value = `${red(oldSize)} \u2192 ${green(newSize)} ${delta}`;
|
|
3667
3711
|
console.log(`${spaces}${dim3(label + ":")} ${bold3(value)}`);
|
|
3668
3712
|
},
|
|
3669
3713
|
/**
|
|
@@ -6465,7 +6509,7 @@ async function loadDeployConfig(configPath) {
|
|
|
6465
6509
|
// src/lib/deploy/diff.ts
|
|
6466
6510
|
init_string();
|
|
6467
6511
|
init_logger();
|
|
6468
|
-
import { dim as dim5, green as green2, red as
|
|
6512
|
+
import { dim as dim5, green as green2, red as red2 } from "colorette";
|
|
6469
6513
|
|
|
6470
6514
|
// src/lib/integrations/timeback.ts
|
|
6471
6515
|
init_src();
|
|
@@ -6672,19 +6716,19 @@ function displayDeploymentDiff(options) {
|
|
|
6672
6716
|
if (hasConfigChanges) {
|
|
6673
6717
|
logger.bold("Config", 1);
|
|
6674
6718
|
if (diff.displayName) {
|
|
6675
|
-
const value = `${
|
|
6719
|
+
const value = `${red2(diff.displayName.old)} \u2192 ${green2(diff.displayName.new)}`;
|
|
6676
6720
|
logger.data("Name", value, 2);
|
|
6677
6721
|
}
|
|
6678
6722
|
if (diff.emoji) {
|
|
6679
6723
|
const oldEmoji = diff.emoji.old || "(none)";
|
|
6680
6724
|
const newEmoji = diff.emoji.new || "(none)";
|
|
6681
|
-
const value = `${
|
|
6725
|
+
const value = `${red2(oldEmoji)} \u2192 ${green2(newEmoji)}`;
|
|
6682
6726
|
logger.data("Emoji", value, 2);
|
|
6683
6727
|
}
|
|
6684
6728
|
if (diff.description) {
|
|
6685
6729
|
const oldDesc = diff.description.old || "(none)";
|
|
6686
6730
|
const newDesc = diff.description.new || "(none)";
|
|
6687
|
-
const value = `${
|
|
6731
|
+
const value = `${red2(oldDesc)} \u2192 ${green2(newDesc)}`;
|
|
6688
6732
|
logger.data("Description", value, 2);
|
|
6689
6733
|
}
|
|
6690
6734
|
logger.newLine();
|
|
@@ -6718,7 +6762,7 @@ function displayDeploymentDiff(options) {
|
|
|
6718
6762
|
parts.push(...backend.addedRoutes.map((r) => green2(`+${r}`)));
|
|
6719
6763
|
}
|
|
6720
6764
|
if (backend?.removedRoutes && backend.removedRoutes.length > 0) {
|
|
6721
|
-
parts.push(...backend.removedRoutes.map((r) =>
|
|
6765
|
+
parts.push(...backend.removedRoutes.map((r) => red2(`-${r}`)));
|
|
6722
6766
|
}
|
|
6723
6767
|
if (hasServerSizeChange) {
|
|
6724
6768
|
const delta = formatDelta(
|
|
@@ -6780,7 +6824,7 @@ function displayDeploymentDiff(options) {
|
|
|
6780
6824
|
if (r === "bucket") return "Bucket";
|
|
6781
6825
|
return r;
|
|
6782
6826
|
});
|
|
6783
|
-
parts.push(...formatted.map((r) =>
|
|
6827
|
+
parts.push(...formatted.map((r) => red2(`-${r}`)));
|
|
6784
6828
|
}
|
|
6785
6829
|
logger.data("Resources", parts.join(" "), 2);
|
|
6786
6830
|
}
|
|
@@ -6804,7 +6848,7 @@ function displayDeploymentDiff(options) {
|
|
|
6804
6848
|
for (const integration of metadata) {
|
|
6805
6849
|
logger.bold(integration.name, 1);
|
|
6806
6850
|
for (const change of integration.changes) {
|
|
6807
|
-
const value = `${
|
|
6851
|
+
const value = `${red2(change.current)} \u2192 ${green2(change.next)}`;
|
|
6808
6852
|
logger.data(change.label, value, 2);
|
|
6809
6853
|
}
|
|
6810
6854
|
logger.newLine();
|
|
@@ -6821,7 +6865,7 @@ function displayDeploymentDiff(options) {
|
|
|
6821
6865
|
logger.data("Added", addedList, 2);
|
|
6822
6866
|
}
|
|
6823
6867
|
if (comparison.removed.length > 0) {
|
|
6824
|
-
const removedList = comparison.removed.map((k) =>
|
|
6868
|
+
const removedList = comparison.removed.map((k) => red2(k)).join(", ");
|
|
6825
6869
|
logger.data("Removed", removedList, 2);
|
|
6826
6870
|
}
|
|
6827
6871
|
logger.newLine();
|
|
@@ -6840,7 +6884,7 @@ function displayDeploymentDiff(options) {
|
|
|
6840
6884
|
logger.data("Added", addedList, 2);
|
|
6841
6885
|
}
|
|
6842
6886
|
if (removed.length > 0) {
|
|
6843
|
-
const removedList = removed.map((k) =>
|
|
6887
|
+
const removedList = removed.map((k) => red2(k)).join(", ");
|
|
6844
6888
|
logger.data("Removed", removedList, 2);
|
|
6845
6889
|
}
|
|
6846
6890
|
logger.newLine();
|
|
@@ -7230,7 +7274,7 @@ import { join as join18 } from "path";
|
|
|
7230
7274
|
// package.json
|
|
7231
7275
|
var package_default2 = {
|
|
7232
7276
|
name: "playcademy",
|
|
7233
|
-
version: "0.14.
|
|
7277
|
+
version: "0.14.18",
|
|
7234
7278
|
type: "module",
|
|
7235
7279
|
exports: {
|
|
7236
7280
|
".": {
|
|
@@ -9517,9 +9561,10 @@ async function bundleStubWorker() {
|
|
|
9517
9561
|
|
|
9518
9562
|
// src/lib/deploy/utils.ts
|
|
9519
9563
|
init_src2();
|
|
9564
|
+
init_config2();
|
|
9520
9565
|
function getDeploymentId(gameSlug) {
|
|
9521
|
-
const
|
|
9522
|
-
return
|
|
9566
|
+
const environment = getEnvironment();
|
|
9567
|
+
return environment === "production" ? gameSlug : `${WORKER_NAMING.STAGING_PREFIX}${gameSlug}`;
|
|
9523
9568
|
}
|
|
9524
9569
|
|
|
9525
9570
|
// src/lib/deploy/steps.ts
|
|
@@ -10204,7 +10249,7 @@ async function writeBackendServerInfo(port) {
|
|
|
10204
10249
|
|
|
10205
10250
|
// src/lib/domains/display.ts
|
|
10206
10251
|
init_logger();
|
|
10207
|
-
import { cyanBright, gray as gray2, greenBright as greenBright2, redBright, yellowBright as yellowBright2 } from "colorette";
|
|
10252
|
+
import { cyanBright, gray as gray2, greenBright as greenBright2, redBright as redBright2, yellowBright as yellowBright2 } from "colorette";
|
|
10208
10253
|
function colorizeStatus(status) {
|
|
10209
10254
|
switch (status) {
|
|
10210
10255
|
case "active":
|
|
@@ -10219,7 +10264,7 @@ function colorizeStatus(status) {
|
|
|
10219
10264
|
case "deleted":
|
|
10220
10265
|
case "blocked":
|
|
10221
10266
|
case "pending_deletion":
|
|
10222
|
-
return
|
|
10267
|
+
return redBright2(status);
|
|
10223
10268
|
default:
|
|
10224
10269
|
return gray2(status);
|
|
10225
10270
|
}
|
|
@@ -11766,7 +11811,7 @@ init_src();
|
|
|
11766
11811
|
import { existsSync as existsSync23 } from "fs";
|
|
11767
11812
|
import { join as join33 } from "path";
|
|
11768
11813
|
import { confirm as confirm8, input as input7 } from "@inquirer/prompts";
|
|
11769
|
-
import { bold as bold8, redBright as
|
|
11814
|
+
import { bold as bold8, redBright as redBright3, underline as underline3 } from "colorette";
|
|
11770
11815
|
import { Miniflare as Miniflare2 } from "miniflare";
|
|
11771
11816
|
init_constants2();
|
|
11772
11817
|
async function runDbResetRemote(options) {
|
|
@@ -11785,7 +11830,7 @@ async function runDbResetRemote(options) {
|
|
|
11785
11830
|
const game = await client.games.fetch(deployedGame.gameId);
|
|
11786
11831
|
logger.newLine();
|
|
11787
11832
|
logger.admonition("warning", "DESTRUCTIVE OPERATION", [
|
|
11788
|
-
`Are you sure you want to ${
|
|
11833
|
+
`Are you sure you want to ${redBright3(underline3(bold8("DELETE ALL DATA")))} in your ${environment} database?`,
|
|
11789
11834
|
`All tables will be dropped and recreated from schema.`,
|
|
11790
11835
|
`This action is irreversible and ${underline3(bold8("cannot be undone"))}.`
|
|
11791
11836
|
]);
|
|
@@ -11910,7 +11955,7 @@ init_constants2();
|
|
|
11910
11955
|
import { existsSync as existsSync24 } from "fs";
|
|
11911
11956
|
import { join as join34 } from "path";
|
|
11912
11957
|
import { confirm as confirm9, input as input8 } from "@inquirer/prompts";
|
|
11913
|
-
import { bold as bold9, redBright as
|
|
11958
|
+
import { bold as bold9, redBright as redBright4, underline as underline4 } from "colorette";
|
|
11914
11959
|
import { Miniflare as Miniflare3 } from "miniflare";
|
|
11915
11960
|
async function runDbResetRemote2(gameSlug, environment) {
|
|
11916
11961
|
const client = await requireAuthenticatedClient();
|
|
@@ -11954,7 +11999,7 @@ async function runDbSeedRemote(seedFile, options) {
|
|
|
11954
11999
|
logger.newLine();
|
|
11955
12000
|
if (willReset) {
|
|
11956
12001
|
logger.admonition("warning", "Remote Database Seeding", [
|
|
11957
|
-
`Are you sure you want to ${
|
|
12002
|
+
`Are you sure you want to ${redBright4(underline4(bold9("DELETE ALL DATA")))} in your ${environment} database?`,
|
|
11958
12003
|
`This action is irreversible and ${underline4(bold9("cannot be undone"))}.`,
|
|
11959
12004
|
`Run this command with \`--no-reset\` if you want to seed without resetting.`
|
|
11960
12005
|
]);
|
|
@@ -14691,7 +14736,7 @@ var setupCommand = new Command32("setup").description("Set up TimeBack integrati
|
|
|
14691
14736
|
init_src();
|
|
14692
14737
|
init_string();
|
|
14693
14738
|
import { confirm as confirm17 } from "@inquirer/prompts";
|
|
14694
|
-
import { green as green4, red as
|
|
14739
|
+
import { green as green4, red as red3 } from "colorette";
|
|
14695
14740
|
import { Command as Command33 } from "commander";
|
|
14696
14741
|
var updateCommand = new Command33("update").description("Update TimeBack integration configuration for your game").option("--verbose, -v", "Output detailed information").option(
|
|
14697
14742
|
"--env <environment>",
|
|
@@ -14768,7 +14813,7 @@ var updateCommand = new Command33("update").description("Update TimeBack integra
|
|
|
14768
14813
|
logger.newLine();
|
|
14769
14814
|
logger.highlight("Changes Detected");
|
|
14770
14815
|
for (const change of changeDetails) {
|
|
14771
|
-
logger.data(change.label, `${
|
|
14816
|
+
logger.data(change.label, `${red3(change.current)} \u2192 ${green4(change.next)}`, 1);
|
|
14772
14817
|
}
|
|
14773
14818
|
logger.newLine();
|
|
14774
14819
|
const confirmed = await confirm17({
|
package/dist/utils.js
CHANGED
|
@@ -1955,7 +1955,7 @@ import {
|
|
|
1955
1955
|
gray,
|
|
1956
1956
|
green,
|
|
1957
1957
|
greenBright,
|
|
1958
|
-
red
|
|
1958
|
+
red,
|
|
1959
1959
|
yellow,
|
|
1960
1960
|
yellowBright
|
|
1961
1961
|
} from "colorette";
|
|
@@ -2548,34 +2548,77 @@ var eraseLine = ESC + "2K";
|
|
|
2548
2548
|
import colors2 from "yoctocolors-cjs";
|
|
2549
2549
|
|
|
2550
2550
|
// src/lib/core/error.ts
|
|
2551
|
-
import { bold, dim,
|
|
2551
|
+
import { bold, dim, redBright } from "colorette";
|
|
2552
2552
|
import { ApiError, extractApiErrorInfo } from "@playcademy/sdk";
|
|
2553
2553
|
function isConfigError(error) {
|
|
2554
2554
|
return error !== null && typeof error === "object" && "name" in error && error.name === "ConfigError" && "message" in error;
|
|
2555
2555
|
}
|
|
2556
|
+
function extractEmbeddedJson(message) {
|
|
2557
|
+
const jsonMatch = message.match(/(\{.+\})$/);
|
|
2558
|
+
if (!jsonMatch) {
|
|
2559
|
+
return { cleanMessage: message };
|
|
2560
|
+
}
|
|
2561
|
+
try {
|
|
2562
|
+
const json = JSON.parse(jsonMatch[1]);
|
|
2563
|
+
const cleanMessage = message.slice(0, jsonMatch.index).trim();
|
|
2564
|
+
return { cleanMessage, json };
|
|
2565
|
+
} catch {
|
|
2566
|
+
return { cleanMessage: message };
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
function cleanMessageSuffix(message) {
|
|
2570
|
+
let cleaned = message.replace(/:\s*\d{3}\s*$/, "").trim();
|
|
2571
|
+
if (cleaned.endsWith(":")) {
|
|
2572
|
+
cleaned = cleaned.slice(0, -1).trim();
|
|
2573
|
+
}
|
|
2574
|
+
return cleaned;
|
|
2575
|
+
}
|
|
2576
|
+
function removeStatusPrefix(message, statusCode) {
|
|
2577
|
+
if (message.startsWith(`${statusCode} `)) {
|
|
2578
|
+
return message.slice(`${statusCode} `.length);
|
|
2579
|
+
}
|
|
2580
|
+
return message;
|
|
2581
|
+
}
|
|
2556
2582
|
function displayApiError(error, indent) {
|
|
2557
2583
|
const spaces = " ".repeat(indent);
|
|
2558
2584
|
const errorInfo = extractApiErrorInfo(error);
|
|
2559
|
-
if (errorInfo) {
|
|
2560
|
-
console.error(`${spaces}${
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
} else if (errorInfo.error) {
|
|
2565
|
-
console.error(`${spaces} ${errorInfo.error}`);
|
|
2585
|
+
if (!errorInfo) {
|
|
2586
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold(error.message)}`);
|
|
2587
|
+
if (process.env.DEBUG && error.details) {
|
|
2588
|
+
console.error("");
|
|
2589
|
+
logger.json(error.details, indent + 1);
|
|
2566
2590
|
}
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
const statusCode = errorInfo.status;
|
|
2594
|
+
let displayMessage = errorInfo.statusText;
|
|
2595
|
+
displayMessage = removeStatusPrefix(displayMessage, statusCode);
|
|
2596
|
+
const { cleanMessage, json: embeddedJson } = extractEmbeddedJson(displayMessage);
|
|
2597
|
+
displayMessage = cleanMessageSuffix(cleanMessage);
|
|
2598
|
+
let errorCode;
|
|
2599
|
+
if (error.details && typeof error.details === "object") {
|
|
2600
|
+
const details = error.details;
|
|
2601
|
+
if ("code" in details && typeof details.code === "string") {
|
|
2602
|
+
errorCode = details.code;
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
let errorHeader = "API Error";
|
|
2606
|
+
if (errorCode) {
|
|
2607
|
+
errorHeader += ` ${redBright(`[${errorCode}]`)}`;
|
|
2608
|
+
}
|
|
2609
|
+
errorHeader += `: ${displayMessage} ${redBright(`[${statusCode}]`)}`;
|
|
2610
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold(errorHeader)}`);
|
|
2611
|
+
if (process.env.DEBUG) {
|
|
2612
|
+
const detailsToShow = embeddedJson || error.details || errorInfo.details;
|
|
2613
|
+
if (detailsToShow) {
|
|
2614
|
+
console.error("");
|
|
2615
|
+
logger.json(detailsToShow, indent + 1);
|
|
2571
2616
|
}
|
|
2572
|
-
} else {
|
|
2573
|
-
console.error(`${spaces}${red("\u2716")} ${bold(error.message)}`);
|
|
2574
2617
|
}
|
|
2575
2618
|
}
|
|
2576
2619
|
function displayConfigError(error, indent) {
|
|
2577
2620
|
const spaces = " ".repeat(indent);
|
|
2578
|
-
console.error(`${spaces}${
|
|
2621
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold(error.message)}`);
|
|
2579
2622
|
if (error.field) {
|
|
2580
2623
|
console.error(`${spaces} ${dim("Field:")} ${error.field}`);
|
|
2581
2624
|
}
|
|
@@ -2585,7 +2628,7 @@ function displayConfigError(error, indent) {
|
|
|
2585
2628
|
}
|
|
2586
2629
|
function displayGenericError(error, indent) {
|
|
2587
2630
|
const spaces = " ".repeat(indent);
|
|
2588
|
-
console.error(`${spaces}${
|
|
2631
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold(error.message)}`);
|
|
2589
2632
|
if (error.stack && process.env.DEBUG) {
|
|
2590
2633
|
console.error(`${spaces} ${dim("Stack:")}`);
|
|
2591
2634
|
console.error(
|
|
@@ -2607,7 +2650,7 @@ function formatError(error, indent = 0) {
|
|
|
2607
2650
|
displayGenericError(error, indent);
|
|
2608
2651
|
return;
|
|
2609
2652
|
}
|
|
2610
|
-
console.error(`${spaces}${
|
|
2653
|
+
console.error(`${spaces}${redBright("\u2716")} ${bold(String(error))}`);
|
|
2611
2654
|
}
|
|
2612
2655
|
|
|
2613
2656
|
// src/lib/core/logger.ts
|
|
@@ -2702,7 +2745,7 @@ var logger = {
|
|
|
2702
2745
|
*/
|
|
2703
2746
|
error: (message, indent = 0) => {
|
|
2704
2747
|
const spaces = " ".repeat(indent);
|
|
2705
|
-
console.error(`${spaces}${
|
|
2748
|
+
console.error(`${spaces}${red("\u2716")} ${customTransform(message)}`);
|
|
2706
2749
|
},
|
|
2707
2750
|
bold: (message, indent = 0) => {
|
|
2708
2751
|
const spaces = " ".repeat(indent);
|
|
@@ -2770,7 +2813,7 @@ var logger = {
|
|
|
2770
2813
|
const oldSize = formatSize(previousSize);
|
|
2771
2814
|
const newSize = formatSize(currentSize);
|
|
2772
2815
|
const delta = dim2(`(${formatDelta(currentSize - previousSize)})`);
|
|
2773
|
-
const value = `${
|
|
2816
|
+
const value = `${red(oldSize)} \u2192 ${green(newSize)} ${delta}`;
|
|
2774
2817
|
console.log(`${spaces}${dim2(label + ":")} ${bold2(value)}`);
|
|
2775
2818
|
},
|
|
2776
2819
|
/**
|
|
@@ -3870,7 +3913,7 @@ import { join as join11 } from "path";
|
|
|
3870
3913
|
// package.json
|
|
3871
3914
|
var package_default2 = {
|
|
3872
3915
|
name: "playcademy",
|
|
3873
|
-
version: "0.14.
|
|
3916
|
+
version: "0.14.18",
|
|
3874
3917
|
type: "module",
|
|
3875
3918
|
exports: {
|
|
3876
3919
|
".": {
|
package/dist/version.js
CHANGED