@superblocksteam/cli 2.0.0-next.27 → 2.0.0-next.29
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/README.md +1 -1
- package/dist/index.js +217 -207
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -94772,11 +94772,11 @@ var require_file_uploader = __commonJS({
|
|
|
94772
94772
|
exports2.getBucketeerUrlFromSuperblocksUrl = exports2.COMPONENT_EVENT_HEADER = void 0;
|
|
94773
94773
|
var lodash_1 = require_lodash();
|
|
94774
94774
|
exports2.COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
|
|
94775
|
-
var getBucketeerUrlFromSuperblocksUrl2 = (
|
|
94776
|
-
if (!(0, lodash_1.isEmpty)(
|
|
94775
|
+
var getBucketeerUrlFromSuperblocksUrl2 = (superblocksBaseUrl2) => {
|
|
94776
|
+
if (!(0, lodash_1.isEmpty)(superblocksBaseUrl2.match(new RegExp("pr-.*.superblocks.dev")))) {
|
|
94777
94777
|
return "https://bucketeer.dev.superblocks.com";
|
|
94778
94778
|
}
|
|
94779
|
-
switch (
|
|
94779
|
+
switch (superblocksBaseUrl2) {
|
|
94780
94780
|
case "https://eu.superblocks.com":
|
|
94781
94781
|
return "https://bucketeer.eu.superblocks.com";
|
|
94782
94782
|
case "https://staging.superblocks.com":
|
|
@@ -94840,23 +94840,23 @@ var require_login = __commonJS({
|
|
|
94840
94840
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
94841
94841
|
exports2.saveApiToken = saveApiToken3;
|
|
94842
94842
|
exports2.getLocalTokenWithUrlIfExists = getLocalTokenWithUrlIfExists4;
|
|
94843
|
-
exports2.getLocalTokenWithUrl =
|
|
94843
|
+
exports2.getLocalTokenWithUrl = getLocalTokenWithUrl4;
|
|
94844
94844
|
var node_os_1 = __require("node:os");
|
|
94845
94845
|
var node_path_1 = __require("node:path");
|
|
94846
94846
|
var fs26 = __importStar(require_lib());
|
|
94847
94847
|
var constants_js_1 = require_constants7();
|
|
94848
|
-
async function saveApiToken3(
|
|
94848
|
+
async function saveApiToken3(superblocksBaseUrl2, token2) {
|
|
94849
94849
|
try {
|
|
94850
94850
|
await fs26.ensureDir((0, node_path_1.join)((0, node_os_1.homedir)(), ".superblocks"));
|
|
94851
94851
|
if (token2) {
|
|
94852
94852
|
const tokenConfig = {
|
|
94853
|
-
superblocksBaseUrl,
|
|
94853
|
+
superblocksBaseUrl: superblocksBaseUrl2,
|
|
94854
94854
|
token: token2
|
|
94855
94855
|
};
|
|
94856
94856
|
await fs26.writeJSON((0, node_path_1.join)((0, node_os_1.homedir)(), constants_js_1.TOKEN_CONFIG_PATH), tokenConfig);
|
|
94857
94857
|
} else {
|
|
94858
94858
|
const tokenConfig = {
|
|
94859
|
-
superblocksBaseUrl
|
|
94859
|
+
superblocksBaseUrl: superblocksBaseUrl2
|
|
94860
94860
|
};
|
|
94861
94861
|
await fs26.writeJSON((0, node_path_1.join)((0, node_os_1.homedir)(), constants_js_1.TOKEN_CONFIG_PATH), tokenConfig);
|
|
94862
94862
|
}
|
|
@@ -94866,12 +94866,12 @@ var require_login = __commonJS({
|
|
|
94866
94866
|
}
|
|
94867
94867
|
async function getLocalTokenWithUrlIfExists4() {
|
|
94868
94868
|
try {
|
|
94869
|
-
return await
|
|
94869
|
+
return await getLocalTokenWithUrl4();
|
|
94870
94870
|
} catch {
|
|
94871
94871
|
return void 0;
|
|
94872
94872
|
}
|
|
94873
94873
|
}
|
|
94874
|
-
async function
|
|
94874
|
+
async function getLocalTokenWithUrl4() {
|
|
94875
94875
|
try {
|
|
94876
94876
|
const tokenConfig = await fs26.readJSON(process.env.SUPERBLOCKS_AUTH_FILE || (0, node_path_1.join)((0, node_os_1.homedir)(), constants_js_1.TOKEN_CONFIG_PATH));
|
|
94877
94877
|
if (tokenConfig.token) {
|
|
@@ -257094,13 +257094,13 @@ function createRequestHandlers({ agentUrl, token: token2 }) {
|
|
|
257094
257094
|
}
|
|
257095
257095
|
|
|
257096
257096
|
// ../sdk/dist/socket/index.js
|
|
257097
|
-
async function connectToISocketRPCServer({ superblocksBaseUrl, agentUrl, token: token2 }) {
|
|
257097
|
+
async function connectToISocketRPCServer({ superblocksBaseUrl: superblocksBaseUrl2, agentUrl, token: token2 }) {
|
|
257098
257098
|
const requestHandlers = createRequestHandlers({
|
|
257099
257099
|
agentUrl,
|
|
257100
257100
|
token: token2
|
|
257101
257101
|
});
|
|
257102
257102
|
const authorization = `Bearer ${token2}`;
|
|
257103
|
-
const wsUrl = new URL("api/v1/rpc-ws",
|
|
257103
|
+
const wsUrl = new URL("api/v1/rpc-ws", superblocksBaseUrl2);
|
|
257104
257104
|
if (wsUrl.protocol === "http:") {
|
|
257105
257105
|
wsUrl.protocol = "ws:";
|
|
257106
257106
|
} else if (wsUrl.protocol === "https:") {
|
|
@@ -257164,17 +257164,17 @@ var ResourceType;
|
|
|
257164
257164
|
ResourceType2["APPLICATION"] = "APPLICATION";
|
|
257165
257165
|
ResourceType2["BACKEND"] = "BACKEND";
|
|
257166
257166
|
})(ResourceType || (ResourceType = {}));
|
|
257167
|
-
async function fetchApplication({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl, viewMode, commitId, skipSigningVerification = false, injectedHeaders = {} }) {
|
|
257167
|
+
async function fetchApplication({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl: superblocksBaseUrl2, viewMode, commitId, skipSigningVerification = false, injectedHeaders = {} }) {
|
|
257168
257168
|
if (commitId && viewMode !== import_shared2.ExportViewMode.EXPORT_COMMIT) {
|
|
257169
257169
|
throw new Error(`If commitId ${commitId} is provided, viewMode cannot be ${viewMode}`);
|
|
257170
257170
|
}
|
|
257171
257171
|
try {
|
|
257172
|
-
const serverURL = branch ? new URL(`${BASE_SERVER_PUBLIC_API_URL_v2}/applications/${applicationId}/branches/${encodeURIComponent(branch)}`,
|
|
257172
|
+
const serverURL = branch ? new URL(`${BASE_SERVER_PUBLIC_API_URL_v2}/applications/${applicationId}/branches/${encodeURIComponent(branch)}`, superblocksBaseUrl2) : new URL(`${BASE_SERVER_PUBLIC_API_URL_v2}/applications/${applicationId}`, superblocksBaseUrl2);
|
|
257173
257173
|
serverURL.search = new URLSearchParams({
|
|
257174
257174
|
viewMode,
|
|
257175
257175
|
...commitId ? { commitId } : {}
|
|
257176
257176
|
}).toString();
|
|
257177
|
-
const socket = !skipSigningVerification ? await createSocketConnectionIfNeeded(cliVersion, token2,
|
|
257177
|
+
const socket = !skipSigningVerification ? await createSocketConnectionIfNeeded(cliVersion, token2, superblocksBaseUrl2) : void 0;
|
|
257178
257178
|
if (socket) {
|
|
257179
257179
|
try {
|
|
257180
257180
|
const resp = await socket.call.v2.public.application.get({
|
|
@@ -257207,8 +257207,8 @@ async function fetchApplication({ cliVersion, applicationId, branch, token: toke
|
|
|
257207
257207
|
throw new Error(`Could not fetch application: ${typeof e === "object" && e && "message" in e ? e.message : e}`);
|
|
257208
257208
|
}
|
|
257209
257209
|
}
|
|
257210
|
-
async function fetchApplicationBranches({ cliVersion, applicationId, token: token2, superblocksBaseUrl, injectedHeaders = {} }) {
|
|
257211
|
-
const serverURL = new URL(`public/applications/${applicationId}/branches`,
|
|
257210
|
+
async function fetchApplicationBranches({ cliVersion, applicationId, token: token2, superblocksBaseUrl: superblocksBaseUrl2, injectedHeaders = {} }) {
|
|
257211
|
+
const serverURL = new URL(`public/applications/${applicationId}/branches`, superblocksBaseUrl2);
|
|
257212
257212
|
let serverResponse;
|
|
257213
257213
|
try {
|
|
257214
257214
|
const config2 = {
|
|
@@ -257229,13 +257229,13 @@ async function fetchApplicationBranches({ cliVersion, applicationId, token: toke
|
|
|
257229
257229
|
}
|
|
257230
257230
|
return serverResponse?.data?.data;
|
|
257231
257231
|
}
|
|
257232
|
-
async function fetchApplicationWithComponents({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl, viewMode, commitId, skipSigningVerification = false, injectedHeaders = {} }) {
|
|
257232
|
+
async function fetchApplicationWithComponents({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl: superblocksBaseUrl2, viewMode, commitId, skipSigningVerification = false, injectedHeaders = {} }) {
|
|
257233
257233
|
const applicationWrapper = await fetchApplication({
|
|
257234
257234
|
cliVersion,
|
|
257235
257235
|
applicationId,
|
|
257236
257236
|
branch,
|
|
257237
257237
|
token: token2,
|
|
257238
|
-
superblocksBaseUrl,
|
|
257238
|
+
superblocksBaseUrl: superblocksBaseUrl2,
|
|
257239
257239
|
viewMode,
|
|
257240
257240
|
commitId,
|
|
257241
257241
|
skipSigningVerification,
|
|
@@ -257252,7 +257252,7 @@ async function fetchApplicationWithComponents({ cliVersion, applicationId, branc
|
|
|
257252
257252
|
}
|
|
257253
257253
|
return await fetchApplicationWithComponentsFromBucketeer({
|
|
257254
257254
|
applicationWrapper,
|
|
257255
|
-
superblocksBaseUrl,
|
|
257255
|
+
superblocksBaseUrl: superblocksBaseUrl2,
|
|
257256
257256
|
applicationId,
|
|
257257
257257
|
branch,
|
|
257258
257258
|
commitId,
|
|
@@ -257261,7 +257261,7 @@ async function fetchApplicationWithComponents({ cliVersion, applicationId, branc
|
|
|
257261
257261
|
injectedHeaders
|
|
257262
257262
|
});
|
|
257263
257263
|
}
|
|
257264
|
-
async function fetchApplicationWithComponentsFromBucketeer({ applicationWrapper, superblocksBaseUrl, applicationId, branch, commitId, viewMode, token: token2, injectedHeaders }) {
|
|
257264
|
+
async function fetchApplicationWithComponentsFromBucketeer({ applicationWrapper, superblocksBaseUrl: superblocksBaseUrl2, applicationId, branch, commitId, viewMode, token: token2, injectedHeaders }) {
|
|
257265
257265
|
if (isEmpty_default(applicationWrapper.application?.settings?.registeredComponents)) {
|
|
257266
257266
|
return {
|
|
257267
257267
|
type: "multi-page",
|
|
@@ -257269,8 +257269,8 @@ async function fetchApplicationWithComponentsFromBucketeer({ applicationWrapper,
|
|
|
257269
257269
|
componentFiles: null
|
|
257270
257270
|
};
|
|
257271
257271
|
}
|
|
257272
|
-
|
|
257273
|
-
const bucketeerBaseUrl = (0, import_util4.getBucketeerUrlFromSuperblocksUrl)(
|
|
257272
|
+
superblocksBaseUrl2 = superblocksBaseUrl2.replace(/\/$/, "");
|
|
257273
|
+
const bucketeerBaseUrl = (0, import_util4.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl2);
|
|
257274
257274
|
const branchPath = branch ? `/branches/${encodeURIComponent(branch)}` : "";
|
|
257275
257275
|
const componentFileURL = new URL(`${BASE_BUCKETEER_URL}/v1/components/${applicationId}${branchPath}?commit=${commitId}&viewMode=${viewMode}&multiPage=true`, bucketeerBaseUrl).toString();
|
|
257276
257276
|
try {
|
|
@@ -257279,7 +257279,7 @@ async function fetchApplicationWithComponentsFromBucketeer({ applicationWrapper,
|
|
|
257279
257279
|
url: componentFileURL,
|
|
257280
257280
|
headers: {
|
|
257281
257281
|
Authorization: "Bearer " + token2,
|
|
257282
|
-
[SUPERBLOCKS_URL_HEADER]:
|
|
257282
|
+
[SUPERBLOCKS_URL_HEADER]: superblocksBaseUrl2,
|
|
257283
257283
|
...injectedHeaders
|
|
257284
257284
|
}
|
|
257285
257285
|
};
|
|
@@ -257295,11 +257295,11 @@ async function fetchApplicationWithComponentsFromBucketeer({ applicationWrapper,
|
|
|
257295
257295
|
throw new Error("Could not fetch application");
|
|
257296
257296
|
}
|
|
257297
257297
|
}
|
|
257298
|
-
async function fetchApplications(cliVersion, token2,
|
|
257298
|
+
async function fetchApplications(cliVersion, token2, superblocksBaseUrl2, injectedHeaders = {}) {
|
|
257299
257299
|
try {
|
|
257300
257300
|
const config2 = {
|
|
257301
257301
|
method: "get",
|
|
257302
|
-
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/applications`,
|
|
257302
|
+
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/applications`, superblocksBaseUrl2).toString(),
|
|
257303
257303
|
headers: {
|
|
257304
257304
|
Authorization: "Bearer " + token2,
|
|
257305
257305
|
[CLI_VERSION_HEADER]: cliVersion,
|
|
@@ -257318,14 +257318,14 @@ async function fetchApplications(cliVersion, token2, superblocksBaseUrl, injecte
|
|
|
257318
257318
|
throw new Error(`Could not fetch applications: ${message}`);
|
|
257319
257319
|
}
|
|
257320
257320
|
}
|
|
257321
|
-
async function fetchApi(cliVersion, apiId, token2,
|
|
257321
|
+
async function fetchApi(cliVersion, apiId, token2, superblocksBaseUrl2, viewMode, branch, commitId, skipSigningVerification = false) {
|
|
257322
257322
|
try {
|
|
257323
|
-
const serverURL = branch ? new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/apis/${apiId}/branches/${encodeURIComponent(branch)}`,
|
|
257323
|
+
const serverURL = branch ? new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/apis/${apiId}/branches/${encodeURIComponent(branch)}`, superblocksBaseUrl2) : new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/apis/${apiId}`, superblocksBaseUrl2);
|
|
257324
257324
|
serverURL.search = new URLSearchParams({
|
|
257325
257325
|
viewMode,
|
|
257326
257326
|
...commitId ? { commitId } : {}
|
|
257327
257327
|
}).toString();
|
|
257328
|
-
const socket = !skipSigningVerification ? await createSocketConnectionIfNeeded(cliVersion, token2,
|
|
257328
|
+
const socket = !skipSigningVerification ? await createSocketConnectionIfNeeded(cliVersion, token2, superblocksBaseUrl2) : void 0;
|
|
257329
257329
|
if (socket) {
|
|
257330
257330
|
try {
|
|
257331
257331
|
const resp = await socket.call.v1.public.api.get({
|
|
@@ -257340,7 +257340,7 @@ async function fetchApi(cliVersion, apiId, token2, superblocksBaseUrl, viewMode,
|
|
|
257340
257340
|
} else {
|
|
257341
257341
|
const config2 = {
|
|
257342
257342
|
method: "get",
|
|
257343
|
-
url: new URL(serverURL,
|
|
257343
|
+
url: new URL(serverURL, superblocksBaseUrl2).toString(),
|
|
257344
257344
|
headers: {
|
|
257345
257345
|
Authorization: "Bearer " + token2,
|
|
257346
257346
|
[CLI_VERSION_HEADER]: cliVersion
|
|
@@ -257356,11 +257356,11 @@ async function fetchApi(cliVersion, apiId, token2, superblocksBaseUrl, viewMode,
|
|
|
257356
257356
|
throw new Error(`Could not fetch api: ${typeof e === "object" && e && "message" in e ? e.message : e}`);
|
|
257357
257357
|
}
|
|
257358
257358
|
}
|
|
257359
|
-
async function fetchApis(cliVersion, token2,
|
|
257359
|
+
async function fetchApis(cliVersion, token2, superblocksBaseUrl2) {
|
|
257360
257360
|
try {
|
|
257361
257361
|
const config2 = {
|
|
257362
257362
|
method: "get",
|
|
257363
|
-
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/apis`,
|
|
257363
|
+
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/apis`, superblocksBaseUrl2).toString(),
|
|
257364
257364
|
headers: {
|
|
257365
257365
|
Authorization: "Bearer " + token2,
|
|
257366
257366
|
[CLI_VERSION_HEADER]: cliVersion
|
|
@@ -257372,7 +257372,7 @@ async function fetchApis(cliVersion, token2, superblocksBaseUrl) {
|
|
|
257372
257372
|
throw new Error("Could not fetch apis");
|
|
257373
257373
|
}
|
|
257374
257374
|
}
|
|
257375
|
-
async function validateGitSetup(cliVersion, resourceId, resourceType, event, localGitRepoState, token2,
|
|
257375
|
+
async function validateGitSetup(cliVersion, resourceId, resourceType, event, localGitRepoState, token2, superblocksBaseUrl2, injectedHeaders) {
|
|
257376
257376
|
let resourceName;
|
|
257377
257377
|
try {
|
|
257378
257378
|
const requestBody = {
|
|
@@ -257394,7 +257394,7 @@ async function validateGitSetup(cliVersion, resourceId, resourceType, event, loc
|
|
|
257394
257394
|
}
|
|
257395
257395
|
const config2 = {
|
|
257396
257396
|
method: "post",
|
|
257397
|
-
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/${path45}`,
|
|
257397
|
+
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/${path45}`, superblocksBaseUrl2).toString(),
|
|
257398
257398
|
headers: {
|
|
257399
257399
|
Authorization: "Bearer " + token2,
|
|
257400
257400
|
[CLI_VERSION_HEADER]: cliVersion,
|
|
@@ -257428,10 +257428,10 @@ async function validateGitSetup(cliVersion, resourceId, resourceType, event, loc
|
|
|
257428
257428
|
}
|
|
257429
257429
|
}
|
|
257430
257430
|
}
|
|
257431
|
-
async function registerComponents(cliVersion, applicationId, componentConfigs, token2,
|
|
257431
|
+
async function registerComponents(cliVersion, applicationId, componentConfigs, token2, superblocksBaseUrl2, branch, injectedHeaders) {
|
|
257432
257432
|
try {
|
|
257433
257433
|
const branchPath = branch ? `/branches/${encodeURIComponent(branch)}` : "";
|
|
257434
|
-
const socket = await createSocketConnectionIfNeeded(cliVersion, token2,
|
|
257434
|
+
const socket = await createSocketConnectionIfNeeded(cliVersion, token2, superblocksBaseUrl2);
|
|
257435
257435
|
if (socket) {
|
|
257436
257436
|
const resp = await socket.call.v1.public.application.component.register({
|
|
257437
257437
|
applicationId,
|
|
@@ -257445,7 +257445,7 @@ async function registerComponents(cliVersion, applicationId, componentConfigs, t
|
|
|
257445
257445
|
} else {
|
|
257446
257446
|
const config2 = {
|
|
257447
257447
|
method: "put",
|
|
257448
|
-
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/application/${applicationId}${branchPath}/components`,
|
|
257448
|
+
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/application/${applicationId}${branchPath}/components`, superblocksBaseUrl2).toString(),
|
|
257449
257449
|
headers: {
|
|
257450
257450
|
Authorization: "Bearer " + token2,
|
|
257451
257451
|
[CLI_VERSION_HEADER]: cliVersion,
|
|
@@ -257464,9 +257464,9 @@ async function registerComponents(cliVersion, applicationId, componentConfigs, t
|
|
|
257464
257464
|
throw new Error(`Could not register application components ${e.message ? "\n" + e.message : ""}`);
|
|
257465
257465
|
}
|
|
257466
257466
|
}
|
|
257467
|
-
async function uploadComponents({ cliVersion, applicationId, componentConfigs, files, token: token2, superblocksBaseUrl, branch }) {
|
|
257468
|
-
|
|
257469
|
-
const bucketeerBaseUrl = (0, import_util4.getBucketeerUrlFromSuperblocksUrl)(
|
|
257467
|
+
async function uploadComponents({ cliVersion, applicationId, componentConfigs, files, token: token2, superblocksBaseUrl: superblocksBaseUrl2, branch }) {
|
|
257468
|
+
superblocksBaseUrl2 = superblocksBaseUrl2.replace(/\/$/, "");
|
|
257469
|
+
const bucketeerBaseUrl = (0, import_util4.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl2);
|
|
257470
257470
|
const uploadFiles = files.map((file, ind) => {
|
|
257471
257471
|
let contentType = (0, import_util4.getContentType)(file);
|
|
257472
257472
|
if (contentType.length === 0) {
|
|
@@ -257512,15 +257512,15 @@ You can reduce your component bundle size by uploading static assets to a separa
|
|
|
257512
257512
|
Authorization: "Bearer " + token2,
|
|
257513
257513
|
[CLI_VERSION_HEADER]: cliVersion,
|
|
257514
257514
|
[import_util4.COMPONENT_EVENT_HEADER]: import_util4.ComponentEvent.UPLOAD,
|
|
257515
|
-
[SUPERBLOCKS_URL_HEADER]:
|
|
257515
|
+
[SUPERBLOCKS_URL_HEADER]: superblocksBaseUrl2,
|
|
257516
257516
|
...formHeaders
|
|
257517
257517
|
}
|
|
257518
257518
|
};
|
|
257519
257519
|
const uploadResponse = await axios_default.post(postURL, formData, config2);
|
|
257520
|
-
const initialSocket = await createSocketConnectionIfNeeded(cliVersion, token2,
|
|
257520
|
+
const initialSocket = await createSocketConnectionIfNeeded(cliVersion, token2, superblocksBaseUrl2);
|
|
257521
257521
|
const socket = initialSocket ?? await connectToISocketRPCServer({
|
|
257522
257522
|
agentUrl: void 0,
|
|
257523
|
-
superblocksBaseUrl,
|
|
257523
|
+
superblocksBaseUrl: superblocksBaseUrl2,
|
|
257524
257524
|
token: token2
|
|
257525
257525
|
});
|
|
257526
257526
|
try {
|
|
@@ -257555,11 +257555,11 @@ ${message}`);
|
|
|
257555
257555
|
}
|
|
257556
257556
|
}
|
|
257557
257557
|
}
|
|
257558
|
-
async function fetchCurrentUser(cliVersion, token2,
|
|
257558
|
+
async function fetchCurrentUser(cliVersion, token2, superblocksBaseUrl2) {
|
|
257559
257559
|
try {
|
|
257560
257560
|
const config2 = {
|
|
257561
257561
|
method: "get",
|
|
257562
|
-
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/users/me`,
|
|
257562
|
+
url: new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/users/me`, superblocksBaseUrl2).toString(),
|
|
257563
257563
|
headers: {
|
|
257564
257564
|
Authorization: "Bearer " + token2,
|
|
257565
257565
|
[CLI_VERSION_HEADER]: cliVersion,
|
|
@@ -257578,20 +257578,20 @@ async function fetchCurrentUser(cliVersion, token2, superblocksBaseUrl) {
|
|
|
257578
257578
|
throw new Error(`Could not fetch current user: ${message}`);
|
|
257579
257579
|
}
|
|
257580
257580
|
}
|
|
257581
|
-
var createSocketConnectionIfNeeded = async (cliVersion, token2,
|
|
257582
|
-
const userMe = await fetchCurrentUser(cliVersion, token2,
|
|
257581
|
+
var createSocketConnectionIfNeeded = async (cliVersion, token2, superblocksBaseUrl2) => {
|
|
257582
|
+
const userMe = await fetchCurrentUser(cliVersion, token2, superblocksBaseUrl2);
|
|
257583
257583
|
const organization = userMe.organizations[0];
|
|
257584
257584
|
if (organization.agentType == AgentType.ONPREMISE && signingEnabled(userMe.flagBootstrap)) {
|
|
257585
257585
|
const profile = process.env.SUPERBLOCKS_PROFILE;
|
|
257586
257586
|
const agentUrl = await getAgentUrl(userMe.agents, organization.agentType, profile);
|
|
257587
257587
|
return await connectToISocketRPCServer({
|
|
257588
257588
|
agentUrl,
|
|
257589
|
-
superblocksBaseUrl,
|
|
257589
|
+
superblocksBaseUrl: superblocksBaseUrl2,
|
|
257590
257590
|
token: token2
|
|
257591
257591
|
});
|
|
257592
257592
|
}
|
|
257593
257593
|
};
|
|
257594
|
-
async function pushApplication({ cliVersion, applicationId, token: token2, superblocksBaseUrl, applicationConfig, branch, injectedHeaders = {} }) {
|
|
257594
|
+
async function pushApplication({ cliVersion, applicationId, token: token2, superblocksBaseUrl: superblocksBaseUrl2, applicationConfig, branch, injectedHeaders = {} }) {
|
|
257595
257595
|
const handleHttpError = (status) => {
|
|
257596
257596
|
if (status === 405) {
|
|
257597
257597
|
throw new BranchNotCheckedOutError(`Branch ${branch} is not checked out`);
|
|
@@ -257600,7 +257600,7 @@ async function pushApplication({ cliVersion, applicationId, token: token2, super
|
|
|
257600
257600
|
}
|
|
257601
257601
|
};
|
|
257602
257602
|
try {
|
|
257603
|
-
const socket = await createSocketConnectionIfNeeded(cliVersion, token2,
|
|
257603
|
+
const socket = await createSocketConnectionIfNeeded(cliVersion, token2, superblocksBaseUrl2);
|
|
257604
257604
|
if (socket) {
|
|
257605
257605
|
const resp = await socket.call.v2.public.application.pushCommit({
|
|
257606
257606
|
applicationId,
|
|
@@ -257621,7 +257621,7 @@ async function pushApplication({ cliVersion, applicationId, token: token2, super
|
|
|
257621
257621
|
}
|
|
257622
257622
|
return resp.data;
|
|
257623
257623
|
} else {
|
|
257624
|
-
const serverURL = new URL(`${BASE_SERVER_PUBLIC_API_URL_v2}/applications/${applicationId}/branches/${encodeURIComponent(branch)}/push`,
|
|
257624
|
+
const serverURL = new URL(`${BASE_SERVER_PUBLIC_API_URL_v2}/applications/${applicationId}/branches/${encodeURIComponent(branch)}/push`, superblocksBaseUrl2);
|
|
257625
257625
|
const config2 = {
|
|
257626
257626
|
method: "post",
|
|
257627
257627
|
url: serverURL.toString(),
|
|
@@ -257651,7 +257651,7 @@ async function pushApplication({ cliVersion, applicationId, token: token2, super
|
|
|
257651
257651
|
throw new Error(`Could not push application ${e.message ? "\n" + e.message : ""}`);
|
|
257652
257652
|
}
|
|
257653
257653
|
}
|
|
257654
|
-
async function pushApi({ cliVersion, apiId, token: token2, superblocksBaseUrl, apiConfig, branch, injectedHeaders = {} }) {
|
|
257654
|
+
async function pushApi({ cliVersion, apiId, token: token2, superblocksBaseUrl: superblocksBaseUrl2, apiConfig, branch, injectedHeaders = {} }) {
|
|
257655
257655
|
const handleHttpError = (status) => {
|
|
257656
257656
|
if (status === 405) {
|
|
257657
257657
|
throw new BranchNotCheckedOutError(`Branch ${branch} is not checked out`);
|
|
@@ -257659,9 +257659,9 @@ async function pushApi({ cliVersion, apiId, token: token2, superblocksBaseUrl, a
|
|
|
257659
257659
|
throw new CommitAlreadyExistsError(`Commit ${apiConfig.commitId} already exists`);
|
|
257660
257660
|
}
|
|
257661
257661
|
};
|
|
257662
|
-
const serverURL = new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/apis/${apiId}/branches/${encodeURIComponent(branch)}/push`,
|
|
257662
|
+
const serverURL = new URL(`${BASE_SERVER_PUBLIC_API_URL_V1}/apis/${apiId}/branches/${encodeURIComponent(branch)}/push`, superblocksBaseUrl2);
|
|
257663
257663
|
try {
|
|
257664
|
-
const socket = await createSocketConnectionIfNeeded(cliVersion, token2,
|
|
257664
|
+
const socket = await createSocketConnectionIfNeeded(cliVersion, token2, superblocksBaseUrl2);
|
|
257665
257665
|
if (socket) {
|
|
257666
257666
|
const resp = await socket.call.v1.public.api.pushCommit({
|
|
257667
257667
|
apiId,
|
|
@@ -257709,9 +257709,9 @@ async function pushApi({ cliVersion, apiId, token: token2, superblocksBaseUrl, a
|
|
|
257709
257709
|
throw new Error(`Could not push api ${e.message ? "\n" + e.message : ""}`);
|
|
257710
257710
|
}
|
|
257711
257711
|
}
|
|
257712
|
-
async function fetchApplicationCommits({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl, injectedHeaders = {}, limit, offset }) {
|
|
257712
|
+
async function fetchApplicationCommits({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl: superblocksBaseUrl2, injectedHeaders = {}, limit, offset }) {
|
|
257713
257713
|
try {
|
|
257714
|
-
const serverURL = branch ? new URL(`${BASE_SERVER_API_URL_V2}/applications/${applicationId}/branches/${encodeURIComponent(branch)}/commits`,
|
|
257714
|
+
const serverURL = branch ? new URL(`${BASE_SERVER_API_URL_V2}/applications/${applicationId}/branches/${encodeURIComponent(branch)}/commits`, superblocksBaseUrl2) : new URL(`${BASE_SERVER_API_URL_V2}/applications/${applicationId}/commits`, superblocksBaseUrl2);
|
|
257715
257715
|
serverURL.search = new URLSearchParams({
|
|
257716
257716
|
commitType: "commit",
|
|
257717
257717
|
...limit ? { limit: limit.toString() } : {},
|
|
@@ -257735,9 +257735,9 @@ async function fetchApplicationCommits({ cliVersion, applicationId, branch, toke
|
|
|
257735
257735
|
throw new Error("Could not fetch application");
|
|
257736
257736
|
}
|
|
257737
257737
|
}
|
|
257738
|
-
async function fetchApiCommits({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl, injectedHeaders = {}, limit, offset }) {
|
|
257738
|
+
async function fetchApiCommits({ cliVersion, applicationId, branch, token: token2, superblocksBaseUrl: superblocksBaseUrl2, injectedHeaders = {}, limit, offset }) {
|
|
257739
257739
|
try {
|
|
257740
|
-
const serverURL = branch ? new URL(`${BASE_SERVER_API_URL_V3}/apis/${applicationId}/branches/${encodeURIComponent(branch)}/commits`,
|
|
257740
|
+
const serverURL = branch ? new URL(`${BASE_SERVER_API_URL_V3}/apis/${applicationId}/branches/${encodeURIComponent(branch)}/commits`, superblocksBaseUrl2) : new URL(`${BASE_SERVER_API_URL_V3}/apis/${applicationId}/commits`, superblocksBaseUrl2);
|
|
257741
257741
|
serverURL.search = new URLSearchParams({
|
|
257742
257742
|
commitType: "commit",
|
|
257743
257743
|
...limit ? { limit: limit.toString() } : {},
|
|
@@ -257761,13 +257761,13 @@ async function fetchApiCommits({ cliVersion, applicationId, branch, token: token
|
|
|
257761
257761
|
throw new Error("Could not fetch application");
|
|
257762
257762
|
}
|
|
257763
257763
|
}
|
|
257764
|
-
async function deployApplication(cliVersion, applicationId, token2,
|
|
257765
|
-
return deployResource(cliVersion, ResourceType.APPLICATION, applicationId, token2,
|
|
257764
|
+
async function deployApplication(cliVersion, applicationId, token2, superblocksBaseUrl2, commitId) {
|
|
257765
|
+
return deployResource(cliVersion, ResourceType.APPLICATION, applicationId, token2, superblocksBaseUrl2, commitId);
|
|
257766
257766
|
}
|
|
257767
|
-
async function deployApi(cliVersion, apiId, token2,
|
|
257768
|
-
return deployResource(cliVersion, ResourceType.BACKEND, apiId, token2,
|
|
257767
|
+
async function deployApi(cliVersion, apiId, token2, superblocksBaseUrl2, commitId) {
|
|
257768
|
+
return deployResource(cliVersion, ResourceType.BACKEND, apiId, token2, superblocksBaseUrl2, commitId);
|
|
257769
257769
|
}
|
|
257770
|
-
async function deployResource(cliVersion, resourceType, resourceId, token2,
|
|
257770
|
+
async function deployResource(cliVersion, resourceType, resourceId, token2, superblocksBaseUrl2, commitId) {
|
|
257771
257771
|
let apiBaseUrl;
|
|
257772
257772
|
try {
|
|
257773
257773
|
if (resourceType === ResourceType.BACKEND) {
|
|
@@ -257779,7 +257779,7 @@ async function deployResource(cliVersion, resourceType, resourceId, token2, supe
|
|
|
257779
257779
|
}
|
|
257780
257780
|
const config2 = {
|
|
257781
257781
|
method: "post",
|
|
257782
|
-
url: new URL(apiBaseUrl,
|
|
257782
|
+
url: new URL(apiBaseUrl, superblocksBaseUrl2).toString(),
|
|
257783
257783
|
headers: {
|
|
257784
257784
|
Authorization: "Bearer " + token2,
|
|
257785
257785
|
[CLI_VERSION_HEADER]: cliVersion
|
|
@@ -258004,10 +258004,10 @@ async function doUploadLocalDirectory(rpcClient, localDirectoryPath) {
|
|
|
258004
258004
|
}
|
|
258005
258005
|
|
|
258006
258006
|
// ../sdk/dist/dbfs/client.js
|
|
258007
|
-
async function getApplicationDirectoryHash(token2,
|
|
258007
|
+
async function getApplicationDirectoryHash(token2, superblocksBaseUrl2, applicationId, branch) {
|
|
258008
258008
|
const rpcClient = await connectToISocketRPCServer({
|
|
258009
258009
|
token: token2,
|
|
258010
|
-
superblocksBaseUrl
|
|
258010
|
+
superblocksBaseUrl: superblocksBaseUrl2
|
|
258011
258011
|
});
|
|
258012
258012
|
try {
|
|
258013
258013
|
const response = await rpcClient.call.v3.application.liveEditDirectoryContents.get({
|
|
@@ -258023,22 +258023,22 @@ async function getApplicationDirectoryHash(token2, superblocksBaseUrl, applicati
|
|
|
258023
258023
|
rpcClient.close();
|
|
258024
258024
|
}
|
|
258025
258025
|
}
|
|
258026
|
-
async function downloadApplicationDirectory(token2,
|
|
258026
|
+
async function downloadApplicationDirectory(token2, superblocksBaseUrl2, applicationId, branch, localDirectoryPath) {
|
|
258027
258027
|
const rpcClient = await connectToISocketRPCServer({
|
|
258028
258028
|
token: token2,
|
|
258029
|
-
superblocksBaseUrl
|
|
258029
|
+
superblocksBaseUrl: superblocksBaseUrl2
|
|
258030
258030
|
});
|
|
258031
258031
|
try {
|
|
258032
|
-
const liveEditHash = await getApplicationDirectoryHash(token2,
|
|
258032
|
+
const liveEditHash = await getApplicationDirectoryHash(token2, superblocksBaseUrl2, applicationId, branch);
|
|
258033
258033
|
await doDownloadDirectoryToLocal(rpcClient, liveEditHash, localDirectoryPath);
|
|
258034
258034
|
} finally {
|
|
258035
258035
|
rpcClient.close();
|
|
258036
258036
|
}
|
|
258037
258037
|
}
|
|
258038
|
-
async function uploadLocalApplication(token2,
|
|
258038
|
+
async function uploadLocalApplication(token2, superblocksBaseUrl2, applicationId, branch, localDirectoryPath) {
|
|
258039
258039
|
const rpcClient = await connectToISocketRPCServer({
|
|
258040
258040
|
token: token2,
|
|
258041
|
-
superblocksBaseUrl
|
|
258041
|
+
superblocksBaseUrl: superblocksBaseUrl2
|
|
258042
258042
|
});
|
|
258043
258043
|
try {
|
|
258044
258044
|
const directoryHash = await doUploadLocalDirectory(rpcClient, localDirectoryPath);
|
|
@@ -258052,10 +258052,10 @@ async function uploadLocalApplication(token2, superblocksBaseUrl, applicationId,
|
|
|
258052
258052
|
rpcClient.close();
|
|
258053
258053
|
}
|
|
258054
258054
|
}
|
|
258055
|
-
async function printDirectoryEntries(token2,
|
|
258055
|
+
async function printDirectoryEntries(token2, superblocksBaseUrl2, directoryHash) {
|
|
258056
258056
|
const rpcClient = await connectToISocketRPCServer({
|
|
258057
258057
|
token: token2,
|
|
258058
|
-
superblocksBaseUrl
|
|
258058
|
+
superblocksBaseUrl: superblocksBaseUrl2
|
|
258059
258059
|
});
|
|
258060
258060
|
try {
|
|
258061
258061
|
const directoryContentsResponse = await rpcClient.call.v1.dbfs.directoryContents.get({
|
|
@@ -258092,10 +258092,10 @@ async function printDirectoryEntries(token2, superblocksBaseUrl, directoryHash)
|
|
|
258092
258092
|
rpcClient.close();
|
|
258093
258093
|
}
|
|
258094
258094
|
}
|
|
258095
|
-
async function printFileContents(token2,
|
|
258095
|
+
async function printFileContents(token2, superblocksBaseUrl2, fileHash) {
|
|
258096
258096
|
const rpcClient = await connectToISocketRPCServer({
|
|
258097
258097
|
token: token2,
|
|
258098
|
-
superblocksBaseUrl
|
|
258098
|
+
superblocksBaseUrl: superblocksBaseUrl2
|
|
258099
258099
|
});
|
|
258100
258100
|
try {
|
|
258101
258101
|
const fileContentsResponse = await rpcClient.call.v1.dbfs.fileContents.get({
|
|
@@ -258113,9 +258113,9 @@ var SuperblocksSdk = class {
|
|
|
258113
258113
|
token = "";
|
|
258114
258114
|
superblocksBaseUrl = "";
|
|
258115
258115
|
cliVersion = "";
|
|
258116
|
-
constructor(accessToken,
|
|
258116
|
+
constructor(accessToken, superblocksBaseUrl2, cliVersion) {
|
|
258117
258117
|
this.token = accessToken;
|
|
258118
|
-
this.superblocksBaseUrl =
|
|
258118
|
+
this.superblocksBaseUrl = superblocksBaseUrl2;
|
|
258119
258119
|
this.cliVersion = cliVersion;
|
|
258120
258120
|
}
|
|
258121
258121
|
async getFeatureFlagsForCurrentUser() {
|
|
@@ -263722,11 +263722,12 @@ var import_instrumentation_http = __toESM(require_src10(), 1);
|
|
|
263722
263722
|
var import_resources = __toESM(require_src11(), 1);
|
|
263723
263723
|
var import_sdk_node = __toESM(require_src33(), 1);
|
|
263724
263724
|
init_esm();
|
|
263725
|
+
var import_util8 = __toESM(require_dist4(), 1);
|
|
263725
263726
|
|
|
263726
263727
|
// ../sdk/package.json
|
|
263727
263728
|
var package_default = {
|
|
263728
263729
|
name: "@superblocksteam/sdk",
|
|
263729
|
-
version: "2.0.0-next.
|
|
263730
|
+
version: "2.0.0-next.29",
|
|
263730
263731
|
type: "module",
|
|
263731
263732
|
description: "Superblocks JS SDK",
|
|
263732
263733
|
homepage: "https://www.superblocks.com",
|
|
@@ -263763,8 +263764,8 @@ var package_default = {
|
|
|
263763
263764
|
"@rollup/wasm-node": "^4.35.0",
|
|
263764
263765
|
"@superblocksteam/bucketeer-sdk": "0.4.1",
|
|
263765
263766
|
"@superblocksteam/shared": "0.9132.0",
|
|
263766
|
-
"@superblocksteam/util": "2.0.0-next.
|
|
263767
|
-
"@superblocksteam/vite-plugin-file-sync": "2.0.0-next.
|
|
263767
|
+
"@superblocksteam/util": "2.0.0-next.29",
|
|
263768
|
+
"@superblocksteam/vite-plugin-file-sync": "2.0.0-next.29",
|
|
263768
263769
|
"@vitejs/plugin-react": "^4.3.4",
|
|
263769
263770
|
axios: "^1.4.0",
|
|
263770
263771
|
chokidar: "^4.0.3",
|
|
@@ -263833,10 +263834,19 @@ var package_default = {
|
|
|
263833
263834
|
|
|
263834
263835
|
// ../sdk/dist/dev-utils/dev-tracer.js
|
|
263835
263836
|
var ATTR_DEPLOYMENT_ENVIRONMENT = "deployment.environment";
|
|
263837
|
+
var ATTR_SUPERBLOCKS_BASE_URL = "superblocks.base_url";
|
|
263838
|
+
var superblocksBaseUrl = "unknown";
|
|
263839
|
+
try {
|
|
263840
|
+
const tokenWithUrl = await (0, import_util8.getLocalTokenWithUrl)();
|
|
263841
|
+
superblocksBaseUrl = new URL(tokenWithUrl.superblocksBaseUrl).hostname;
|
|
263842
|
+
} catch (e) {
|
|
263843
|
+
console.error("[tracing init] could not determine superblocks base url", e);
|
|
263844
|
+
}
|
|
263836
263845
|
var sdk = new import_sdk_node.NodeSDK({
|
|
263837
263846
|
resource: import_resources.Resource.default().merge(new import_resources.Resource({
|
|
263838
263847
|
[ATTR_SERVICE_NAME]: "sdk-dev-server",
|
|
263839
|
-
[ATTR_DEPLOYMENT_ENVIRONMENT]: process.env.SUPERBLOCKS_CLI_ENV
|
|
263848
|
+
[ATTR_DEPLOYMENT_ENVIRONMENT]: process.env.SUPERBLOCKS_CLI_ENV,
|
|
263849
|
+
[ATTR_SUPERBLOCKS_BASE_URL]: superblocksBaseUrl
|
|
263840
263850
|
})),
|
|
263841
263851
|
contextManager: new import_context_async_hooks.AsyncLocalStorageContextManager(),
|
|
263842
263852
|
instrumentations: [
|
|
@@ -263867,7 +263877,7 @@ var tracer = trace.getTracer("sdk-dev-server", package_default.version);
|
|
|
263867
263877
|
var dev_tracer_default = tracer;
|
|
263868
263878
|
|
|
263869
263879
|
// ../sdk/dist/dev-utils/dev-server.mjs
|
|
263870
|
-
var
|
|
263880
|
+
var import_util31 = __toESM(require_dist4(), 1);
|
|
263871
263881
|
import net from "node:net";
|
|
263872
263882
|
import os3 from "node:os";
|
|
263873
263883
|
import path21 from "node:path";
|
|
@@ -275633,7 +275643,7 @@ import fs8 from "fs/promises";
|
|
|
275633
275643
|
import EventEmitter6 from "node:events";
|
|
275634
275644
|
import path16 from "node:path";
|
|
275635
275645
|
var import_shared16 = __toESM(require_dist3(), 1);
|
|
275636
|
-
var
|
|
275646
|
+
var import_util27 = __toESM(require_dist4(), 1);
|
|
275637
275647
|
init_lodash();
|
|
275638
275648
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
275639
275649
|
|
|
@@ -303403,7 +303413,7 @@ var FileSyncManager = class extends EventEmitter6 {
|
|
|
303403
303413
|
const stepPathMap = currentApiFile?.stepPathMap ?? {};
|
|
303404
303414
|
this.updateApi({ api: apiPb, stepPathMap }, path45);
|
|
303405
303415
|
await this.fsOperationQueue.enqueue(async () => {
|
|
303406
|
-
await (0,
|
|
303416
|
+
await (0, import_util27.writeApiFiles)({ apiPb }, "api", path45.split("/").slice(0, -1).join("/"), false, [], [], { extractLargeSourceFiles: true, minLinesForExtraction: 1 }, new Set(Object.keys(this.apiFiles)), stepPathMap);
|
|
303407
303417
|
if (this.apiFiles[path45]) {
|
|
303408
303418
|
this.apiFiles[path45].stepPathMap = stepPathMap;
|
|
303409
303419
|
}
|
|
@@ -304171,7 +304181,7 @@ async function readFiles(dir) {
|
|
|
304171
304181
|
});
|
|
304172
304182
|
}
|
|
304173
304183
|
var getMergedApiContent = async (path45) => {
|
|
304174
|
-
return (0,
|
|
304184
|
+
return (0, import_util27.readAppApiYamlFile)(path45.split("/").slice(0, -1).join("/"));
|
|
304175
304185
|
};
|
|
304176
304186
|
var getPageName2 = (path45) => {
|
|
304177
304187
|
const parts = path45.split("/");
|
|
@@ -304249,10 +304259,10 @@ function createRequestHandlers2() {
|
|
|
304249
304259
|
}
|
|
304250
304260
|
|
|
304251
304261
|
// ../../../vite-plugin-file-sync/dist/sync-service/server-rpc/client.js
|
|
304252
|
-
async function connectToISocketRPCServer2({ superblocksBaseUrl, token: token2 }) {
|
|
304262
|
+
async function connectToISocketRPCServer2({ superblocksBaseUrl: superblocksBaseUrl2, token: token2 }) {
|
|
304253
304263
|
const requestHandlers = createRequestHandlers2();
|
|
304254
304264
|
const authorization = `Bearer ${token2}`;
|
|
304255
|
-
const wsUrl = new URL(`api/${import_shared18.serverWsPath}`,
|
|
304265
|
+
const wsUrl = new URL(`api/${import_shared18.serverWsPath}`, superblocksBaseUrl2);
|
|
304256
304266
|
if (wsUrl.protocol === "http:") {
|
|
304257
304267
|
wsUrl.protocol = "ws:";
|
|
304258
304268
|
} else if (wsUrl.protocol === "https:") {
|
|
@@ -308508,7 +308518,7 @@ async function createDevServer({ root: root2, mode, fsOperationQueue, syncServic
|
|
|
308508
308518
|
logger3.debug("Dev server already running");
|
|
308509
308519
|
return httpServer;
|
|
308510
308520
|
}
|
|
308511
|
-
const resourceConfig = await (0,
|
|
308521
|
+
const resourceConfig = await (0, import_util31.getSuperblocksResourceConfigIfExists)();
|
|
308512
308522
|
if (resourceConfig?.configType !== "APPLICATION_V2") {
|
|
308513
308523
|
throw new Error("Invalid resource configuration type");
|
|
308514
308524
|
}
|
|
@@ -308644,7 +308654,7 @@ async function startVite({ app, httpServer: httpServer2, root: root2, mode, port
|
|
|
308644
308654
|
};
|
|
308645
308655
|
const isCustomBuildEnabled2 = await isCustomComponentsEnabled();
|
|
308646
308656
|
const customFolder = path21.join(root2, "custom");
|
|
308647
|
-
const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.0-next.
|
|
308657
|
+
const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.0-next.29";
|
|
308648
308658
|
const env3 = loadEnv(mode, root2, "");
|
|
308649
308659
|
const hmrPort = await getFreePort();
|
|
308650
308660
|
const hmrOptions = {
|
|
@@ -308751,7 +308761,7 @@ function getValidFileUrl(url3, file) {
|
|
|
308751
308761
|
|
|
308752
308762
|
// ../sdk/dist/cli-replacement/dev.mjs
|
|
308753
308763
|
init_cjs_shims();
|
|
308754
|
-
var
|
|
308764
|
+
var import_util35 = __toESM(require_dist4(), 1);
|
|
308755
308765
|
import * as child_process2 from "node:child_process";
|
|
308756
308766
|
import * as fsp5 from "node:fs/promises";
|
|
308757
308767
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -315568,7 +315578,7 @@ var getStaticPrompt = () => {
|
|
|
315568
315578
|
|
|
315569
315579
|
// ../../../vite-plugin-file-sync/dist/ai-service/transform/api-builder/to-sdk-transformer.js
|
|
315570
315580
|
init_cjs_shims();
|
|
315571
|
-
var
|
|
315581
|
+
var import_util32 = __toESM(require_dist4(), 1);
|
|
315572
315582
|
import * as fs13 from "fs/promises";
|
|
315573
315583
|
import * as path26 from "path";
|
|
315574
315584
|
|
|
@@ -315760,7 +315770,7 @@ var YamlToApiBuilderTransformer = class extends ApiBuilderTransformer {
|
|
|
315760
315770
|
const relativePath = renderPath(Paths.ApiYamls, pathParams);
|
|
315761
315771
|
const apiDir = path26.join(this.config.appRootDirPath, path26.dirname(relativePath));
|
|
315762
315772
|
const parentDir = path26.dirname(apiDir);
|
|
315763
|
-
return (0,
|
|
315773
|
+
return (0, import_util32.readAppApiYamlFile)(parentDir, pathParams.apiName);
|
|
315764
315774
|
}
|
|
315765
315775
|
async transform(src6) {
|
|
315766
315776
|
const targetDir = await this.renderTemplate();
|
|
@@ -322871,7 +322881,7 @@ import * as fsp3 from "node:fs/promises";
|
|
|
322871
322881
|
// ../../../vite-plugin-file-sync/dist/sync-service/hash-dir-tree.js
|
|
322872
322882
|
init_cjs_shims();
|
|
322873
322883
|
var import_shared34 = __toESM(require_dist3(), 1);
|
|
322874
|
-
var
|
|
322884
|
+
var import_util33 = __toESM(require_dist4(), 1);
|
|
322875
322885
|
async function hashLocalDirectory2(localDirectoryPath) {
|
|
322876
322886
|
const directoryContents = [];
|
|
322877
322887
|
const localDirListing = listLocalDirectory(localDirectoryPath);
|
|
@@ -322907,7 +322917,7 @@ async function hashLocalDirectory2(localDirectoryPath) {
|
|
|
322907
322917
|
break;
|
|
322908
322918
|
}
|
|
322909
322919
|
default:
|
|
322910
|
-
(0,
|
|
322920
|
+
(0, import_util33.unreachable)(localDirEntry);
|
|
322911
322921
|
}
|
|
322912
322922
|
directoryContents.push(entry);
|
|
322913
322923
|
}
|
|
@@ -323392,7 +323402,7 @@ var HashCache = class {
|
|
|
323392
323402
|
// ../../../vite-plugin-file-sync/dist/sync-service/snapshot/take-snapshot.js
|
|
323393
323403
|
init_cjs_shims();
|
|
323394
323404
|
var import_shared35 = __toESM(require_dist3(), 1);
|
|
323395
|
-
var
|
|
323405
|
+
var import_util34 = __toESM(require_dist4(), 1);
|
|
323396
323406
|
async function snapshotLocalDirectory(localDirectoryPath) {
|
|
323397
323407
|
const directoryContents = [];
|
|
323398
323408
|
const localDirListing = listLocalDirectory(localDirectoryPath);
|
|
@@ -323429,7 +323439,7 @@ async function snapshotLocalDirectory(localDirectoryPath) {
|
|
|
323429
323439
|
break;
|
|
323430
323440
|
}
|
|
323431
323441
|
default:
|
|
323432
|
-
(0,
|
|
323442
|
+
(0, import_util34.unreachable)(localDirEntry);
|
|
323433
323443
|
}
|
|
323434
323444
|
directoryContents.push(entry);
|
|
323435
323445
|
}
|
|
@@ -324449,9 +324459,9 @@ var import_valid = __toESM(require_valid(), 1);
|
|
|
324449
324459
|
var exec3 = promisify(child_process.exec);
|
|
324450
324460
|
var logger2 = getLogger2();
|
|
324451
324461
|
async function getRemoteVersions(config2) {
|
|
324452
|
-
const { token: token2, superblocksBaseUrl, id: id2 } = config2;
|
|
324462
|
+
const { token: token2, superblocksBaseUrl: superblocksBaseUrl2, id: id2 } = config2;
|
|
324453
324463
|
try {
|
|
324454
|
-
const response = await fetch(new URL(`api/v3/applications/${id2}/cli-library-versions`,
|
|
324464
|
+
const response = await fetch(new URL(`api/v3/applications/${id2}/cli-library-versions`, superblocksBaseUrl2), {
|
|
324455
324465
|
method: "GET",
|
|
324456
324466
|
headers: { Authorization: `Bearer ${token2}` }
|
|
324457
324467
|
});
|
|
@@ -324719,7 +324729,7 @@ async function dev(options8) {
|
|
|
324719
324729
|
});
|
|
324720
324730
|
logger3.info("Checking if local files are synced with the server");
|
|
324721
324731
|
try {
|
|
324722
|
-
await (0,
|
|
324732
|
+
await (0, import_util35.maskUnixSignals)(async () => {
|
|
324723
324733
|
const sdk2 = new SuperblocksSdk(applicationConfig.token, applicationConfig.superblocksBaseUrl, "");
|
|
324724
324734
|
if (lockService) {
|
|
324725
324735
|
try {
|
|
@@ -324811,10 +324821,10 @@ async function dev(options8) {
|
|
|
324811
324821
|
// ../sdk/dist/cli-replacement/init.js
|
|
324812
324822
|
init_cjs_shims();
|
|
324813
324823
|
var import_shared37 = __toESM(require_dist3(), 1);
|
|
324814
|
-
var
|
|
324824
|
+
var import_util36 = __toESM(require_dist4(), 1);
|
|
324815
324825
|
async function fetchAndWriteApplication({ resourceId, viewMode, featureFlags, projectRootFolder, appRelativePath, sdk: sdk2, skipSigningVerification }) {
|
|
324816
324826
|
const headers = {
|
|
324817
|
-
[
|
|
324827
|
+
[import_util36.COMPONENT_EVENT_HEADER]: import_shared37.ComponentEvent.INIT
|
|
324818
324828
|
};
|
|
324819
324829
|
const application = await sdk2.fetchApplicationWithComponents({
|
|
324820
324830
|
applicationId: resourceId,
|
|
@@ -324838,7 +324848,7 @@ async function fetchAndWriteApplication({ resourceId, viewMode, featureFlags, pr
|
|
|
324838
324848
|
var import_shared38 = __toESM(require_dist3(), 1);
|
|
324839
324849
|
|
|
324840
324850
|
// src/commands/commits.mts
|
|
324841
|
-
var
|
|
324851
|
+
var import_util39 = __toESM(require_dist4(), 1);
|
|
324842
324852
|
|
|
324843
324853
|
// ../../../../node_modules/.pnpm/listr2@6.6.0_enquirer@2.4.1/node_modules/listr2/dist/index.js
|
|
324844
324854
|
init_cjs_shims();
|
|
@@ -327110,7 +327120,7 @@ __name(Manager, "Manager");
|
|
|
327110
327120
|
init_cjs_shims();
|
|
327111
327121
|
import path30 from "node:path";
|
|
327112
327122
|
import { Command, ux } from "@oclif/core";
|
|
327113
|
-
var
|
|
327123
|
+
var import_util38 = __toESM(require_dist4(), 1);
|
|
327114
327124
|
var import_fs_extra3 = __toESM(require_lib(), 1);
|
|
327115
327125
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
327116
327126
|
|
|
@@ -327228,14 +327238,14 @@ var AuthenticatedCommand = class extends Command {
|
|
|
327228
327238
|
async init() {
|
|
327229
327239
|
await super.init();
|
|
327230
327240
|
try {
|
|
327231
|
-
const result = await (0,
|
|
327241
|
+
const result = await (0, import_util38.getLocalTokenWithUrl)();
|
|
327232
327242
|
if (!("token" in result)) {
|
|
327233
327243
|
throw new Error();
|
|
327234
327244
|
}
|
|
327235
|
-
const { token: token2, superblocksBaseUrl } = result;
|
|
327245
|
+
const { token: token2, superblocksBaseUrl: superblocksBaseUrl2 } = result;
|
|
327236
327246
|
this.sdk = new SuperblocksSdk(
|
|
327237
327247
|
token2,
|
|
327238
|
-
|
|
327248
|
+
superblocksBaseUrl2,
|
|
327239
327249
|
this.config.version
|
|
327240
327250
|
);
|
|
327241
327251
|
await this.runAutomatedDotfileUpdates();
|
|
@@ -327259,7 +327269,7 @@ var AuthenticatedCommand = class extends Command {
|
|
|
327259
327269
|
};
|
|
327260
327270
|
}
|
|
327261
327271
|
async getBaseUrl() {
|
|
327262
|
-
const result = await (0,
|
|
327272
|
+
const result = await (0, import_util38.getLocalTokenWithUrlIfExists)();
|
|
327263
327273
|
return result?.superblocksBaseUrl ?? "";
|
|
327264
327274
|
}
|
|
327265
327275
|
getSdk() {
|
|
@@ -327272,7 +327282,7 @@ var AuthenticatedCommand = class extends Command {
|
|
|
327272
327282
|
let previousConfig;
|
|
327273
327283
|
let rootConfigPath;
|
|
327274
327284
|
try {
|
|
327275
|
-
[previousConfig, rootConfigPath] = await (0,
|
|
327285
|
+
[previousConfig, rootConfigPath] = await (0, import_util38.getSuperblocksMonorepoConfigJson)(true);
|
|
327276
327286
|
} catch {
|
|
327277
327287
|
return;
|
|
327278
327288
|
}
|
|
@@ -327357,7 +327367,7 @@ var AuthenticatedApplicationCommand = class extends AuthenticatedCommand {
|
|
|
327357
327367
|
apis: {}
|
|
327358
327368
|
};
|
|
327359
327369
|
async getEditModeUrl() {
|
|
327360
|
-
const result = await (0,
|
|
327370
|
+
const result = await (0, import_util38.getLocalTokenWithUrlIfExists)();
|
|
327361
327371
|
const baseUrl = typeof result === "string" ? result : result?.superblocksBaseUrl;
|
|
327362
327372
|
return new URL(
|
|
327363
327373
|
`/applications/edit/${this.applicationConfig.id}`,
|
|
@@ -327367,14 +327377,14 @@ var AuthenticatedApplicationCommand = class extends AuthenticatedCommand {
|
|
|
327367
327377
|
async init() {
|
|
327368
327378
|
await super.init();
|
|
327369
327379
|
try {
|
|
327370
|
-
this.applicationConfig = await (0,
|
|
327380
|
+
this.applicationConfig = await (0, import_util38.getSuperblocksApplicationConfigJson)();
|
|
327371
327381
|
} catch (error) {
|
|
327372
327382
|
this.error(error.message, {
|
|
327373
327383
|
exit: 1
|
|
327374
327384
|
});
|
|
327375
327385
|
}
|
|
327376
327386
|
const { branchName } = await this.validateApplicationGitSetup(
|
|
327377
|
-
|
|
327387
|
+
import_util38.ComponentEvent.INIT
|
|
327378
327388
|
);
|
|
327379
327389
|
ux.action.start("Checking application...");
|
|
327380
327390
|
try {
|
|
@@ -327439,7 +327449,7 @@ ${cyan("superblocks migrate")}`
|
|
|
327439
327449
|
}
|
|
327440
327450
|
ux.action.stop();
|
|
327441
327451
|
ux.action.start("Scanning for Superblocks components...");
|
|
327442
|
-
const exists2 = await import_fs_extra3.default.pathExists(
|
|
327452
|
+
const exists2 = await import_fs_extra3.default.pathExists(import_util38.CUSTOM_COMPONENTS_PATH);
|
|
327443
327453
|
if (!exists2) {
|
|
327444
327454
|
ux.action.stop();
|
|
327445
327455
|
this.error(
|
|
@@ -327449,7 +327459,7 @@ ${cyan("superblocks migrate")}`
|
|
|
327449
327459
|
}
|
|
327450
327460
|
);
|
|
327451
327461
|
}
|
|
327452
|
-
const { configs, hasError } = await (0,
|
|
327462
|
+
const { configs, hasError } = await (0, import_util38.getComponentConfigs)(true);
|
|
327453
327463
|
if (hasError) {
|
|
327454
327464
|
ux.action.stop();
|
|
327455
327465
|
this.error("Failed to register components", { exit: 1 });
|
|
@@ -327465,7 +327475,7 @@ ${cyan("superblocks migrate")}`
|
|
|
327465
327475
|
try {
|
|
327466
327476
|
ux.action.start("Registering components...");
|
|
327467
327477
|
const { branchName } = await this.validateApplicationGitSetup(
|
|
327468
|
-
|
|
327478
|
+
import_util38.ComponentEvent.REGISTER
|
|
327469
327479
|
);
|
|
327470
327480
|
await this.getSdk().registerComponents(
|
|
327471
327481
|
this.applicationConfig.id,
|
|
@@ -327488,7 +327498,7 @@ var AuthenticatedApplicationV2Command = class extends AuthenticatedCommand {
|
|
|
327488
327498
|
id: ""
|
|
327489
327499
|
};
|
|
327490
327500
|
async getEditModeUrl() {
|
|
327491
|
-
const result = await (0,
|
|
327501
|
+
const result = await (0, import_util38.getLocalTokenWithUrlIfExists)();
|
|
327492
327502
|
const baseUrl = typeof result === "string" ? result : result?.superblocksBaseUrl;
|
|
327493
327503
|
return new URL(
|
|
327494
327504
|
`/code-mode/applications/edit/${this.applicationConfig.id}`,
|
|
@@ -327498,14 +327508,14 @@ var AuthenticatedApplicationV2Command = class extends AuthenticatedCommand {
|
|
|
327498
327508
|
async init() {
|
|
327499
327509
|
await super.init();
|
|
327500
327510
|
try {
|
|
327501
|
-
this.applicationConfig = await (0,
|
|
327511
|
+
this.applicationConfig = await (0, import_util38.getSuperblocksApplicationV2ConfigJson)();
|
|
327502
327512
|
} catch (error) {
|
|
327503
327513
|
this.error(error.message, {
|
|
327504
327514
|
exit: 1
|
|
327505
327515
|
});
|
|
327506
327516
|
}
|
|
327507
327517
|
const { branchName } = await this.validateApplicationGitSetup(
|
|
327508
|
-
|
|
327518
|
+
import_util38.ComponentEvent.INIT
|
|
327509
327519
|
);
|
|
327510
327520
|
ux.action.start("Checking application...");
|
|
327511
327521
|
try {
|
|
@@ -327595,8 +327605,8 @@ var Commits = class _Commits extends AuthenticatedCommand {
|
|
|
327595
327605
|
[
|
|
327596
327606
|
ctx.existingSuperblocksRootConfig,
|
|
327597
327607
|
ctx.superblocksRootConfigPath
|
|
327598
|
-
] = await (0,
|
|
327599
|
-
ctx.existingSuperblocksResourceConfig = await (0,
|
|
327608
|
+
] = await (0, import_util39.getSuperblocksMonorepoConfigJson)(true);
|
|
327609
|
+
ctx.existingSuperblocksResourceConfig = await (0, import_util39.getSuperblocksResourceConfigIfExists)();
|
|
327600
327610
|
ctx.superblocksRootPath = path31.resolve(
|
|
327601
327611
|
path31.dirname(ctx.superblocksRootConfigPath),
|
|
327602
327612
|
".."
|
|
@@ -327637,7 +327647,7 @@ var Commits = class _Commits extends AuthenticatedCommand {
|
|
|
327637
327647
|
skipSigningVerification: true
|
|
327638
327648
|
});
|
|
327639
327649
|
} catch (error) {
|
|
327640
|
-
if (error instanceof
|
|
327650
|
+
if (error instanceof import_util39.NotFoundError) {
|
|
327641
327651
|
ctx.removedResourceIds.push(resourceId);
|
|
327642
327652
|
} else {
|
|
327643
327653
|
throw error;
|
|
@@ -327653,7 +327663,7 @@ var Commits = class _Commits extends AuthenticatedCommand {
|
|
|
327653
327663
|
skipSigningVerification: true
|
|
327654
327664
|
});
|
|
327655
327665
|
} catch (error) {
|
|
327656
|
-
if (error instanceof
|
|
327666
|
+
if (error instanceof import_util39.NotFoundError) {
|
|
327657
327667
|
ctx.removedResourceIds.push(resourceId);
|
|
327658
327668
|
} else {
|
|
327659
327669
|
throw error;
|
|
@@ -327726,7 +327736,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
327726
327736
|
title: `Fetching commits for application ${resource.location} from branch ${branchName}...`,
|
|
327727
327737
|
task: async (_ctx, task2) => {
|
|
327728
327738
|
const headers = {
|
|
327729
|
-
[
|
|
327739
|
+
[import_util39.COMPONENT_EVENT_HEADER]: import_util39.ComponentEvent.COMMITS
|
|
327730
327740
|
};
|
|
327731
327741
|
try {
|
|
327732
327742
|
task2.title += `: fetched`;
|
|
@@ -327740,7 +327750,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
327740
327750
|
this.printCommits(applicationCommits, branchName);
|
|
327741
327751
|
task2.title += `: done`;
|
|
327742
327752
|
} catch (e) {
|
|
327743
|
-
if (e instanceof
|
|
327753
|
+
if (e instanceof import_util39.NotFoundError) {
|
|
327744
327754
|
task2.title += `: not found in this branch. skipped`;
|
|
327745
327755
|
} else {
|
|
327746
327756
|
throw e;
|
|
@@ -327801,7 +327811,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
327801
327811
|
`No resource found with the given location: ${resourcePath}`
|
|
327802
327812
|
);
|
|
327803
327813
|
}
|
|
327804
|
-
const resourceConfig = await (0,
|
|
327814
|
+
const resourceConfig = await (0, import_util39.getSuperblocksResourceConfigIfExists)();
|
|
327805
327815
|
if (resourceConfig) {
|
|
327806
327816
|
return resourceConfig.id;
|
|
327807
327817
|
}
|
|
@@ -327859,7 +327869,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
327859
327869
|
|
|
327860
327870
|
// src/commands/components/create.mts
|
|
327861
327871
|
init_cjs_shims();
|
|
327862
|
-
var
|
|
327872
|
+
var import_util40 = __toESM(require_dist4(), 1);
|
|
327863
327873
|
import { exec as exec6 } from "node:child_process";
|
|
327864
327874
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
327865
327875
|
import path33 from "node:path";
|
|
@@ -327984,8 +327994,8 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
|
|
|
327984
327994
|
type: "input",
|
|
327985
327995
|
name: "name",
|
|
327986
327996
|
message: "What is the machine readable name of the component you want to create?",
|
|
327987
|
-
validate: (response) => (0,
|
|
327988
|
-
initial: (0,
|
|
327997
|
+
validate: (response) => (0, import_util40.isValidIdentifier)(response) || "Invalid identifier",
|
|
327998
|
+
initial: (0, import_util40.suggestIdentifier)(displayName, true) || "ToDoList"
|
|
327989
327999
|
})).name;
|
|
327990
328000
|
this.log();
|
|
327991
328001
|
this.log(
|
|
@@ -328010,8 +328020,8 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
|
|
|
328010
328020
|
name: "path",
|
|
328011
328021
|
message: "What is the path of the property? This will be used to access the property in your code (e.g. currentTasks)",
|
|
328012
328022
|
validate: (response) => {
|
|
328013
|
-
if (!(0,
|
|
328014
|
-
if ((0,
|
|
328023
|
+
if (!(0, import_util40.isValidIdentifier)(response)) return "Invalid identifier";
|
|
328024
|
+
if ((0, import_util40.isReservedPropertyName)(response))
|
|
328015
328025
|
return "Reserved property path (see https://docs.superblocks.com/applications/custom-components/faq#what-is-a-reserved-property)";
|
|
328016
328026
|
if (properties.some((v) => v.path === response))
|
|
328017
328027
|
return "Duplicate property path";
|
|
@@ -328022,7 +328032,7 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
|
|
|
328022
328032
|
type: "select",
|
|
328023
328033
|
name: "type",
|
|
328024
328034
|
message: `What is the type of ${propertyPath}?`,
|
|
328025
|
-
choices: Object.entries(
|
|
328035
|
+
choices: Object.entries(import_util40.dataTypeDefinions).map(
|
|
328026
328036
|
([k, v]) => ({
|
|
328027
328037
|
name: k,
|
|
328028
328038
|
message: v.prompt,
|
|
@@ -328105,10 +328115,10 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
|
|
|
328105
328115
|
name: "value",
|
|
328106
328116
|
message: "What is the path of the event? This will be used to trigger the event in your code (e.g. onChange)",
|
|
328107
328117
|
type: "input",
|
|
328108
|
-
initial: (0,
|
|
328118
|
+
initial: (0, import_util40.suggestIdentifier)(eventHandlerName) || "onChange",
|
|
328109
328119
|
validate: (response) => {
|
|
328110
|
-
if (!(0,
|
|
328111
|
-
if ((0,
|
|
328120
|
+
if (!(0, import_util40.isValidIdentifier)(response)) return "Invalid identifier";
|
|
328121
|
+
if ((0, import_util40.isReservedPropertyName)(response))
|
|
328112
328122
|
return "Reserved property path (see https://docs.superblocks.com/applications/custom-components/faq#what-is-a-reserved-property)";
|
|
328113
328123
|
if (events.some((v) => v.path === response))
|
|
328114
328124
|
return "Duplicate property path";
|
|
@@ -328270,7 +328280,7 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
|
|
|
328270
328280
|
ux2.action.stop();
|
|
328271
328281
|
}
|
|
328272
328282
|
const headers = {
|
|
328273
|
-
[
|
|
328283
|
+
[import_util40.COMPONENT_EVENT_HEADER]: import_util40.ComponentEvent.CREATE
|
|
328274
328284
|
};
|
|
328275
328285
|
await this.registerComponents(headers);
|
|
328276
328286
|
}
|
|
@@ -328278,13 +328288,13 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
|
|
|
328278
328288
|
|
|
328279
328289
|
// src/commands/components/register.mts
|
|
328280
328290
|
init_cjs_shims();
|
|
328281
|
-
var
|
|
328291
|
+
var import_util41 = __toESM(require_dist4(), 1);
|
|
328282
328292
|
var Register = class extends AuthenticatedApplicationCommand {
|
|
328283
328293
|
static description = "Registers all local component config files";
|
|
328284
328294
|
static examples = ["superblocks components register"];
|
|
328285
328295
|
async run() {
|
|
328286
328296
|
const headers = {
|
|
328287
|
-
[
|
|
328297
|
+
[import_util41.COMPONENT_EVENT_HEADER]: import_util41.ComponentEvent.REGISTER
|
|
328288
328298
|
};
|
|
328289
328299
|
await this.registerComponents(headers);
|
|
328290
328300
|
}
|
|
@@ -328292,7 +328302,7 @@ var Register = class extends AuthenticatedApplicationCommand {
|
|
|
328292
328302
|
|
|
328293
328303
|
// src/commands/components/upload.mts
|
|
328294
328304
|
init_cjs_shims();
|
|
328295
|
-
var
|
|
328305
|
+
var import_util42 = __toESM(require_dist4(), 1);
|
|
328296
328306
|
import { Flags as Flags3, ux as ux3 } from "@oclif/core";
|
|
328297
328307
|
import react3 from "@vitejs/plugin-react";
|
|
328298
328308
|
var import_fs_extra6 = __toESM(require_lib(), 1);
|
|
@@ -328512,7 +328522,7 @@ var Upload = class _Upload extends AuthenticatedApplicationCommand {
|
|
|
328512
328522
|
async run() {
|
|
328513
328523
|
const { flags } = await this.parse(_Upload);
|
|
328514
328524
|
ux3.action.start("Scanning for Superblocks components...");
|
|
328515
|
-
const exists2 = await import_fs_extra6.default.pathExists(
|
|
328525
|
+
const exists2 = await import_fs_extra6.default.pathExists(import_util42.CUSTOM_COMPONENTS_PATH);
|
|
328516
328526
|
if (!exists2) {
|
|
328517
328527
|
ux3.action.stop();
|
|
328518
328528
|
this.error(
|
|
@@ -328523,11 +328533,11 @@ var Upload = class _Upload extends AuthenticatedApplicationCommand {
|
|
|
328523
328533
|
);
|
|
328524
328534
|
}
|
|
328525
328535
|
const { branchName } = await this.validateApplicationGitSetup(
|
|
328526
|
-
|
|
328536
|
+
import_util42.ComponentEvent.UPLOAD,
|
|
328527
328537
|
flags.branch
|
|
328528
328538
|
);
|
|
328529
328539
|
const headers = {
|
|
328530
|
-
[
|
|
328540
|
+
[import_util42.COMPONENT_EVENT_HEADER]: import_util42.ComponentEvent.REGISTER
|
|
328531
328541
|
};
|
|
328532
328542
|
const configs = await this.registerComponents(headers);
|
|
328533
328543
|
if (!configs) return;
|
|
@@ -328610,14 +328620,14 @@ var Upload = class _Upload extends AuthenticatedApplicationCommand {
|
|
|
328610
328620
|
|
|
328611
328621
|
// src/commands/components/watch.mts
|
|
328612
328622
|
init_cjs_shims();
|
|
328613
|
-
var
|
|
328623
|
+
var import_util44 = __toESM(require_dist4(), 1);
|
|
328614
328624
|
import react4 from "@vitejs/plugin-react";
|
|
328615
328625
|
import { createLogger as createLogger5, createServer as createServer2 } from "vite";
|
|
328616
328626
|
|
|
328617
328627
|
// src/appendHotReloadEventPlugin.mts
|
|
328618
328628
|
init_cjs_shims();
|
|
328619
328629
|
import path37 from "path";
|
|
328620
|
-
var
|
|
328630
|
+
var import_util43 = __toESM(require_dist4(), 1);
|
|
328621
328631
|
var appendHotReloadEventPlugin = (getBranch) => {
|
|
328622
328632
|
return {
|
|
328623
328633
|
name: "append-code-plugin",
|
|
@@ -328628,24 +328638,24 @@ var appendHotReloadEventPlugin = (getBranch) => {
|
|
|
328628
328638
|
const isConfigFile = path37.basename(ctx.file) === "config.ts";
|
|
328629
328639
|
if (!isConfigFile) return;
|
|
328630
328640
|
try {
|
|
328631
|
-
const result = await (0,
|
|
328641
|
+
const result = await (0, import_util43.getLocalTokenWithUrl)();
|
|
328632
328642
|
if (!result || !("token" in result)) {
|
|
328633
328643
|
throw new Error("Please run `superblocks login` to login.");
|
|
328634
328644
|
}
|
|
328635
|
-
const { token: token2, superblocksBaseUrl } = result;
|
|
328636
|
-
const resourceConfig = await (0,
|
|
328637
|
-
const { configs, hasError } = await (0,
|
|
328645
|
+
const { token: token2, superblocksBaseUrl: superblocksBaseUrl2 } = result;
|
|
328646
|
+
const resourceConfig = await (0, import_util43.getSuperblocksApplicationConfigJson)();
|
|
328647
|
+
const { configs, hasError } = await (0, import_util43.getComponentConfigs)(true);
|
|
328638
328648
|
if (hasError) return;
|
|
328639
|
-
const [rootSettings] = await (0,
|
|
328649
|
+
const [rootSettings] = await (0, import_util43.getSuperblocksMonorepoConfigJson)(true);
|
|
328640
328650
|
const sdk2 = new SuperblocksSdk(
|
|
328641
328651
|
token2,
|
|
328642
|
-
|
|
328652
|
+
superblocksBaseUrl2,
|
|
328643
328653
|
rootSettings.metadata.cliVersion
|
|
328644
328654
|
);
|
|
328645
328655
|
console.log("Registering components...");
|
|
328646
328656
|
const branch = await getBranch();
|
|
328647
328657
|
const headers = {
|
|
328648
|
-
[
|
|
328658
|
+
[import_util43.COMPONENT_EVENT_HEADER]: import_util43.ComponentEvent.REGISTER
|
|
328649
328659
|
};
|
|
328650
328660
|
await sdk2.registerComponents(
|
|
328651
328661
|
resourceConfig.id,
|
|
@@ -328692,7 +328702,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
|
|
|
328692
328702
|
static description = "watch for changes to your custom components";
|
|
328693
328703
|
async run() {
|
|
328694
328704
|
const headers = {
|
|
328695
|
-
[
|
|
328705
|
+
[import_util44.COMPONENT_EVENT_HEADER]: import_util44.ComponentEvent.REGISTER
|
|
328696
328706
|
};
|
|
328697
328707
|
await this.registerComponents(headers);
|
|
328698
328708
|
this.log(
|
|
@@ -328703,7 +328713,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
|
|
|
328703
328713
|
this.log();
|
|
328704
328714
|
const editModeUrl = new URL(await this.getEditModeUrl());
|
|
328705
328715
|
editModeUrl.searchParams.set("devMode", "true");
|
|
328706
|
-
const { branchName, localBranchName } = await this.validateApplicationGitSetup(
|
|
328716
|
+
const { branchName, localBranchName } = await this.validateApplicationGitSetup(import_util44.ComponentEvent.REGISTER);
|
|
328707
328717
|
if (branchName) {
|
|
328708
328718
|
editModeUrl.searchParams.set("branch", branchName);
|
|
328709
328719
|
}
|
|
@@ -328719,7 +328729,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
|
|
|
328719
328729
|
if (curLocalBranchName === lastLocalBranchName) {
|
|
328720
328730
|
return lastBranchName;
|
|
328721
328731
|
} else {
|
|
328722
|
-
const { branchName: branchName2, localBranchName: localBranchName2 } = await this.validateApplicationGitSetup(
|
|
328732
|
+
const { branchName: branchName2, localBranchName: localBranchName2 } = await this.validateApplicationGitSetup(import_util44.ComponentEvent.REGISTER);
|
|
328723
328733
|
lastBranchName = branchName2;
|
|
328724
328734
|
lastLocalBranchName = localBranchName2;
|
|
328725
328735
|
return branchName2;
|
|
@@ -328779,7 +328789,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
|
|
|
328779
328789
|
|
|
328780
328790
|
// src/commands/config/set.mts
|
|
328781
328791
|
init_cjs_shims();
|
|
328782
|
-
var
|
|
328792
|
+
var import_util46 = __toESM(require_dist4(), 1);
|
|
328783
328793
|
import dns from "dns";
|
|
328784
328794
|
import { promisify as promisify3 } from "util";
|
|
328785
328795
|
import { Args as Args2, Command as Command2 } from "@oclif/core";
|
|
@@ -328808,21 +328818,21 @@ var SetSuperblocksConfig = class _SetSuperblocksConfig extends Command2 {
|
|
|
328808
328818
|
const newDomain = args.value;
|
|
328809
328819
|
const newSuperblocksBaseUrl = `https://${newDomain}/`;
|
|
328810
328820
|
await this.validateDomain(newDomain);
|
|
328811
|
-
const result = await (0,
|
|
328821
|
+
const result = await (0, import_util46.getLocalTokenWithUrlIfExists)();
|
|
328812
328822
|
if (result) {
|
|
328813
328823
|
if (!("token" in result)) {
|
|
328814
|
-
await (0,
|
|
328824
|
+
await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl);
|
|
328815
328825
|
break;
|
|
328816
328826
|
}
|
|
328817
|
-
const { token: token2, superblocksBaseUrl } = result;
|
|
328818
|
-
const tokenToSave = newSuperblocksBaseUrl ===
|
|
328827
|
+
const { token: token2, superblocksBaseUrl: superblocksBaseUrl2 } = result;
|
|
328828
|
+
const tokenToSave = newSuperblocksBaseUrl === superblocksBaseUrl2 ? token2 : void 0;
|
|
328819
328829
|
if (tokenToSave) {
|
|
328820
|
-
await (0,
|
|
328830
|
+
await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl, tokenToSave);
|
|
328821
328831
|
} else {
|
|
328822
|
-
await (0,
|
|
328832
|
+
await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl);
|
|
328823
328833
|
}
|
|
328824
328834
|
} else {
|
|
328825
|
-
await (0,
|
|
328835
|
+
await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl);
|
|
328826
328836
|
}
|
|
328827
328837
|
break;
|
|
328828
328838
|
}
|
|
@@ -329045,7 +329055,7 @@ var Dev2 = class extends Command4 {
|
|
|
329045
329055
|
init_cjs_shims();
|
|
329046
329056
|
import path38 from "path";
|
|
329047
329057
|
import { Args as Args3, Flags as Flags6 } from "@oclif/core";
|
|
329048
|
-
var
|
|
329058
|
+
var import_util47 = __toESM(require_dist4(), 1);
|
|
329049
329059
|
var import_fs_extra8 = __toESM(require_lib(), 1);
|
|
329050
329060
|
init_lodash();
|
|
329051
329061
|
var Initialize = class _Initialize extends AuthenticatedCommand {
|
|
@@ -329095,7 +329105,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
|
|
|
329095
329105
|
[
|
|
329096
329106
|
ctx.existingSuperblocksRootConfig,
|
|
329097
329107
|
ctx.superblocksRootConfigPath
|
|
329098
|
-
] = await (0,
|
|
329108
|
+
] = await (0, import_util47.getSuperblocksMonorepoConfigJson)(true);
|
|
329099
329109
|
} catch {
|
|
329100
329110
|
}
|
|
329101
329111
|
}
|
|
@@ -329137,12 +329147,12 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
|
|
|
329137
329147
|
title: "Fetching resource by resourceUrl...",
|
|
329138
329148
|
enabled: () => !isEmpty_default(args.resource_url),
|
|
329139
329149
|
task: async (ctx2, task2) => {
|
|
329140
|
-
const [resourceId, resourceType] = (0,
|
|
329150
|
+
const [resourceId, resourceType] = (0, import_util47.getResourceIdFromUrl)(
|
|
329141
329151
|
args.resource_url
|
|
329142
329152
|
);
|
|
329143
329153
|
if (resourceType === "APPLICATION") {
|
|
329144
329154
|
const headers = {
|
|
329145
|
-
[
|
|
329155
|
+
[import_util47.COMPONENT_EVENT_HEADER]: import_util47.ComponentEvent.INIT
|
|
329146
329156
|
};
|
|
329147
329157
|
const application = await this.getSdk().fetchApplicationWithComponents({
|
|
329148
329158
|
applicationId: resourceId,
|
|
@@ -329151,7 +329161,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
|
|
|
329151
329161
|
skipSigningVerification
|
|
329152
329162
|
});
|
|
329153
329163
|
if (!application) {
|
|
329154
|
-
throw new
|
|
329164
|
+
throw new import_util47.NotFoundError(
|
|
329155
329165
|
`Application ${resourceId} was not found`
|
|
329156
329166
|
);
|
|
329157
329167
|
}
|
|
@@ -329280,16 +329290,16 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
|
|
|
329280
329290
|
)) {
|
|
329281
329291
|
superblocksConfig.resources[resourceId] = resource;
|
|
329282
329292
|
}
|
|
329283
|
-
if (!await import_fs_extra8.default.exists(
|
|
329284
|
-
await import_fs_extra8.default.mkdir(
|
|
329293
|
+
if (!await import_fs_extra8.default.exists(import_util47.SUPERBLOCKS_HOME_FOLDER_NAME)) {
|
|
329294
|
+
await import_fs_extra8.default.mkdir(import_util47.SUPERBLOCKS_HOME_FOLDER_NAME);
|
|
329285
329295
|
}
|
|
329286
329296
|
await import_fs_extra8.default.writeFile(
|
|
329287
|
-
ctx.superblocksRootConfigPath ??
|
|
329297
|
+
ctx.superblocksRootConfigPath ?? import_util47.RESOURCE_CONFIG_PATH,
|
|
329288
329298
|
JSON.stringify(sortByKey(superblocksConfig), null, 2)
|
|
329289
329299
|
);
|
|
329290
329300
|
if (ctx.existingSuperblocksRootConfig) {
|
|
329291
329301
|
this.log(
|
|
329292
|
-
`Superblocks resources added at ${ctx.superblocksRootConfigPath?.replace(
|
|
329302
|
+
`Superblocks resources added at ${ctx.superblocksRootConfigPath?.replace(import_util47.RESOURCE_CONFIG_PATH, "")}`
|
|
329293
329303
|
);
|
|
329294
329304
|
}
|
|
329295
329305
|
}
|
|
@@ -329304,7 +329314,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
|
|
|
329304
329314
|
async getResourcesToInitialize(ctx, task, args) {
|
|
329305
329315
|
if (args.resource_url) {
|
|
329306
329316
|
try {
|
|
329307
|
-
const [resourceId] = (0,
|
|
329317
|
+
const [resourceId] = (0, import_util47.getResourceIdFromUrl)(args.resource_url);
|
|
329308
329318
|
return [resourceId];
|
|
329309
329319
|
} catch {
|
|
329310
329320
|
throw new Error(`Invalid resource URL: ${args.resource_url}`);
|
|
@@ -329386,7 +329396,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
|
|
|
329386
329396
|
// src/commands/login.mts
|
|
329387
329397
|
init_cjs_shims();
|
|
329388
329398
|
import { Command as Command5, Flags as Flags7 } from "@oclif/core";
|
|
329389
|
-
var
|
|
329399
|
+
var import_util48 = __toESM(require_dist4(), 1);
|
|
329390
329400
|
var import_enquirer2 = __toESM(require_enquirer(), 1);
|
|
329391
329401
|
init_lodash();
|
|
329392
329402
|
var { prompt: prompt2 } = import_enquirer2.default;
|
|
@@ -329403,15 +329413,15 @@ var Login = class _Login extends Command5 {
|
|
|
329403
329413
|
async run() {
|
|
329404
329414
|
const { flags } = await this.parse(_Login);
|
|
329405
329415
|
let token2 = flags.token;
|
|
329406
|
-
const result = await (0,
|
|
329407
|
-
const
|
|
329416
|
+
const result = await (0, import_util48.getLocalTokenWithUrlIfExists)();
|
|
329417
|
+
const superblocksBaseUrl2 = result?.superblocksBaseUrl ?? this.DEFAULT_BASE_URL;
|
|
329408
329418
|
if (!token2) {
|
|
329409
329419
|
if (result && "token" in result) {
|
|
329410
329420
|
token2 = result.token;
|
|
329411
329421
|
} else {
|
|
329412
329422
|
const tokenPageUrl = new URL(
|
|
329413
329423
|
"personal-settings#apiKey",
|
|
329414
|
-
|
|
329424
|
+
superblocksBaseUrl2
|
|
329415
329425
|
).href;
|
|
329416
329426
|
token2 = (await prompt2({
|
|
329417
329427
|
type: "password",
|
|
@@ -329425,14 +329435,14 @@ var Login = class _Login extends Command5 {
|
|
|
329425
329435
|
try {
|
|
329426
329436
|
const sdk2 = new SuperblocksSdk(
|
|
329427
329437
|
token2,
|
|
329428
|
-
|
|
329438
|
+
superblocksBaseUrl2,
|
|
329429
329439
|
this.config.version
|
|
329430
329440
|
);
|
|
329431
329441
|
const user = await sdk2.fetchCurrentUser();
|
|
329432
|
-
await (0,
|
|
329442
|
+
await (0, import_util48.saveApiToken)(superblocksBaseUrl2, token2);
|
|
329433
329443
|
this.log(green(`Welcome to the Superblocks \u{1F428} CLI ${user.user.name}!`));
|
|
329434
329444
|
} catch (error) {
|
|
329435
|
-
if (error instanceof
|
|
329445
|
+
if (error instanceof import_util48.FileAccessError) {
|
|
329436
329446
|
this.log(
|
|
329437
329447
|
red(
|
|
329438
329448
|
"Could not save token, ensure the Superblocks CLI has access to create folders in your home directory."
|
|
@@ -329445,7 +329455,7 @@ var Login = class _Login extends Command5 {
|
|
|
329445
329455
|
}
|
|
329446
329456
|
this.log(
|
|
329447
329457
|
red(
|
|
329448
|
-
`Login failed. Ensure you've copied the correct token from ${
|
|
329458
|
+
`Login failed. Ensure you've copied the correct token from ${superblocksBaseUrl2}. If using a different domain, run "superblocks help config set" for configuration options.`
|
|
329449
329459
|
)
|
|
329450
329460
|
);
|
|
329451
329461
|
}
|
|
@@ -329457,7 +329467,7 @@ init_cjs_shims();
|
|
|
329457
329467
|
import { exec as exec7 } from "node:child_process";
|
|
329458
329468
|
import path39 from "node:path";
|
|
329459
329469
|
import util6 from "node:util";
|
|
329460
|
-
var
|
|
329470
|
+
var import_util49 = __toESM(require_dist4(), 1);
|
|
329461
329471
|
var import_fs_extra9 = __toESM(require_lib(), 1);
|
|
329462
329472
|
var import_semver7 = __toESM(require_semver2(), 1);
|
|
329463
329473
|
var Migrate = class extends AuthenticatedCommand {
|
|
@@ -329477,8 +329487,8 @@ var Migrate = class extends AuthenticatedCommand {
|
|
|
329477
329487
|
[
|
|
329478
329488
|
ctx.existingSuperblocksRootConfig,
|
|
329479
329489
|
ctx.superblocksRootConfigPath
|
|
329480
|
-
] = await (0,
|
|
329481
|
-
ctx.existingSuperblocksResourceConfig = await (0,
|
|
329490
|
+
] = await (0, import_util49.getSuperblocksMonorepoConfigJson)(true);
|
|
329491
|
+
ctx.existingSuperblocksResourceConfig = await (0, import_util49.getSuperblocksResourceConfigIfExists)();
|
|
329482
329492
|
} catch {
|
|
329483
329493
|
this.error(
|
|
329484
329494
|
`No Superblocks project found in the current folder hierarchy. Run ${cyan(
|
|
@@ -329681,7 +329691,7 @@ var Migrate = class extends AuthenticatedCommand {
|
|
|
329681
329691
|
init_cjs_shims();
|
|
329682
329692
|
import path40 from "node:path";
|
|
329683
329693
|
import { Args as Args4, Flags as Flags8 } from "@oclif/core";
|
|
329684
|
-
var
|
|
329694
|
+
var import_util50 = __toESM(require_dist4(), 1);
|
|
329685
329695
|
var Pull = class _Pull extends AuthenticatedCommand {
|
|
329686
329696
|
static description = "Download objects from Superblocks and save them locally";
|
|
329687
329697
|
static examples = [
|
|
@@ -329741,8 +329751,8 @@ var Pull = class _Pull extends AuthenticatedCommand {
|
|
|
329741
329751
|
[
|
|
329742
329752
|
ctx.existingSuperblocksRootConfig,
|
|
329743
329753
|
ctx.superblocksRootConfigPath
|
|
329744
|
-
] = await (0,
|
|
329745
|
-
ctx.existingSuperblocksResourceConfig = await (0,
|
|
329754
|
+
] = await (0, import_util50.getSuperblocksMonorepoConfigJson)(true);
|
|
329755
|
+
ctx.existingSuperblocksResourceConfig = await (0, import_util50.getSuperblocksResourceConfigIfExists)();
|
|
329746
329756
|
ctx.superblocksRootPath = path40.resolve(
|
|
329747
329757
|
path40.dirname(ctx.superblocksRootConfigPath),
|
|
329748
329758
|
".."
|
|
@@ -329783,7 +329793,7 @@ var Pull = class _Pull extends AuthenticatedCommand {
|
|
|
329783
329793
|
skipSigningVerification: true
|
|
329784
329794
|
});
|
|
329785
329795
|
} catch (error) {
|
|
329786
|
-
if (error instanceof
|
|
329796
|
+
if (error instanceof import_util50.NotFoundError) {
|
|
329787
329797
|
ctx.removedResourceIds.push(resourceId);
|
|
329788
329798
|
} else {
|
|
329789
329799
|
throw error;
|
|
@@ -329799,7 +329809,7 @@ var Pull = class _Pull extends AuthenticatedCommand {
|
|
|
329799
329809
|
skipSigningVerification: true
|
|
329800
329810
|
});
|
|
329801
329811
|
} catch (error) {
|
|
329802
|
-
if (error instanceof
|
|
329812
|
+
if (error instanceof import_util50.NotFoundError) {
|
|
329803
329813
|
ctx.removedResourceIds.push(resourceId);
|
|
329804
329814
|
} else {
|
|
329805
329815
|
throw error;
|
|
@@ -329874,7 +329884,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
329874
329884
|
const { branchName } = await this.validateGitSetup(
|
|
329875
329885
|
resource?.resourceType,
|
|
329876
329886
|
resourceId,
|
|
329877
|
-
|
|
329887
|
+
import_util50.ComponentEvent.PULL,
|
|
329878
329888
|
ctx.localBranchName
|
|
329879
329889
|
);
|
|
329880
329890
|
ctx.branchToPullFrom.set(resourceId, branchName);
|
|
@@ -329932,7 +329942,7 @@ ${error.message}.`
|
|
|
329932
329942
|
title: `Pulling application ${resource.location} from branch ${branchName}...`,
|
|
329933
329943
|
task: async (_ctx, task2) => {
|
|
329934
329944
|
const headers = {
|
|
329935
|
-
[
|
|
329945
|
+
[import_util50.COMPONENT_EVENT_HEADER]: import_util50.ComponentEvent.PULL
|
|
329936
329946
|
};
|
|
329937
329947
|
try {
|
|
329938
329948
|
task2.title += `: fetched`;
|
|
@@ -329967,7 +329977,7 @@ ${error.message}.`
|
|
|
329967
329977
|
}
|
|
329968
329978
|
task2.title += `: done`;
|
|
329969
329979
|
} catch (e) {
|
|
329970
|
-
if (e instanceof
|
|
329980
|
+
if (e instanceof import_util50.NotFoundError) {
|
|
329971
329981
|
task2.title += `: not found in this branch. skipped`;
|
|
329972
329982
|
} else {
|
|
329973
329983
|
throw e;
|
|
@@ -330037,7 +330047,7 @@ ${error.message}.`
|
|
|
330037
330047
|
`No resource found with the given location: ${resourcePath}`
|
|
330038
330048
|
);
|
|
330039
330049
|
}
|
|
330040
|
-
const resourceConfig = await (0,
|
|
330050
|
+
const resourceConfig = await (0, import_util50.getSuperblocksResourceConfigIfExists)();
|
|
330041
330051
|
if (resourceConfig) {
|
|
330042
330052
|
return [resourceConfig.id];
|
|
330043
330053
|
}
|
|
@@ -330079,7 +330089,7 @@ ${error.message}.`
|
|
|
330079
330089
|
init_cjs_shims();
|
|
330080
330090
|
import path41 from "node:path";
|
|
330081
330091
|
import { Args as Args5, Flags as Flags9 } from "@oclif/core";
|
|
330082
|
-
var
|
|
330092
|
+
var import_util51 = __toESM(require_dist4(), 1);
|
|
330083
330093
|
init_lodash();
|
|
330084
330094
|
var Push = class _Push extends AuthenticatedCommand {
|
|
330085
330095
|
static description = "Import objects from local filesystem to Superblocks";
|
|
@@ -330126,8 +330136,8 @@ var Push = class _Push extends AuthenticatedCommand {
|
|
|
330126
330136
|
[
|
|
330127
330137
|
ctx.existingSuperblocksRootConfig,
|
|
330128
330138
|
ctx.superblocksRootConfigPath
|
|
330129
|
-
] = await (0,
|
|
330130
|
-
ctx.existingSuperblocksResourceConfig = await (0,
|
|
330139
|
+
] = await (0, import_util51.getSuperblocksMonorepoConfigJson)(true);
|
|
330140
|
+
ctx.existingSuperblocksResourceConfig = await (0, import_util51.getSuperblocksResourceConfigIfExists)();
|
|
330131
330141
|
ctx.superblocksRootPath = path41.resolve(
|
|
330132
330142
|
path41.dirname(ctx.superblocksRootConfigPath),
|
|
330133
330143
|
".."
|
|
@@ -330198,7 +330208,7 @@ If resource is not connected to git repository, pass "main" as branch name.`
|
|
|
330198
330208
|
skipSigningVerification: true
|
|
330199
330209
|
});
|
|
330200
330210
|
} catch (error) {
|
|
330201
|
-
if (error instanceof
|
|
330211
|
+
if (error instanceof import_util51.NotFoundError) {
|
|
330202
330212
|
ctx.removedResourceIds.push(resourceId);
|
|
330203
330213
|
} else {
|
|
330204
330214
|
throw error;
|
|
@@ -330214,7 +330224,7 @@ If resource is not connected to git repository, pass "main" as branch name.`
|
|
|
330214
330224
|
skipSigningVerification: true
|
|
330215
330225
|
});
|
|
330216
330226
|
} catch (error) {
|
|
330217
|
-
if (error instanceof
|
|
330227
|
+
if (error instanceof import_util51.NotFoundError) {
|
|
330218
330228
|
ctx.removedResourceIds.push(resourceId);
|
|
330219
330229
|
} else {
|
|
330220
330230
|
throw error;
|
|
@@ -330293,7 +330303,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
330293
330303
|
const { branchName } = await this.validateGitSetup(
|
|
330294
330304
|
resource?.resourceType,
|
|
330295
330305
|
resourceId,
|
|
330296
|
-
|
|
330306
|
+
import_util51.ComponentEvent.PUSH,
|
|
330297
330307
|
ctx.localBranchName
|
|
330298
330308
|
);
|
|
330299
330309
|
ctx.branchToPushTo.set(resourceId, branchName);
|
|
@@ -330383,7 +330393,7 @@ ${error.message}.`
|
|
|
330383
330393
|
task: async (_ctx, task2) => {
|
|
330384
330394
|
let configType;
|
|
330385
330395
|
try {
|
|
330386
|
-
const applicationConfig2 = await (0,
|
|
330396
|
+
const applicationConfig2 = await (0, import_util51.getSuperblocksApplicationV2ConfigJson)(
|
|
330387
330397
|
path41.join(superblocksRootPath, resource.location)
|
|
330388
330398
|
);
|
|
330389
330399
|
configType = applicationConfig2.configType;
|
|
@@ -330552,7 +330562,7 @@ ${error.message}.`
|
|
|
330552
330562
|
`No resource found with the given location: ${resourcePath}`
|
|
330553
330563
|
);
|
|
330554
330564
|
}
|
|
330555
|
-
const resourceConfig = await (0,
|
|
330565
|
+
const resourceConfig = await (0, import_util51.getSuperblocksResourceConfigIfExists)();
|
|
330556
330566
|
if (resourceConfig) {
|
|
330557
330567
|
return [resourceConfig.id];
|
|
330558
330568
|
}
|
|
@@ -330590,7 +330600,7 @@ ${error.message}.`
|
|
|
330590
330600
|
init_cjs_shims();
|
|
330591
330601
|
import path43 from "path";
|
|
330592
330602
|
import { Args as Args6 } from "@oclif/core";
|
|
330593
|
-
var
|
|
330603
|
+
var import_util52 = __toESM(require_dist4(), 1);
|
|
330594
330604
|
var import_fs_extra10 = __toESM(require_lib(), 1);
|
|
330595
330605
|
init_lodash();
|
|
330596
330606
|
var Remove = class _Remove extends AuthenticatedCommand {
|
|
@@ -330625,7 +330635,7 @@ var Remove = class _Remove extends AuthenticatedCommand {
|
|
|
330625
330635
|
[
|
|
330626
330636
|
ctx.existingSuperblocksRootConfig,
|
|
330627
330637
|
ctx.superblocksRootConfigPath
|
|
330628
|
-
] = await (0,
|
|
330638
|
+
] = await (0, import_util52.getSuperblocksMonorepoConfigJson)(true);
|
|
330629
330639
|
ctx.superblocksRootPath = path43.resolve(
|
|
330630
330640
|
path43.dirname(ctx.superblocksRootConfigPath),
|
|
330631
330641
|
".."
|
|
@@ -330712,7 +330722,7 @@ var Remove = class _Remove extends AuthenticatedCommand {
|
|
|
330712
330722
|
{
|
|
330713
330723
|
title: "Updating Superblocks project file...",
|
|
330714
330724
|
task: async (ctx) => {
|
|
330715
|
-
const [superblocksRootConfig, rootConfigPath] = await (0,
|
|
330725
|
+
const [superblocksRootConfig, rootConfigPath] = await (0, import_util52.getSuperblocksMonorepoConfigJson)(true);
|
|
330716
330726
|
for (const removedResourceId of ctx.removedResourceIds) {
|
|
330717
330727
|
delete superblocksRootConfig.resources[removedResourceId];
|
|
330718
330728
|
}
|
|
@@ -330815,7 +330825,7 @@ function getResourceIdFromLocation(ctx, resourceLocation) {
|
|
|
330815
330825
|
init_cjs_shims();
|
|
330816
330826
|
import path44 from "node:path";
|
|
330817
330827
|
import { Args as Args7, Flags as Flags10 } from "@oclif/core";
|
|
330818
|
-
var
|
|
330828
|
+
var import_util53 = __toESM(require_dist4(), 1);
|
|
330819
330829
|
init_lodash();
|
|
330820
330830
|
var Upload3 = class _Upload extends AuthenticatedCommand {
|
|
330821
330831
|
static description = "Upload your local files to Superblocks live edit";
|
|
@@ -330852,8 +330862,8 @@ var Upload3 = class _Upload extends AuthenticatedCommand {
|
|
|
330852
330862
|
[
|
|
330853
330863
|
ctx.existingSuperblocksRootConfig,
|
|
330854
330864
|
ctx.superblocksRootConfigPath
|
|
330855
|
-
] = await (0,
|
|
330856
|
-
ctx.existingSuperblocksResourceConfig = await (0,
|
|
330865
|
+
] = await (0, import_util53.getSuperblocksMonorepoConfigJson)(true);
|
|
330866
|
+
ctx.existingSuperblocksResourceConfig = await (0, import_util53.getSuperblocksResourceConfigIfExists)();
|
|
330857
330867
|
ctx.superblocksRootPath = path44.resolve(
|
|
330858
330868
|
path44.dirname(ctx.superblocksRootConfigPath),
|
|
330859
330869
|
".."
|
|
@@ -330888,7 +330898,7 @@ var Upload3 = class _Upload extends AuthenticatedCommand {
|
|
|
330888
330898
|
skipSigningVerification: true
|
|
330889
330899
|
});
|
|
330890
330900
|
} catch (error) {
|
|
330891
|
-
if (error instanceof
|
|
330901
|
+
if (error instanceof import_util53.NotFoundError) {
|
|
330892
330902
|
ctx.removedResourceIds.push(resourceId);
|
|
330893
330903
|
} else {
|
|
330894
330904
|
throw error;
|
|
@@ -330904,7 +330914,7 @@ var Upload3 = class _Upload extends AuthenticatedCommand {
|
|
|
330904
330914
|
skipSigningVerification: true
|
|
330905
330915
|
});
|
|
330906
330916
|
} catch (error) {
|
|
330907
|
-
if (error instanceof
|
|
330917
|
+
if (error instanceof import_util53.NotFoundError) {
|
|
330908
330918
|
ctx.removedResourceIds.push(resourceId);
|
|
330909
330919
|
} else {
|
|
330910
330920
|
throw error;
|
|
@@ -331011,7 +331021,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
331011
331021
|
title: `Uploading application ${resource.location}...`,
|
|
331012
331022
|
task: async (_ctx, task2) => {
|
|
331013
331023
|
try {
|
|
331014
|
-
await (0,
|
|
331024
|
+
await (0, import_util53.getSuperblocksApplicationV2ConfigJson)(
|
|
331015
331025
|
path44.join(superblocksRootPath, resource.location)
|
|
331016
331026
|
);
|
|
331017
331027
|
} catch {
|
|
@@ -331074,7 +331084,7 @@ Would you like to also delete these resources from your filesystem?`
|
|
|
331074
331084
|
`No resource found with the given location: ${resourcePath}`
|
|
331075
331085
|
);
|
|
331076
331086
|
}
|
|
331077
|
-
const resourceConfig = await (0,
|
|
331087
|
+
const resourceConfig = await (0, import_util53.getSuperblocksResourceConfigIfExists)();
|
|
331078
331088
|
if (resourceConfig) {
|
|
331079
331089
|
return [resourceConfig.id];
|
|
331080
331090
|
}
|