@superblocksteam/cli 2.0.0 → 2.0.1-next.1

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/index.js CHANGED
@@ -292269,6 +292269,8 @@ var AppShell = class {
292269
292269
  "--incremental",
292270
292270
  // expected format
292271
292271
  "--pretty false",
292272
+ // allow any
292273
+ "--noImplicitAny false",
292272
292274
  // cache in separate file to avoid conflicts with vite or user ide
292273
292275
  "--tsBuildInfoFile .superblocks/app.tsbuildinfo"
292274
292276
  ].join(" "), {
@@ -293033,7 +293035,7 @@ init_cjs_shims();
293033
293035
  init_cjs_shims();
293034
293036
  var generated = {};
293035
293037
  try {
293036
- generated = await import("./generated-2MZXCAFV.js");
293038
+ generated = await import("./generated-B26UL5I4.js");
293037
293039
  } catch (_error) {
293038
293040
  getLogger().warn("[ai-service] Generated markdown modules not found. Run `pnpm generate:markdown` first.");
293039
293041
  }
@@ -300645,11 +300647,13 @@ var doRuntimeReviewing = (clark, params) => {
300645
300647
  ...context2,
300646
300648
  hasSuggestions: context2.hasSuggestions || files.length > 0
300647
300649
  }));
300648
- void sendUserMessage({
300649
- type: "text",
300650
- group: "agent-qa",
300651
- text: "Great, I'll confirm this app works as expected."
300652
- });
300650
+ if (!clark.context.usedDebugging) {
300651
+ void sendUserMessage({
300652
+ type: "text",
300653
+ group: "agent-qa",
300654
+ text: "Great, I'll confirm this app works as expected."
300655
+ });
300656
+ }
300653
300657
  void sendUserMessage({
300654
300658
  type: "control",
300655
300659
  group: "agent-qa/user-flows",
@@ -301013,15 +301017,6 @@ var makeServerError = (error, { critical = "critical" in error ? error.critical
301013
301017
  critical
301014
301018
  };
301015
301019
  };
301016
- var makeDegradedModeError = (errMsg) => {
301017
- return {
301018
- type: "server/error",
301019
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
301020
- message: errMsg,
301021
- name: "DegradedModeError",
301022
- critical: true
301023
- };
301024
- };
301025
301020
 
301026
301021
  // ../../../vite-plugin-file-sync/dist/util/with-resolvers.js
301027
301022
  init_cjs_shims();
@@ -302453,8 +302448,8 @@ var SyncService = class extends EventEmitter4 {
302453
302448
  const errMsg = "There is an issue with the application and it was put in degraded mode: " + degradedMode.errors.map((e) => e.message).join("\n");
302454
302449
  const logger3 = getLogger();
302455
302450
  logger3.error("[sync-service] " + errMsg);
302456
- this.emit("error", makeDegradedModeError(errMsg));
302457
302451
  }
302452
+ this.emit("degradedModeChange", degradedMode);
302458
302453
  this.lastSyncedGenerationNumber = generationNumber;
302459
302454
  this.synchronizationStatus = SyncronizationStatus.IN_SYNC;
302460
302455
  return directorySnapshot.hash;
@@ -308088,13 +308083,13 @@ var ComponentsManager = class _ComponentsManager extends EventEmitter6 {
308088
308083
  init_cjs_shims();
308089
308084
  var import_core3 = __toESM(require_lib33(), 1);
308090
308085
  var import_types25 = __toESM(require_lib7(), 1);
308091
- import fs13 from "fs/promises";
308086
+ import fs12 from "fs/promises";
308092
308087
  import EventEmitter8 from "node:events";
308093
- import path27 from "node:path";
308088
+ import path26 from "node:path";
308094
308089
  var import_shared29 = __toESM(require_dist2(), 1);
308095
308090
  var import_util23 = __toESM(require_dist3(), 1);
308096
308091
  init_lodash();
308097
- var import_yaml3 = __toESM(require_dist(), 1);
308092
+ var import_yaml2 = __toESM(require_dist(), 1);
308098
308093
 
308099
308094
  // ../../../vite-plugin-file-sync/dist/codegen.js
308100
308095
  init_cjs_shims();
@@ -312542,112 +312537,6 @@ var SourceTracker = class {
312542
312537
  };
312543
312538
  };
312544
312539
 
312545
- // ../../../vite-plugin-file-sync/dist/util.js
312546
- init_cjs_shims();
312547
- var import_yaml2 = __toESM(require_dist(), 1);
312548
- import fs12 from "node:fs/promises";
312549
- import path26 from "node:path";
312550
- async function getAllPages({ rootDir }) {
312551
- try {
312552
- const routesJson = await fs12.readFile(path26.join(rootDir, "routes.json"), "utf8");
312553
- const routes = JSON.parse(routesJson);
312554
- const pages = await Promise.all(Object.entries(routes).map(async ([routePath, { file: pagePath }]) => {
312555
- const contents = await fs12.readFile(path26.join(rootDir, "pages", pagePath), "utf8");
312556
- return {
312557
- name: pagePath.split("/")[0] ?? "page name not found",
312558
- contents,
312559
- route: routePath,
312560
- fileName: path26.join(rootDir, "pages", pagePath)
312561
- };
312562
- }));
312563
- return pages;
312564
- } catch (e) {
312565
- getLogger().error("Error getting pages path for route", getErrorMeta(e));
312566
- return [];
312567
- }
312568
- }
312569
- async function getAllApiDefinitions({ rootDir, currentUrl }) {
312570
- const logger3 = getLogger();
312571
- try {
312572
- const routesJson = await fs12.readFile(path26.join(rootDir, "routes.json"), "utf8");
312573
- const routes = JSON.parse(routesJson);
312574
- const pathname = new URL(currentUrl).pathname;
312575
- const fileName = Object.entries(routes).find(([path53]) => {
312576
- const routeRegex = new RegExp("^" + path53.replaceAll(/:[^/]+/g, "([^/]+)") + "$");
312577
- return routeRegex.test(pathname);
312578
- })?.[1];
312579
- if (!fileName) {
312580
- throw new Error(`Route match not found for ${currentUrl}`);
312581
- }
312582
- const apisDir = path26.join(rootDir, "pages", path26.dirname(fileName), "apis");
312583
- const objs = await fs12.readdir(apisDir);
312584
- logger3.info(`objs ${JSON.stringify(objs)}`);
312585
- const apiDefinitions = [];
312586
- for (const obj of objs) {
312587
- const stat4 = await fs12.stat(path26.join(apisDir, obj));
312588
- if (stat4.isFile() && obj.endsWith(".yaml")) {
312589
- const contents = await fs12.readFile(path26.join(apisDir, obj), "utf8");
312590
- const yamlContents = await import_yaml2.default.parse(contents);
312591
- const apiName = yamlContents.metadata.name;
312592
- apiDefinitions.push({
312593
- name: apiName,
312594
- fileName: obj,
312595
- contents: yamlContents
312596
- });
312597
- } else if (stat4.isDirectory()) {
312598
- const apiYamlPath = path26.join(apisDir, obj, "api.yaml");
312599
- const apiYamlStat = await fs12.stat(apiYamlPath);
312600
- if (apiYamlStat.isFile()) {
312601
- const contents = await fs12.readFile(apiYamlPath, "utf8");
312602
- const yamlContents = await import_yaml2.default.parse(contents);
312603
- const apiName = yamlContents.metadata.name;
312604
- apiDefinitions.push({
312605
- name: apiName,
312606
- fileName: path26.join(apisDir, obj, "api.yaml"),
312607
- contents: yamlContents
312608
- });
312609
- }
312610
- }
312611
- }
312612
- return apiDefinitions;
312613
- } catch (e) {
312614
- logger3.error("Error getting api definitions", getErrorMeta(e));
312615
- return [];
312616
- }
312617
- }
312618
- var isValidApi = (api) => {
312619
- const logger3 = getLogger();
312620
- const isValidStep = (step) => {
312621
- const isValidStep2 = !!step && step.integration && (step.integration !== "javascript" && step.integration !== "python" || step.integration === "javascript" && typeof step.javascript?.body === "string" || step.integration === "python" && typeof step.python?.body === "string");
312622
- if (!isValidStep2) {
312623
- logger3.warn(`API ${api.metadata.name} file incomplete: invalid step`);
312624
- }
312625
- return isValidStep2;
312626
- };
312627
- const isValidBlock = (block) => {
312628
- const isValidBlock2 = !!block && block.name && isValidStep(block.step);
312629
- if (!isValidBlock2) {
312630
- logger3.warn(`API ${api.metadata.name} file incomplete: invalid block`);
312631
- }
312632
- return isValidBlock2;
312633
- };
312634
- const isValidMetadata = (metadata) => {
312635
- const isValidMetadata2 = metadata.name && metadata.organization;
312636
- if (!isValidMetadata2) {
312637
- logger3.warn(`API ${api.metadata.name} file incomplete: invalid metadata`);
312638
- }
312639
- return isValidMetadata2;
312640
- };
312641
- const isValidTrigger = (trigger) => {
312642
- const isValidTrigger2 = trigger && trigger.application && trigger.application.id;
312643
- if (!isValidTrigger2) {
312644
- logger3.warn(`API ${api.metadata.name} file incomplete: invalid trigger`);
312645
- }
312646
- return isValidTrigger2;
312647
- };
312648
- return api && isValidMetadata(api.metadata) && isValidTrigger(api.trigger) && (api.blocks?.length === 0 || api.blocks?.every(isValidBlock));
312649
- };
312650
-
312651
312540
  // ../../../vite-plugin-file-sync/dist/file-system-manager.js
312652
312541
  var SUPPORTED_FILETYPES = [
312653
312542
  {
@@ -312731,7 +312620,7 @@ var FileSyncManager = class extends EventEmitter8 {
312731
312620
  if (!this.rootDir) {
312732
312621
  throw new Error("Root directory not set");
312733
312622
  }
312734
- return path27.join(this.rootDir, "App.tsx");
312623
+ return path26.join(this.rootDir, "App.tsx");
312735
312624
  }
312736
312625
  updateApi = (content2, path53) => {
312737
312626
  if (!this.rootDir) {
@@ -312745,7 +312634,7 @@ var FileSyncManager = class extends EventEmitter8 {
312745
312634
  scopeId = "";
312746
312635
  }
312747
312636
  const updatedApi = {
312748
- apiPb: import_yaml3.default.parse(JSON.stringify(apiContents)),
312637
+ apiPb: import_yaml2.default.parse(JSON.stringify(apiContents)),
312749
312638
  pageName,
312750
312639
  stepPathMap,
312751
312640
  scopeId
@@ -312758,11 +312647,11 @@ var FileSyncManager = class extends EventEmitter8 {
312758
312647
  const logger3 = getLogger();
312759
312648
  this.rootDir = rootPath;
312760
312649
  this.watcher = watcher;
312761
- const fileNames = await readFiles(path27.join(rootPath));
312650
+ const fileNames = await readFiles(path26.join(rootPath));
312762
312651
  const tsxFiles = fileNames.filter((f) => f.endsWith(".tsx") && !f.includes(`${getLegacyComponentsFolder()}/`));
312763
312652
  const yamlFiles = fileNames.filter((f) => f.endsWith(".yaml"));
312764
312653
  const scopeFiles = fileNames.filter((f) => f.endsWith(SCOPE_FILE));
312765
- const appThemeFile = path27.join(rootPath, APP_THEME_FILE_NAME);
312654
+ const appThemeFile = path26.join(rootPath, APP_THEME_FILE_NAME);
312766
312655
  logger3.info(`files to be scanned ${JSON.stringify(tsxFiles)}`);
312767
312656
  logger3.info(`api files to be scanned ${JSON.stringify(yamlFiles)}`);
312768
312657
  logger3.info(`app theme file to be scanned ${JSON.stringify(appThemeFile)}`);
@@ -312809,7 +312698,7 @@ var FileSyncManager = class extends EventEmitter8 {
312809
312698
  this.tsFiles[path53] = content2;
312810
312699
  }
312811
312700
  });
312812
- const routePath = path27.join(rootPath, ROUTES_FILE);
312701
+ const routePath = path26.join(rootPath, ROUTES_FILE);
312813
312702
  const routeFile = await readFile6(routePath);
312814
312703
  if (routeFile) {
312815
312704
  try {
@@ -312970,11 +312859,11 @@ var FileSyncManager = class extends EventEmitter8 {
312970
312859
  if (kind === "ts") {
312971
312860
  this.tsFiles[path53] = content2;
312972
312861
  await this.fsOperationQueue.enqueue(async () => {
312973
- await fs13.writeFile(path53, content2);
312862
+ await fs12.writeFile(path53, content2);
312974
312863
  });
312975
312864
  } else if (kind === "api") {
312976
312865
  const currentApiFile = this.apiFiles[path53];
312977
- const apiPb = import_yaml3.default.parse(content2);
312866
+ const apiPb = import_yaml2.default.parse(content2);
312978
312867
  if (apiPb.metadata.id) {
312979
312868
  delete apiPb.metadata.id;
312980
312869
  }
@@ -313140,7 +313029,7 @@ var FileSyncManager = class extends EventEmitter8 {
313140
313029
  throw new Error("Root directory not set");
313141
313030
  }
313142
313031
  const pagePath = getPageFolder(this.rootDir, name18);
313143
- const pageIndexPath = path27.join(pagePath, "index.tsx");
313032
+ const pageIndexPath = path26.join(pagePath, "index.tsx");
313144
313033
  const pageContent = (
313145
313034
  /*js*/
313146
313035
  `import { SbPage, SbContainer, registerPage } from "@superblocksteam/library";
@@ -313153,7 +313042,7 @@ function Page() {
313153
313042
  export default registerPage(Page, { name: "${name18}" });
313154
313043
  `
313155
313044
  );
313156
- await fs13.mkdir(pagePath, { recursive: true });
313045
+ await fs12.mkdir(pagePath, { recursive: true });
313157
313046
  await this.writeFile(pageIndexPath, pageContent, "ts");
313158
313047
  await this.handleNonVisualChangeByDeletingIds(pageIndexPath, pageContent);
313159
313048
  this.emit("addPage", pageIndexPath);
@@ -313295,18 +313184,18 @@ export default registerPage(Page, { name: "${name18}" });
313295
313184
  if (!apiName) {
313296
313185
  throw new Error("API name is not set");
313297
313186
  }
313298
- const apiDir = path27.join(this.rootDir, "pages", api.pageName, "apis", apiName);
313299
- const apiPath = path27.join(apiDir, "api.yaml");
313187
+ const apiDir = path26.join(this.rootDir, "pages", api.pageName, "apis", apiName);
313188
+ const apiPath = path26.join(apiDir, "api.yaml");
313300
313189
  const isNewApi = !this.getApiFiles()[apiPath];
313301
313190
  try {
313302
- const stats = await fs13.stat(apiDir);
313191
+ const stats = await fs12.stat(apiDir);
313303
313192
  if (!stats.isDirectory()) {
313304
- await fs13.mkdir(apiDir, { recursive: true });
313193
+ await fs12.mkdir(apiDir, { recursive: true });
313305
313194
  }
313306
313195
  } catch {
313307
- await fs13.mkdir(apiDir, { recursive: true });
313196
+ await fs12.mkdir(apiDir, { recursive: true });
313308
313197
  }
313309
- await this.writeFile(apiPath, import_yaml3.default.stringify(api.apiPb), "api");
313198
+ await this.writeFile(apiPath, import_yaml2.default.stringify(api.apiPb), "api");
313310
313199
  const generationNumber = this.generationNumberSequence.next();
313311
313200
  const apiDef = this.createClientApi(api);
313312
313201
  let scopeId = "";
@@ -313342,16 +313231,16 @@ export default registerPage(Page, { name: "${name18}" });
313342
313231
  return new Promise(
313343
313232
  // eslint-disable-next-line no-async-promise-executor
313344
313233
  async (resolve8) => {
313345
- const apiFilePath = path27.join(rootDir, "pages", pageName, "apis", apiName, "api.yaml");
313234
+ const apiFilePath = path26.join(rootDir, "pages", pageName, "apis", apiName, "api.yaml");
313346
313235
  const api = this.apiFiles[apiFilePath];
313347
313236
  if (!api || !this.sourceTracker) {
313348
313237
  return resolve8(void 0);
313349
313238
  }
313350
- const apiDir = path27.join(rootDir, "pages", pageName, "apis", apiName);
313239
+ const apiDir = path26.join(rootDir, "pages", pageName, "apis", apiName);
313351
313240
  try {
313352
- const stats = await fs13.stat(apiDir);
313241
+ const stats = await fs12.stat(apiDir);
313353
313242
  if (stats.isDirectory()) {
313354
- await fs13.rmdir(apiDir, { recursive: true });
313243
+ await fs12.rmdir(apiDir, { recursive: true });
313355
313244
  }
313356
313245
  delete this.apiFiles[apiFilePath];
313357
313246
  const scopeId = await this.sourceTracker.deleteApi({
@@ -313385,14 +313274,14 @@ export default registerPage(Page, { name: "${name18}" });
313385
313274
  throw new Error("Root directory not set");
313386
313275
  }
313387
313276
  const pagePath = getPageFolder(this.rootDir, pageName);
313388
- const existingApiFolder = path27.join(this.rootDir, "pages", pageName, "apis", oldName);
313389
- const newApiFolder = path27.join(this.rootDir, "pages", pageName, "apis", newName);
313277
+ const existingApiFolder = path26.join(this.rootDir, "pages", pageName, "apis", oldName);
313278
+ const newApiFolder = path26.join(this.rootDir, "pages", pageName, "apis", newName);
313390
313279
  const files = this.sourceTracker?.getCurrentFiles();
313391
- const file = files?.[path27.join(pagePath, "index.tsx")];
313280
+ const file = files?.[path26.join(pagePath, "index.tsx")];
313392
313281
  if (!file || !file.ast) {
313393
313282
  throw new Error(`Page ${pageName} not found`);
313394
313283
  }
313395
- const apiFilePath = path27.join(existingApiFolder, "api.yaml");
313284
+ const apiFilePath = path26.join(existingApiFolder, "api.yaml");
313396
313285
  const apiDef = this.apiFiles[apiFilePath];
313397
313286
  if (!apiDef) {
313398
313287
  throw new Error(`API ${oldName} not found`);
@@ -313401,14 +313290,14 @@ export default registerPage(Page, { name: "${name18}" });
313401
313290
  api: { apiPb: this.apiFiles[path53]?.apiPb },
313402
313291
  filePath: path53
313403
313292
  })).filter((api) => !!api.api));
313404
- const newApiFolderExists = await fs13.stat(newApiFolder).catch(() => false);
313293
+ const newApiFolderExists = await fs12.stat(newApiFolder).catch(() => false);
313405
313294
  if (newApiFolderExists) {
313406
313295
  throw new Error(`API ${newName} already exists`);
313407
313296
  }
313408
313297
  this.watcher?.unwatch(existingApiFolder);
313409
313298
  this.watcher?.unwatch(newApiFolder);
313410
313299
  apiDef.apiPb.metadata.name = newName;
313411
- await fs13.rename(existingApiFolder, newApiFolder);
313300
+ await fs12.rename(existingApiFolder, newApiFolder);
313412
313301
  const scopeDef = this.sourceTracker?.getScopeDefinitionForPage(pageName);
313413
313302
  if (!scopeDef) {
313414
313303
  throw new Error(`Scope definition not found for API`);
@@ -313419,7 +313308,7 @@ export default registerPage(Page, { name: "${name18}" });
313419
313308
  entityId: scopeDef.scopeNameToEntityId[oldName]
313420
313309
  });
313421
313310
  delete this.apiFiles[apiFilePath];
313422
- this.writeFile(path27.join(newApiFolder, "api.yaml"), import_yaml3.default.stringify(apiDef.apiPb), "api");
313311
+ this.writeFile(path26.join(newApiFolder, "api.yaml"), import_yaml2.default.stringify(apiDef.apiPb), "api");
313423
313312
  this.watcher?.add(existingApiFolder);
313424
313313
  this.watcher?.add(newApiFolder);
313425
313314
  const changes = await this.sourceTracker?.getAndFlushChanges() ?? [];
@@ -313439,7 +313328,7 @@ export default registerPage(Page, { name: "${name18}" });
313439
313328
  if (isEqual_default(api?.apiPb, this.apiFiles[filePath]?.apiPb)) {
313440
313329
  return Promise.resolve();
313441
313330
  }
313442
- await this.writeFile(filePath, import_yaml3.default.stringify(api?.apiPb), "api");
313331
+ await this.writeFile(filePath, import_yaml2.default.stringify(api?.apiPb), "api");
313443
313332
  this.emit("apiManualUpdate", {
313444
313333
  api: this.createClientApi(api),
313445
313334
  pageName,
@@ -313487,7 +313376,7 @@ export default registerPage(Page, { name: "${name18}" });
313487
313376
  if (!this.rootDir) {
313488
313377
  throw new Error("Root directory not set");
313489
313378
  }
313490
- const filePath = path27.join(this.rootDir, APP_THEME_FILE_NAME);
313379
+ const filePath = path26.join(this.rootDir, APP_THEME_FILE_NAME);
313491
313380
  await this.sourceTracker?.updateTheme({
313492
313381
  themeFilePath: filePath,
313493
313382
  theme
@@ -313542,8 +313431,8 @@ export default registerPage(Page, { name: "${name18}" });
313542
313431
  throw new Error("Root directory not set");
313543
313432
  }
313544
313433
  const newPageFolder = getPageFolder(this.rootDir, newName);
313545
- const newIndexFilePath = path27.join(newPageFolder, "index.tsx");
313546
- const oldIndexFilePath = path27.join(this.rootDir, "pages", oldName, "index.tsx");
313434
+ const newIndexFilePath = path26.join(newPageFolder, "index.tsx");
313435
+ const oldIndexFilePath = path26.join(this.rootDir, "pages", oldName, "index.tsx");
313547
313436
  const oldPageFolder = getPageFolder(this.rootDir, oldName);
313548
313437
  this.watcher?.unwatch(newPageFolder);
313549
313438
  this.watcher?.unwatch(oldPageFolder);
@@ -313557,7 +313446,7 @@ export default registerPage(Page, { name: "${name18}" });
313557
313446
  });
313558
313447
  const changes = await this.sourceTracker?.getAndFlushChanges() ?? [];
313559
313448
  await this.writeChanges(changes);
313560
- await fs13.rename(oldPageFolder, newPageFolder);
313449
+ await fs12.rename(oldPageFolder, newPageFolder);
313561
313450
  await this.removeRoute(oldIndexFilePath);
313562
313451
  await this.addRoute(existingRoute, newIndexFilePath);
313563
313452
  const newIndexFile = await readFile6(newIndexFilePath);
@@ -313571,7 +313460,7 @@ export default registerPage(Page, { name: "${name18}" });
313571
313460
  this.watcher?.add(oldPageFolder);
313572
313461
  };
313573
313462
  getPageRoots(filePath) {
313574
- const scopeFilePath = path27.join(path27.dirname(filePath), "index.tsx");
313463
+ const scopeFilePath = path26.join(path26.dirname(filePath), "index.tsx");
313575
313464
  const currentFile = this.sourceTracker?.getCurrentFiles()[scopeFilePath];
313576
313465
  if (!currentFile) {
313577
313466
  return null;
@@ -313579,7 +313468,7 @@ export default registerPage(Page, { name: "${name18}" });
313579
313468
  return getPageRoots(filePath, currentFile);
313580
313469
  }
313581
313470
  getScope(filePath) {
313582
- const scopeFilePath = path27.join(path27.dirname(filePath), SCOPE_FILE);
313471
+ const scopeFilePath = path26.join(path26.dirname(filePath), SCOPE_FILE);
313583
313472
  const currentFile = this.sourceTracker?.getCurrentFiles()[scopeFilePath];
313584
313473
  if (!currentFile) {
313585
313474
  console.log("File not found", scopeFilePath);
@@ -313603,7 +313492,7 @@ export default registerPage(Page, { name: "${name18}" });
313603
313492
  throw new Error("Root directory not set");
313604
313493
  }
313605
313494
  this.routes[route] = { file: this.getRelativeRoutePath(filePath) };
313606
- await this.writeFile(path27.join(this.rootDir, ROUTES_FILE), JSON.stringify(this.routes, null, 2));
313495
+ await this.writeFile(path26.join(this.rootDir, ROUTES_FILE), JSON.stringify(this.routes, null, 2));
313607
313496
  }
313608
313497
  async removeRoute(filePath) {
313609
313498
  if (!this.rootDir) {
@@ -313611,7 +313500,7 @@ export default registerPage(Page, { name: "${name18}" });
313611
313500
  }
313612
313501
  const relativeFilePath = this.getRelativeRoutePath(filePath);
313613
313502
  this.routes = Object.fromEntries(Object.entries(this.routes).filter(([_, value2]) => value2.file !== relativeFilePath));
313614
- await this.writeFile(path27.join(this.rootDir, ROUTES_FILE), JSON.stringify(this.routes, null, 2));
313503
+ await this.writeFile(path26.join(this.rootDir, ROUTES_FILE), JSON.stringify(this.routes, null, 2));
313615
313504
  }
313616
313505
  async writeChanges(changes, callback) {
313617
313506
  return Promise.all(changes.map(async ({ fileName, source: source2, kind }) => {
@@ -313641,7 +313530,7 @@ export default registerPage(Page, { name: "${name18}" });
313641
313530
  if (isEqual_default(api?.apiPb, this.apiFiles[filePath]?.apiPb)) {
313642
313531
  return Promise.resolve();
313643
313532
  }
313644
- return this.writeFile(filePath, import_yaml3.default.stringify(api?.apiPb), "api");
313533
+ return this.writeFile(filePath, import_yaml2.default.stringify(api?.apiPb), "api");
313645
313534
  }));
313646
313535
  };
313647
313536
  getApisInScope = (elementId) => {
@@ -313649,14 +313538,14 @@ export default registerPage(Page, { name: "${name18}" });
313649
313538
  if (!filePath) {
313650
313539
  return [];
313651
313540
  }
313652
- const pagePath = path27.dirname(filePath);
313541
+ const pagePath = path26.dirname(filePath);
313653
313542
  return Object.entries(this.apiFiles).filter(([filePath2]) => filePath2.includes(pagePath)).map(([filePath2, api]) => ({ api, filePath: filePath2 }));
313654
313543
  };
313655
313544
  getRelativeRoutePath(filePath) {
313656
313545
  if (!this.rootDir) {
313657
313546
  throw new Error("Root directory not set");
313658
313547
  }
313659
- return path27.relative(path27.join(this.rootDir, PAGES_DIRECTORY), filePath);
313548
+ return path26.relative(path26.join(this.rootDir, PAGES_DIRECTORY), filePath);
313660
313549
  }
313661
313550
  // Utilities for converting server API format to Client API format
313662
313551
  // We internally save the API as the server does, but we return should always return it
@@ -313689,15 +313578,12 @@ export default registerPage(Page, { name: "${name18}" });
313689
313578
  let yamlPath = filePath;
313690
313579
  if (fileType.type === "python-api-step" || fileType.type === "js-api-step") {
313691
313580
  const apiFolderPath = filePath.split("/").slice(0, -1).join("/");
313692
- yamlPath = path27.join(apiFolderPath, "api.yaml");
313581
+ yamlPath = path26.join(apiFolderPath, "api.yaml");
313693
313582
  }
313694
313583
  const logger3 = getLogger();
313695
313584
  try {
313696
313585
  const apiContent = await getMergedApiContent(yamlPath);
313697
313586
  logger3.info(`API content read successfully: ${yamlPath}`);
313698
- if (!isValidApi(apiContent.api)) {
313699
- return;
313700
- }
313701
313587
  if (!apiContent) {
313702
313588
  return;
313703
313589
  }
@@ -313732,7 +313618,7 @@ export default registerPage(Page, { name: "${name18}" });
313732
313618
  };
313733
313619
  async function readFile6(path53) {
313734
313620
  try {
313735
- const content2 = await fs13.readFile(path53, "utf-8");
313621
+ const content2 = await fs12.readFile(path53, "utf-8");
313736
313622
  return content2;
313737
313623
  } catch (e) {
313738
313624
  getLogger().error(`error reading file: ${path53}`, getErrorMeta(e));
@@ -313740,7 +313626,7 @@ async function readFile6(path53) {
313740
313626
  }
313741
313627
  }
313742
313628
  async function readFiles(dir) {
313743
- return await glob2(path27.join(dir, "**/*.{tsx,yaml,ts}"), {
313629
+ return await glob2(path26.join(dir, "**/*.{tsx,yaml,ts}"), {
313744
313630
  ignore: [
313745
313631
  "node_modules/**",
313746
313632
  "dist/**",
@@ -314129,6 +314015,80 @@ var GenerationNumberSequence = class {
314129
314015
  }
314130
314016
  };
314131
314017
 
314018
+ // ../../../vite-plugin-file-sync/dist/util.js
314019
+ init_cjs_shims();
314020
+ var import_yaml3 = __toESM(require_dist(), 1);
314021
+ import fs13 from "node:fs/promises";
314022
+ import path27 from "node:path";
314023
+ async function getAllPages({ rootDir }) {
314024
+ try {
314025
+ const routesJson = await fs13.readFile(path27.join(rootDir, "routes.json"), "utf8");
314026
+ const routes = JSON.parse(routesJson);
314027
+ const pages = await Promise.all(Object.entries(routes).map(async ([routePath, { file: pagePath }]) => {
314028
+ const contents = await fs13.readFile(path27.join(rootDir, "pages", pagePath), "utf8");
314029
+ return {
314030
+ name: pagePath.split("/")[0] ?? "page name not found",
314031
+ contents,
314032
+ route: routePath,
314033
+ fileName: path27.join(rootDir, "pages", pagePath)
314034
+ };
314035
+ }));
314036
+ return pages;
314037
+ } catch (e) {
314038
+ getLogger().error("Error getting pages path for route", getErrorMeta(e));
314039
+ return [];
314040
+ }
314041
+ }
314042
+ async function getAllApiDefinitions({ rootDir, currentUrl }) {
314043
+ const logger3 = getLogger();
314044
+ try {
314045
+ const routesJson = await fs13.readFile(path27.join(rootDir, "routes.json"), "utf8");
314046
+ const routes = JSON.parse(routesJson);
314047
+ const pathname = new URL(currentUrl).pathname;
314048
+ const fileName = Object.entries(routes).find(([path53]) => {
314049
+ const routeRegex = new RegExp("^" + path53.replaceAll(/:[^/]+/g, "([^/]+)") + "$");
314050
+ return routeRegex.test(pathname);
314051
+ })?.[1];
314052
+ if (!fileName) {
314053
+ throw new Error(`Route match not found for ${currentUrl}`);
314054
+ }
314055
+ const apisDir = path27.join(rootDir, "pages", path27.dirname(fileName), "apis");
314056
+ const objs = await fs13.readdir(apisDir);
314057
+ logger3.info(`objs ${JSON.stringify(objs)}`);
314058
+ const apiDefinitions = [];
314059
+ for (const obj of objs) {
314060
+ const stat4 = await fs13.stat(path27.join(apisDir, obj));
314061
+ if (stat4.isFile() && obj.endsWith(".yaml")) {
314062
+ const contents = await fs13.readFile(path27.join(apisDir, obj), "utf8");
314063
+ const yamlContents = await import_yaml3.default.parse(contents);
314064
+ const apiName = yamlContents.metadata.name;
314065
+ apiDefinitions.push({
314066
+ name: apiName,
314067
+ fileName: obj,
314068
+ contents: yamlContents
314069
+ });
314070
+ } else if (stat4.isDirectory()) {
314071
+ const apiYamlPath = path27.join(apisDir, obj, "api.yaml");
314072
+ const apiYamlStat = await fs13.stat(apiYamlPath);
314073
+ if (apiYamlStat.isFile()) {
314074
+ const contents = await fs13.readFile(apiYamlPath, "utf8");
314075
+ const yamlContents = await import_yaml3.default.parse(contents);
314076
+ const apiName = yamlContents.metadata.name;
314077
+ apiDefinitions.push({
314078
+ name: apiName,
314079
+ fileName: path27.join(apisDir, obj, "api.yaml"),
314080
+ contents: yamlContents
314081
+ });
314082
+ }
314083
+ }
314084
+ }
314085
+ return apiDefinitions;
314086
+ } catch (e) {
314087
+ logger3.error("Error getting api definitions", getErrorMeta(e));
314088
+ return [];
314089
+ }
314090
+ }
314091
+
314132
314092
  // ../../../vite-plugin-file-sync/dist/file-sync-vite-plugin.js
314133
314093
  var hasStarted = false;
314134
314094
  var isInitialized = false;
@@ -314268,6 +314228,11 @@ var fileSyncVitePlugin = (pluginParams, options8) => {
314268
314228
  syncService?.on?.("error", sendError);
314269
314229
  lockService?.removeListener?.("error", sendError);
314270
314230
  lockService?.on?.("error", sendError);
314231
+ syncService?.on?.("degradedModeChange", (degradedMode) => {
314232
+ socketManager.callEditorClients((socket) => {
314233
+ return socket.call.setDegradedMode({ degradedMode });
314234
+ });
314235
+ });
314271
314236
  const extractApiParamsAndDependencies = (socket) => {
314272
314237
  const allApis = fileSyncManager.getApiFiles();
314273
314238
  const allApiNames = Object.values(allApis).map(({ api }) => api.apiPb.metadata.name);
@@ -314943,7 +314908,7 @@ async function buildWithVite({ root: root2, dest: dest4, mode, libraryUrl, asset
314943
314908
  init_cjs_shims();
314944
314909
  var import_bucketeer_sdk = __toESM(require_dist5(), 1);
314945
314910
  var import_shared33 = __toESM(require_dist2(), 1);
314946
- var import_util30 = __toESM(require_dist3(), 1);
314911
+ var import_util29 = __toESM(require_dist3(), 1);
314947
314912
  import * as fs16 from "node:fs";
314948
314913
  import path31 from "node:path";
314949
314914
 
@@ -318369,7 +318334,7 @@ var ValidateGitSetupError = class extends Error {
318369
318334
 
318370
318335
  // ../sdk/dist/flag.js
318371
318336
  init_cjs_shims();
318372
- var import_util28 = __toESM(require_dist3(), 1);
318337
+ var import_util27 = __toESM(require_dist3(), 1);
318373
318338
  var signingEnabled = (flags) => {
318374
318339
  return flags["ui.enable-resource-signing"] ?? false;
318375
318340
  };
@@ -318388,7 +318353,7 @@ var FeatureFlags = class {
318388
318353
  return this.flags["superblocks.git.split.large.steps.new.enabled"] ?? false;
318389
318354
  }
318390
318355
  linesForLargeSteps() {
318391
- return this.flags["superblocks.git.split.large.step.lines"] ?? import_util28.DEFAULT_LINES_FOR_LARGE_STEPS;
318356
+ return this.flags["superblocks.git.split.large.step.lines"] ?? import_util27.DEFAULT_LINES_FOR_LARGE_STEPS;
318392
318357
  }
318393
318358
  };
318394
318359
 
@@ -318406,12 +318371,12 @@ var import_instrumentation_http = __toESM(require_src16(), 1);
318406
318371
  var import_resources = __toESM(require_src17(), 1);
318407
318372
  var import_sdk_node = __toESM(require_src34(), 1);
318408
318373
  init_esm();
318409
- var import_util29 = __toESM(require_dist3(), 1);
318374
+ var import_util28 = __toESM(require_dist3(), 1);
318410
318375
 
318411
318376
  // ../sdk/package.json
318412
318377
  var package_default = {
318413
318378
  name: "@superblocksteam/sdk",
318414
- version: "2.0.0",
318379
+ version: "2.0.1-next.1",
318415
318380
  type: "module",
318416
318381
  description: "Superblocks JS SDK",
318417
318382
  homepage: "https://www.superblocks.com",
@@ -318453,8 +318418,8 @@ var package_default = {
318453
318418
  "@rollup/wasm-node": "^4.35.0",
318454
318419
  "@superblocksteam/bucketeer-sdk": "0.5.0",
318455
318420
  "@superblocksteam/shared": "0.9160.0",
318456
- "@superblocksteam/util": "2.0.0",
318457
- "@superblocksteam/vite-plugin-file-sync": "2.0.0",
318421
+ "@superblocksteam/util": "2.0.1-next.1",
318422
+ "@superblocksteam/vite-plugin-file-sync": "2.0.1-next.1",
318458
318423
  "@vitejs/plugin-react": "^4.3.4",
318459
318424
  axios: "^1.4.0",
318460
318425
  chokidar: "^4.0.3",
@@ -318531,7 +318496,7 @@ var ATTR_SUPERBLOCKS_BASE_URL = "superblocks.base_url";
318531
318496
  var superblocksTracesUrl = void 0;
318532
318497
  var superblocksHostname = "unknown";
318533
318498
  try {
318534
- const tokenWithUrl = await (0, import_util29.getLocalTokenWithUrl)();
318499
+ const tokenWithUrl = await (0, import_util28.getLocalTokenWithUrl)();
318535
318500
  const superblocksBaseUrl = new URL(tokenWithUrl.superblocksBaseUrl);
318536
318501
  superblocksTracesUrl = superblocksBaseUrl.origin + "/api/v1/traces";
318537
318502
  superblocksHostname = superblocksBaseUrl.hostname;
@@ -318913,7 +318878,7 @@ async function fetchApplication({ cliVersion, applicationId, branch, token: toke
318913
318878
  return data;
318914
318879
  } catch (e) {
318915
318880
  if (axios_default.isAxiosError(e) && e.response?.status === 404) {
318916
- throw new import_util30.NotFoundError(`Application ${applicationId} was not found`);
318881
+ throw new import_util29.NotFoundError(`Application ${applicationId} was not found`);
318917
318882
  }
318918
318883
  throw new Error(`Could not fetch application: ${typeof e === "object" && e && "message" in e ? e.message : e}`);
318919
318884
  }
@@ -318934,7 +318899,7 @@ async function fetchApplicationBranches({ cliVersion, applicationId, token: toke
318934
318899
  serverResponse = await axios_default(config2);
318935
318900
  } catch (e) {
318936
318901
  if (axios_default.isAxiosError(e) && e.response?.status === 404) {
318937
- throw new import_util30.NotFoundError(`Application ${applicationId} was not found`);
318902
+ throw new import_util29.NotFoundError(`Application ${applicationId} was not found`);
318938
318903
  }
318939
318904
  throw new Error(`Could not fetch application branches: ${e.message}`);
318940
318905
  }
@@ -318981,7 +318946,7 @@ async function fetchApplicationWithComponentsFromBucketeer({ applicationWrapper,
318981
318946
  };
318982
318947
  }
318983
318948
  superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
318984
- const bucketeerBaseUrl = (0, import_util30.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl);
318949
+ const bucketeerBaseUrl = (0, import_util29.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl);
318985
318950
  const branchPath = branch ? `/branches/${encodeURIComponent(branch)}` : "";
318986
318951
  const componentFileURL = new URL(`${BASE_BUCKETEER_URL}/v1/components/${applicationId}${branchPath}?commit=${commitId}&viewMode=${viewMode}&multiPage=true`, bucketeerBaseUrl).toString();
318987
318952
  try {
@@ -319001,7 +318966,7 @@ async function fetchApplicationWithComponentsFromBucketeer({ applicationWrapper,
319001
318966
  return bucketeerApp;
319002
318967
  } catch (e) {
319003
318968
  if (axios_default.isAxiosError(e) && e.response?.status === 404) {
319004
- throw new import_util30.NotFoundError(`Application ${applicationId} was not found`);
318969
+ throw new import_util29.NotFoundError(`Application ${applicationId} was not found`);
319005
318970
  }
319006
318971
  throw new Error("Could not fetch application");
319007
318972
  }
@@ -319062,7 +319027,7 @@ async function fetchApi(cliVersion, apiId, token2, superblocksBaseUrl, viewMode,
319062
319027
  }
319063
319028
  } catch (e) {
319064
319029
  if (axios_default.isAxiosError(e) && e.response?.status === 404) {
319065
- throw new import_util30.NotFoundError(`Api ${apiId} was not found`);
319030
+ throw new import_util29.NotFoundError(`Api ${apiId} was not found`);
319066
319031
  }
319067
319032
  throw new Error(`Could not fetch api: ${typeof e === "object" && e && "message" in e ? e.message : e}`);
319068
319033
  }
@@ -319101,7 +319066,7 @@ async function validateGitSetup(cliVersion, resourceId, resourceType, event, loc
319101
319066
  break;
319102
319067
  }
319103
319068
  default:
319104
- (0, import_util30.unreachable)(resourceType);
319069
+ (0, import_util29.unreachable)(resourceType);
319105
319070
  }
319106
319071
  const config2 = {
319107
319072
  method: "post",
@@ -319148,7 +319113,7 @@ async function registerComponents(cliVersion, applicationId, componentConfigs, t
319148
319113
  applicationId,
319149
319114
  branchName: branch || "",
319150
319115
  cliVersion,
319151
- componentEvent: injectedHeaders[import_util30.COMPONENT_EVENT_HEADER],
319116
+ componentEvent: injectedHeaders[import_util29.COMPONENT_EVENT_HEADER],
319152
319117
  components: componentConfigs
319153
319118
  });
319154
319119
  socket.close();
@@ -319177,9 +319142,9 @@ async function registerComponents(cliVersion, applicationId, componentConfigs, t
319177
319142
  }
319178
319143
  async function uploadComponents({ cliVersion, applicationId, componentConfigs, files, token: token2, superblocksBaseUrl, branch }) {
319179
319144
  superblocksBaseUrl = superblocksBaseUrl.replace(/\/$/, "");
319180
- const bucketeerBaseUrl = (0, import_util30.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl);
319145
+ const bucketeerBaseUrl = (0, import_util29.getBucketeerUrlFromSuperblocksUrl)(superblocksBaseUrl);
319181
319146
  const uploadFiles = files.map((file, ind) => {
319182
- let contentType = (0, import_util30.getContentType)(file);
319147
+ let contentType = (0, import_util29.getContentType)(file);
319183
319148
  if (contentType.length === 0) {
319184
319149
  contentType = "application/octet-stream";
319185
319150
  }
@@ -319222,7 +319187,7 @@ You can reduce your component bundle size by uploading static assets to a separa
319222
319187
  headers: {
319223
319188
  Authorization: "Bearer " + token2,
319224
319189
  [CLI_VERSION_HEADER]: cliVersion,
319225
- [import_util30.COMPONENT_EVENT_HEADER]: import_util30.ComponentEvent.UPLOAD,
319190
+ [import_util29.COMPONENT_EVENT_HEADER]: import_util29.ComponentEvent.UPLOAD,
319226
319191
  [SUPERBLOCKS_URL_HEADER]: superblocksBaseUrl,
319227
319192
  ...formHeaders
319228
319193
  }
@@ -319274,7 +319239,7 @@ async function fetchCurrentUser(cliVersion, token2, superblocksBaseUrl) {
319274
319239
  headers: {
319275
319240
  Authorization: "Bearer " + token2,
319276
319241
  [CLI_VERSION_HEADER]: cliVersion,
319277
- [import_util30.COMPONENT_EVENT_HEADER]: import_util30.ComponentEvent.LOGIN
319242
+ [import_util29.COMPONENT_EVENT_HEADER]: import_util29.ComponentEvent.LOGIN
319278
319243
  }
319279
319244
  };
319280
319245
  const response = await axios_default(config2);
@@ -319441,7 +319406,7 @@ async function fetchApplicationCommits({ cliVersion, applicationId, branch, toke
319441
319406
  return serverResponse?.data?.data;
319442
319407
  } catch (e) {
319443
319408
  if (axios_default.isAxiosError(e) && e.response?.status === 404) {
319444
- throw new import_util30.NotFoundError(`Application ${applicationId} was not found`);
319409
+ throw new import_util29.NotFoundError(`Application ${applicationId} was not found`);
319445
319410
  }
319446
319411
  throw new Error("Could not fetch application");
319447
319412
  }
@@ -319467,7 +319432,7 @@ async function fetchApiCommits({ cliVersion, applicationId, branch, token: token
319467
319432
  return serverResponse?.data?.data;
319468
319433
  } catch (e) {
319469
319434
  if (axios_default.isAxiosError(e) && e.response?.status === 404) {
319470
- throw new import_util30.NotFoundError(`Application ${applicationId} was not found`);
319435
+ throw new import_util29.NotFoundError(`Application ${applicationId} was not found`);
319471
319436
  }
319472
319437
  throw new Error("Could not fetch application");
319473
319438
  }
@@ -319505,11 +319470,11 @@ async function deployResource(cliVersion, resourceType, resourceId, token2, supe
319505
319470
  let message;
319506
319471
  if (axios_default.isAxiosError(e)) {
319507
319472
  if (e.response?.status === 404) {
319508
- throw new import_util30.NotFoundError(`${e.response?.data?.responseMeta?.message}`);
319473
+ throw new import_util29.NotFoundError(`${e.response?.data?.responseMeta?.message}`);
319509
319474
  } else if (e.response?.status === 403) {
319510
- throw new import_util30.ForbiddenError(`${e.response?.data?.responseMeta?.message}`);
319475
+ throw new import_util29.ForbiddenError(`${e.response?.data?.responseMeta?.message}`);
319511
319476
  } else if (e.response?.status === 400) {
319512
- throw new import_util30.BadRequestError(`${e.response?.data?.responseMeta?.message}`);
319477
+ throw new import_util29.BadRequestError(`${e.response?.data?.responseMeta?.message}`);
319513
319478
  } else {
319514
319479
  message = e.response?.data?.responseMeta?.message ?? JSON.stringify(e.response?.data) ?? e.response?.statusText;
319515
319480
  throw new Error(`${message}`);
@@ -319542,12 +319507,12 @@ var import_shared35 = __toESM(require_dist2(), 1);
319542
319507
 
319543
319508
  // ../sdk/dist/dbfs/client.js
319544
319509
  init_cjs_shims();
319545
- var import_util32 = __toESM(require_dist3(), 1);
319510
+ var import_util31 = __toESM(require_dist3(), 1);
319546
319511
 
319547
319512
  // ../sdk/dist/dbfs/local.js
319548
319513
  init_cjs_shims();
319549
319514
  var import_shared34 = __toESM(require_dist2(), 1);
319550
- var import_util31 = __toESM(require_dist3(), 1);
319515
+ var import_util30 = __toESM(require_dist3(), 1);
319551
319516
  import * as fsp4 from "node:fs/promises";
319552
319517
  async function doDownloadDirectoryToLocal(rpcClient, directoryHash, localDirectoryPath) {
319553
319518
  await fsp4.mkdir(localDirectoryPath, { recursive: true });
@@ -319579,7 +319544,7 @@ async function doDownloadDirectoryToLocalRec(rpcClient, directoryHash, localDire
319579
319544
  break;
319580
319545
  }
319581
319546
  default: {
319582
- (0, import_util31.unreachable)(entry);
319547
+ (0, import_util30.unreachable)(entry);
319583
319548
  }
319584
319549
  }
319585
319550
  }
@@ -319619,7 +319584,7 @@ async function hashLocalDirectory2(localDirectoryPath) {
319619
319584
  break;
319620
319585
  }
319621
319586
  default:
319622
- (0, import_util31.unreachable)(localDirEntry);
319587
+ (0, import_util30.unreachable)(localDirEntry);
319623
319588
  }
319624
319589
  directoryContents.push(entry);
319625
319590
  }
@@ -319651,7 +319616,7 @@ async function doUploadLocalDirectory(rpcClient, localDirectoryPath) {
319651
319616
  name: localDirEntry.name
319652
319617
  };
319653
319618
  } else {
319654
- (0, import_util31.unreachable)(localDirEntry);
319619
+ (0, import_util30.unreachable)(localDirEntry);
319655
319620
  }
319656
319621
  directoryContents.push(entry);
319657
319622
  }
@@ -319741,7 +319706,7 @@ async function printDirectoryEntries(token2, superblocksBaseUrl, directoryHash)
319741
319706
  break;
319742
319707
  }
319743
319708
  default: {
319744
- (0, import_util32.unreachable)(entry);
319709
+ (0, import_util31.unreachable)(entry);
319745
319710
  }
319746
319711
  }
319747
319712
  console.log(`${entry.type}${executable ? "x" : " "} ${hash2} ${entry.name}${target ? ` -> ${target}` : ""}`);
@@ -319921,7 +319886,7 @@ var SuperblocksSdk = class {
319921
319886
  // ../sdk/dist/version-control.mjs
319922
319887
  init_cjs_shims();
319923
319888
  var import_shared36 = __toESM(require_dist2(), 1);
319924
- var import_util33 = __toESM(require_dist3(), 1);
319889
+ var import_util32 = __toESM(require_dist3(), 1);
319925
319890
  import * as https2 from "https";
319926
319891
  import path33 from "node:path";
319927
319892
  import { dirname as dirname8 } from "path";
@@ -324522,7 +324487,7 @@ var DEFAULT_FILE_VERSION = "0.1.0";
324522
324487
  var SPLIT_LARGE_API_STEPS_VERSION = "0.2.0";
324523
324488
  var LATEST_FILE_VERSION = SPLIT_LARGE_API_STEPS_VERSION;
324524
324489
  function getApiRepresentation(featureFlags, resourceConfig) {
324525
- const linesForLargeSteps = featureFlags.linesForLargeSteps() ?? import_util33.DEFAULT_LINES_FOR_LARGE_STEPS;
324490
+ const linesForLargeSteps = featureFlags.linesForLargeSteps() ?? import_util32.DEFAULT_LINES_FOR_LARGE_STEPS;
324526
324491
  if (featureFlags.splitLargeApiStepsEnabled() && isPostSplitLargeApiSteps(resourceConfig)) {
324527
324492
  return {
324528
324493
  extractLargeSourceFiles: true,
@@ -324589,10 +324554,10 @@ function getFileStructureTypeFromResourceConfig(superblocksConfig) {
324589
324554
  }
324590
324555
  async function getFileStructureType(rootPath, existingRelativeLocation) {
324591
324556
  try {
324592
- const superblocksConfig = await (0, import_util33.getSuperblocksApplicationConfigJson)(`${rootPath}/${existingRelativeLocation}`);
324557
+ const superblocksConfig = await (0, import_util32.getSuperblocksApplicationConfigJson)(`${rootPath}/${existingRelativeLocation}`);
324593
324558
  return getFileStructureTypeFromResourceConfig(superblocksConfig);
324594
324559
  } catch {
324595
- await (0, import_util33.getSuperblocksApplicationV2ConfigJson)(`${rootPath}/${existingRelativeLocation}`);
324560
+ await (0, import_util32.getSuperblocksApplicationV2ConfigJson)(`${rootPath}/${existingRelativeLocation}`);
324596
324561
  return FileStructureType.MULTI_PAGE;
324597
324562
  }
324598
324563
  }
@@ -324604,7 +324569,7 @@ async function readApplicationFromDisk(rootPath, existingRelativeLocation) {
324604
324569
  if (await import_fs_extra4.default.pathExists(apisDirName)) {
324605
324570
  const apiFiles = await import_fs_extra4.default.readdir(apisDirName);
324606
324571
  for (const apiFile of apiFiles) {
324607
- const { api: apiContent } = await (0, import_util33.readAppApiYamlFile)(apisDirName, apiFile);
324572
+ const { api: apiContent } = await (0, import_util32.readAppApiYamlFile)(apisDirName, apiFile);
324608
324573
  apis.push({
324609
324574
  id: apiContent.metadata.id,
324610
324575
  apiPb: apiContent
@@ -324618,7 +324583,7 @@ async function readApplicationFromDisk(rootPath, existingRelativeLocation) {
324618
324583
  };
324619
324584
  }
324620
324585
  async function readMultiPageApplicationFromDisk(rootPath, existingRelativeLocation) {
324621
- const superblocksApplicationConfig = await (0, import_util33.getSuperblocksApplicationConfigJson)(`${rootPath}/${existingRelativeLocation}`);
324586
+ const superblocksApplicationConfig = await (0, import_util32.getSuperblocksApplicationConfigJson)(`${rootPath}/${existingRelativeLocation}`);
324622
324587
  const application = await readYamlFile(`${rootPath}/${existingRelativeLocation}/application.yaml`);
324623
324588
  const pagesDirName = `${rootPath}/${existingRelativeLocation}/pages`;
324624
324589
  const pages = [];
@@ -324630,7 +324595,7 @@ async function readMultiPageApplicationFromDisk(rootPath, existingRelativeLocati
324630
324595
  if (await import_fs_extra4.default.pathExists(pageApisDirName)) {
324631
324596
  const pageApiNames = getApiNamesFromPageConfig(page);
324632
324597
  for (const apiName of pageApiNames) {
324633
- const { api: apiContent } = await (0, import_util33.readAppApiYamlFile)(pageApisDirName, apiName);
324598
+ const { api: apiContent } = await (0, import_util32.readAppApiYamlFile)(pageApisDirName, apiName);
324634
324599
  apis2.push({
324635
324600
  id: apiContent.metadata.id,
324636
324601
  pageId: page.id,
@@ -324655,7 +324620,7 @@ async function readMultiPageApplicationFromDisk(rootPath, existingRelativeLocati
324655
324620
  const appConfig = superblocksApplicationConfig;
324656
324621
  const apiNames = getApiNamesFromApplicationConfig(appConfig);
324657
324622
  for (const apiName of apiNames) {
324658
- const { api: apiContent } = await (0, import_util33.readAppApiYamlFile)(appApisDirName, apiName);
324623
+ const { api: apiContent } = await (0, import_util32.readAppApiYamlFile)(appApisDirName, apiName);
324659
324624
  apis.push({
324660
324625
  id: apiContent.metadata.id,
324661
324626
  apiPb: apiContent
@@ -324676,7 +324641,7 @@ function getApiNamesFromPageConfig(pageConfig) {
324676
324641
  }
324677
324642
  async function readApiFromDisk(rootPath, existingRelativeLocation) {
324678
324643
  const path53 = `${rootPath}/${existingRelativeLocation}`;
324679
- const { api: apiContent } = await (0, import_util33.readAppApiYamlFile)(path53);
324644
+ const { api: apiContent } = await (0, import_util32.readAppApiYamlFile)(path53);
324680
324645
  return {
324681
324646
  apiPb: apiContent
324682
324647
  };
@@ -324705,7 +324670,7 @@ async function writeResourceToDisk(resourceType, resourceId, resource, rootPath,
324705
324670
  const apiPromises = [];
324706
324671
  const apisDirName = `${appDirName}/apis`;
324707
324672
  await import_fs_extra4.default.ensureDir(apisDirName);
324708
- const existingApplicationConfig = await (0, import_util33.getSuperblocksApplicationConfigIfExists)(appDirName);
324673
+ const existingApplicationConfig = await (0, import_util32.getSuperblocksApplicationConfigIfExists)(appDirName);
324709
324674
  const existingFilePaths = getExistingFilePathsForApplicationApi(existingApplicationConfig, appDirName);
324710
324675
  const newApplicationConfig = {
324711
324676
  configType: "APPLICATION",
@@ -324734,8 +324699,8 @@ async function writeResourceToDisk(resourceType, resourceId, resource, rootPath,
324734
324699
  for (const filePath of existingFilePaths) {
324735
324700
  await import_fs_extra4.default.remove(filePath);
324736
324701
  }
324737
- await import_fs_extra4.default.ensureDir(`${appDirName}/${import_util33.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324738
- await import_fs_extra4.default.writeFile(`${appDirName}/${import_util33.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(newApplicationConfig), null, 2));
324702
+ await import_fs_extra4.default.ensureDir(`${appDirName}/${import_util32.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324703
+ await import_fs_extra4.default.writeFile(`${appDirName}/${import_util32.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(newApplicationConfig), null, 2));
324739
324704
  const createdFiles = await Promise.resolve(
324740
324705
  // Defensive check for when application settings are missing componentFiles
324741
324706
  resource.componentFiles?.map((file) => downloadFile(appDirName, file.filename, file.url)) ?? []
@@ -324757,7 +324722,7 @@ async function writeResourceToDisk(resourceType, resourceId, resource, rootPath,
324757
324722
  if (!await import_fs_extra4.default.pathExists(backendDirName)) {
324758
324723
  await import_fs_extra4.default.mkdir(backendDirName, { recursive: true });
324759
324724
  }
324760
- const existingBackendConfig = await (0, import_util33.getSuperblocksBackendConfigIfExists)(backendDirName);
324725
+ const existingBackendConfig = await (0, import_util32.getSuperblocksBackendConfigIfExists)(backendDirName);
324761
324726
  const existingFilePaths = getExistingFilePathsForBackendApi(existingBackendConfig, backendDirName);
324762
324727
  const backendConfig = {
324763
324728
  id: resourceId,
@@ -324769,8 +324734,8 @@ async function writeResourceToDisk(resourceType, resourceId, resource, rootPath,
324769
324734
  if (apiRepresentation.extractLargeSourceFiles) {
324770
324735
  backendConfig.sourceFiles = apiInfo.sourceFiles;
324771
324736
  }
324772
- await import_fs_extra4.default.ensureDir(`${backendDirName}/${import_util33.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324773
- await import_fs_extra4.default.writeFile(`${backendDirName}/${import_util33.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(backendConfig), null, 2));
324737
+ await import_fs_extra4.default.ensureDir(`${backendDirName}/${import_util32.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324738
+ await import_fs_extra4.default.writeFile(`${backendDirName}/${import_util32.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(backendConfig), null, 2));
324774
324739
  for (const filePath of existingFilePaths) {
324775
324740
  await import_fs_extra4.default.remove(filePath);
324776
324741
  }
@@ -324807,7 +324772,7 @@ async function writeV1ApplicationToDisk(resource, appDirName, featureFlags, rela
324807
324772
  sortMapEntries: true
324808
324773
  });
324809
324774
  await import_fs_extra4.default.outputFile(`${appDirName}/application.yaml`, applicationContent);
324810
- const existingApplicationConfig = await (0, import_util33.getSuperblocksApplicationConfigIfExists)(appDirName);
324775
+ const existingApplicationConfig = await (0, import_util32.getSuperblocksApplicationConfigIfExists)(appDirName);
324811
324776
  const existingFilePaths = getExistingFilePathsForApplicationApi(existingApplicationConfig, appDirName);
324812
324777
  const newApplicationConfig = {
324813
324778
  configType: "APPLICATION",
@@ -324887,8 +324852,8 @@ async function writeV1ApplicationToDisk(resource, appDirName, featureFlags, rela
324887
324852
  for (const filePath of existingFilePaths) {
324888
324853
  await import_fs_extra4.default.remove(filePath);
324889
324854
  }
324890
- await import_fs_extra4.default.ensureDir(`${appDirName}/${import_util33.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324891
- await import_fs_extra4.default.writeFile(`${appDirName}/${import_util33.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(newApplicationConfig), null, 2));
324855
+ await import_fs_extra4.default.ensureDir(`${appDirName}/${import_util32.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324856
+ await import_fs_extra4.default.writeFile(`${appDirName}/${import_util32.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(newApplicationConfig), null, 2));
324892
324857
  const createdFiles = await Promise.resolve(
324893
324858
  // Defensive check for when application settings are missing componentFiles
324894
324859
  resource.componentFiles?.map((file) => downloadFile(appDirName, file.filename, file.url)) ?? []
@@ -324908,14 +324873,14 @@ async function writeV1ApplicationToDisk(resource, appDirName, featureFlags, rela
324908
324873
  };
324909
324874
  }
324910
324875
  async function writeCodeModeApplicationToDisk(sdk2, resource, appDirName, featureFlags) {
324911
- const existingApplicationConfig = await (0, import_util33.getSuperblocksApplicationConfigIfExists)(appDirName);
324876
+ const existingApplicationConfig = await (0, import_util32.getSuperblocksApplicationConfigIfExists)(appDirName);
324912
324877
  const newApplicationConfig = {
324913
324878
  configType: "APPLICATION_V2",
324914
324879
  id: resource.application.id,
324915
324880
  metadata: getResourceConfigMetadata(featureFlags, existingApplicationConfig)
324916
324881
  };
324917
- await import_fs_extra4.default.ensureDir(`${appDirName}/${import_util33.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324918
- await import_fs_extra4.default.writeFile(`${appDirName}/${import_util33.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(newApplicationConfig), null, 2));
324882
+ await import_fs_extra4.default.ensureDir(`${appDirName}/${import_util32.SUPERBLOCKS_HOME_FOLDER_NAME}`);
324883
+ await import_fs_extra4.default.writeFile(`${appDirName}/${import_util32.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(newApplicationConfig), null, 2));
324919
324884
  try {
324920
324885
  await sdk2.dbfsGetApplication({
324921
324886
  applicationId: resource.application.id,
@@ -325120,7 +325085,7 @@ function extractApiName(api) {
325120
325085
  async function writeAppApi(api, directoryPath, existingFilePaths, apiPromises, apiRepresentation) {
325121
325086
  const originalApiName = extractApiName(api);
325122
325087
  const additionalStepFiles = [];
325123
- await (0, import_util33.writeApiFiles)(api, slugifyName(originalApiName), `${directoryPath}/apis`, true, apiPromises, additionalStepFiles, apiRepresentation, existingFilePaths);
325088
+ await (0, import_util32.writeApiFiles)(api, slugifyName(originalApiName), `${directoryPath}/apis`, true, apiPromises, additionalStepFiles, apiRepresentation, existingFilePaths);
325124
325089
  return {
325125
325090
  name: originalApiName,
325126
325091
  sourceFiles: additionalStepFiles.map((file) => file.relativePath).sort()
@@ -325129,7 +325094,7 @@ async function writeAppApi(api, directoryPath, existingFilePaths, apiPromises, a
325129
325094
  async function writeBackendApi(api, directoryPath, apiPromises, apiRepresentation, existingFilePaths) {
325130
325095
  const originalApiName = extractApiName(api);
325131
325096
  const additionalStepFiles = [];
325132
- await (0, import_util33.writeApiFiles)(api, "api", directoryPath, false, apiPromises, additionalStepFiles, apiRepresentation, existingFilePaths);
325097
+ await (0, import_util32.writeApiFiles)(api, "api", directoryPath, false, apiPromises, additionalStepFiles, apiRepresentation, existingFilePaths);
325133
325098
  return {
325134
325099
  name: originalApiName,
325135
325100
  sourceFiles: additionalStepFiles.map((file) => file.relativePath).sort()
@@ -325175,18 +325140,18 @@ async function validateMultiPageApplication(applicationConfig, superblocksRootPa
325175
325140
  async function validateLocalResource(superblocksRootPath, resource) {
325176
325141
  switch (resource.resourceType) {
325177
325142
  case "APPLICATION": {
325178
- const applicationConfigPath = path33.resolve(superblocksRootPath, resource.location, import_util33.RESOURCE_CONFIG_PATH);
325143
+ const applicationConfigPath = path33.resolve(superblocksRootPath, resource.location, import_util32.RESOURCE_CONFIG_PATH);
325179
325144
  if (!await import_fs_extra4.default.pathExists(applicationConfigPath)) {
325180
325145
  return `File ${relativeToCurrentDir(applicationConfigPath)} not found. Superblocks CLI commands cannot function without it.`;
325181
325146
  }
325182
325147
  let applicationConfig = void 0;
325183
325148
  try {
325184
- applicationConfig = await (0, import_util33.getSuperblocksApplicationConfigJson)(path33.join(superblocksRootPath, resource.location));
325149
+ applicationConfig = await (0, import_util32.getSuperblocksApplicationConfigJson)(path33.join(superblocksRootPath, resource.location));
325185
325150
  } catch {
325186
325151
  }
325187
325152
  if (!applicationConfig) {
325188
325153
  try {
325189
- applicationConfig = await (0, import_util33.getSuperblocksApplicationV2ConfigJson)(path33.join(superblocksRootPath, resource.location));
325154
+ applicationConfig = await (0, import_util32.getSuperblocksApplicationV2ConfigJson)(path33.join(superblocksRootPath, resource.location));
325190
325155
  if (!applicationConfig) {
325191
325156
  throw new Error();
325192
325157
  }
@@ -325210,7 +325175,7 @@ async function validateLocalResource(superblocksRootPath, resource) {
325210
325175
  break;
325211
325176
  }
325212
325177
  case "BACKEND": {
325213
- const backendConfigPath = path33.resolve(superblocksRootPath, resource.location, import_util33.RESOURCE_CONFIG_PATH);
325178
+ const backendConfigPath = path33.resolve(superblocksRootPath, resource.location, import_util32.RESOURCE_CONFIG_PATH);
325214
325179
  if (!await import_fs_extra4.default.pathExists(backendConfigPath)) {
325215
325180
  return `File ${relativeToCurrentDir(backendConfigPath)} not found. Superblocks CLI commands cannot function without it.`;
325216
325181
  }
@@ -325252,7 +325217,7 @@ function relativeToCurrentDir(applicationConfigPath) {
325252
325217
 
325253
325218
  // ../sdk/dist/dev-utils/dev-server.mjs
325254
325219
  init_cjs_shims();
325255
- var import_util34 = __toESM(require_dist3(), 1);
325220
+ var import_util33 = __toESM(require_dist3(), 1);
325256
325221
  import net from "node:net";
325257
325222
  import os4 from "node:os";
325258
325223
  import path34 from "node:path";
@@ -325267,7 +325232,7 @@ async function createDevServer({ root: root2, mode, fsOperationQueue, syncServic
325267
325232
  logger3.debug("Dev server already running");
325268
325233
  return httpServer;
325269
325234
  }
325270
- const resourceConfig = await (0, import_util34.getSuperblocksResourceConfigIfExists)();
325235
+ const resourceConfig = await (0, import_util33.getSuperblocksResourceConfigIfExists)();
325271
325236
  if (resourceConfig?.configType !== "APPLICATION_V2") {
325272
325237
  throw new Error("Invalid resource configuration type");
325273
325238
  }
@@ -325422,7 +325387,7 @@ async function startVite({ app, httpServer: httpServer2, root: root2, mode, port
325422
325387
  };
325423
325388
  const isCustomBuildEnabled2 = await isCustomComponentsEnabled();
325424
325389
  const customFolder = path34.join(root2, "custom");
325425
- const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.0";
325390
+ const cdnUrl = "https://assets-cdn.superblocks.com/library/2.0.1-next.1";
325426
325391
  const env3 = loadEnv(mode, root2, "");
325427
325392
  const hmrPort = await getFreePort();
325428
325393
  const hmrOptions = {
@@ -325529,7 +325494,7 @@ function getValidFileUrl(url3, file) {
325529
325494
 
325530
325495
  // ../sdk/dist/cli-replacement/dev.mjs
325531
325496
  init_cjs_shims();
325532
- var import_util35 = __toESM(require_dist3(), 1);
325497
+ var import_util34 = __toESM(require_dist3(), 1);
325533
325498
  import * as child_process2 from "node:child_process";
325534
325499
  import * as fsp5 from "node:fs/promises";
325535
325500
  import path36 from "node:path";
@@ -326120,7 +326085,7 @@ async function dev(options8) {
326120
326085
  });
326121
326086
  logger3.info("Checking if local files are synced with the server");
326122
326087
  try {
326123
- await (0, import_util35.maskUnixSignals)(async () => {
326088
+ await (0, import_util34.maskUnixSignals)(async () => {
326124
326089
  const sdk2 = new SuperblocksSdk(applicationConfig.token, applicationConfig.superblocksBaseUrl, "");
326125
326090
  if (lockService) {
326126
326091
  try {
@@ -326212,10 +326177,10 @@ async function dev(options8) {
326212
326177
  // ../sdk/dist/cli-replacement/init.js
326213
326178
  init_cjs_shims();
326214
326179
  var import_shared37 = __toESM(require_dist2(), 1);
326215
- var import_util36 = __toESM(require_dist3(), 1);
326180
+ var import_util35 = __toESM(require_dist3(), 1);
326216
326181
  async function fetchAndWriteApplication({ resourceId, viewMode, featureFlags, projectRootFolder, appRelativePath, sdk: sdk2, skipSigningVerification }) {
326217
326182
  const headers = {
326218
- [import_util36.COMPONENT_EVENT_HEADER]: import_shared37.ComponentEvent.INIT
326183
+ [import_util35.COMPONENT_EVENT_HEADER]: import_shared37.ComponentEvent.INIT
326219
326184
  };
326220
326185
  const application = await sdk2.fetchApplicationWithComponents({
326221
326186
  applicationId: resourceId,
@@ -326239,7 +326204,7 @@ async function fetchAndWriteApplication({ resourceId, viewMode, featureFlags, pr
326239
326204
  var import_shared38 = __toESM(require_dist2(), 1);
326240
326205
 
326241
326206
  // src/commands/commits.mts
326242
- var import_util39 = __toESM(require_dist3(), 1);
326207
+ var import_util38 = __toESM(require_dist3(), 1);
326243
326208
 
326244
326209
  // ../../../../node_modules/.pnpm/listr2@6.6.0_enquirer@2.4.1/node_modules/listr2/dist/index.js
326245
326210
  init_cjs_shims();
@@ -328511,7 +328476,7 @@ __name(Manager, "Manager");
328511
328476
  init_cjs_shims();
328512
328477
  import path37 from "node:path";
328513
328478
  import { Command, ux } from "@oclif/core";
328514
- var import_util38 = __toESM(require_dist3(), 1);
328479
+ var import_util37 = __toESM(require_dist3(), 1);
328515
328480
  var import_fs_extra6 = __toESM(require_lib(), 1);
328516
328481
  var import_semver5 = __toESM(require_semver2(), 1);
328517
328482
 
@@ -328629,7 +328594,7 @@ var AuthenticatedCommand = class extends Command {
328629
328594
  async init() {
328630
328595
  await super.init();
328631
328596
  try {
328632
- const result = await (0, import_util38.getLocalTokenWithUrl)();
328597
+ const result = await (0, import_util37.getLocalTokenWithUrl)();
328633
328598
  if (!("token" in result)) {
328634
328599
  throw new Error();
328635
328600
  }
@@ -328660,7 +328625,7 @@ var AuthenticatedCommand = class extends Command {
328660
328625
  };
328661
328626
  }
328662
328627
  async getBaseUrl() {
328663
- const result = await (0, import_util38.getLocalTokenWithUrlIfExists)();
328628
+ const result = await (0, import_util37.getLocalTokenWithUrlIfExists)();
328664
328629
  return result?.superblocksBaseUrl ?? "";
328665
328630
  }
328666
328631
  getSdk() {
@@ -328673,7 +328638,7 @@ var AuthenticatedCommand = class extends Command {
328673
328638
  let previousConfig;
328674
328639
  let rootConfigPath;
328675
328640
  try {
328676
- [previousConfig, rootConfigPath] = await (0, import_util38.getSuperblocksMonorepoConfigJson)(true);
328641
+ [previousConfig, rootConfigPath] = await (0, import_util37.getSuperblocksMonorepoConfigJson)(true);
328677
328642
  } catch {
328678
328643
  return;
328679
328644
  }
@@ -328758,7 +328723,7 @@ var AuthenticatedApplicationCommand = class extends AuthenticatedCommand {
328758
328723
  apis: {}
328759
328724
  };
328760
328725
  async getEditModeUrl() {
328761
- const result = await (0, import_util38.getLocalTokenWithUrlIfExists)();
328726
+ const result = await (0, import_util37.getLocalTokenWithUrlIfExists)();
328762
328727
  const baseUrl = typeof result === "string" ? result : result?.superblocksBaseUrl;
328763
328728
  return new URL(
328764
328729
  `/applications/edit/${this.applicationConfig.id}`,
@@ -328768,14 +328733,14 @@ var AuthenticatedApplicationCommand = class extends AuthenticatedCommand {
328768
328733
  async init() {
328769
328734
  await super.init();
328770
328735
  try {
328771
- this.applicationConfig = await (0, import_util38.getSuperblocksApplicationConfigJson)();
328736
+ this.applicationConfig = await (0, import_util37.getSuperblocksApplicationConfigJson)();
328772
328737
  } catch (error) {
328773
328738
  this.error(error.message, {
328774
328739
  exit: 1
328775
328740
  });
328776
328741
  }
328777
328742
  const { branchName } = await this.validateApplicationGitSetup(
328778
- import_util38.ComponentEvent.INIT
328743
+ import_util37.ComponentEvent.INIT
328779
328744
  );
328780
328745
  ux.action.start("Checking application...");
328781
328746
  try {
@@ -328840,7 +328805,7 @@ ${cyan("superblocks migrate")}`
328840
328805
  }
328841
328806
  ux.action.stop();
328842
328807
  ux.action.start("Scanning for Superblocks components...");
328843
- const exists2 = await import_fs_extra6.default.pathExists(import_util38.CUSTOM_COMPONENTS_PATH);
328808
+ const exists2 = await import_fs_extra6.default.pathExists(import_util37.CUSTOM_COMPONENTS_PATH);
328844
328809
  if (!exists2) {
328845
328810
  ux.action.stop();
328846
328811
  this.error(
@@ -328850,7 +328815,7 @@ ${cyan("superblocks migrate")}`
328850
328815
  }
328851
328816
  );
328852
328817
  }
328853
- const { configs, hasError } = await (0, import_util38.getComponentConfigs)(true);
328818
+ const { configs, hasError } = await (0, import_util37.getComponentConfigs)(true);
328854
328819
  if (hasError) {
328855
328820
  ux.action.stop();
328856
328821
  this.error("Failed to register components", { exit: 1 });
@@ -328866,7 +328831,7 @@ ${cyan("superblocks migrate")}`
328866
328831
  try {
328867
328832
  ux.action.start("Registering components...");
328868
328833
  const { branchName } = await this.validateApplicationGitSetup(
328869
- import_util38.ComponentEvent.REGISTER
328834
+ import_util37.ComponentEvent.REGISTER
328870
328835
  );
328871
328836
  await this.getSdk().registerComponents(
328872
328837
  this.applicationConfig.id,
@@ -328889,7 +328854,7 @@ var AuthenticatedApplicationV2Command = class extends AuthenticatedCommand {
328889
328854
  id: ""
328890
328855
  };
328891
328856
  async getEditModeUrl() {
328892
- const result = await (0, import_util38.getLocalTokenWithUrlIfExists)();
328857
+ const result = await (0, import_util37.getLocalTokenWithUrlIfExists)();
328893
328858
  const baseUrl = typeof result === "string" ? result : result?.superblocksBaseUrl;
328894
328859
  return new URL(
328895
328860
  `/code-mode/applications/edit/${this.applicationConfig.id}`,
@@ -328899,14 +328864,14 @@ var AuthenticatedApplicationV2Command = class extends AuthenticatedCommand {
328899
328864
  async init() {
328900
328865
  await super.init();
328901
328866
  try {
328902
- this.applicationConfig = await (0, import_util38.getSuperblocksApplicationV2ConfigJson)();
328867
+ this.applicationConfig = await (0, import_util37.getSuperblocksApplicationV2ConfigJson)();
328903
328868
  } catch (error) {
328904
328869
  this.error(error.message, {
328905
328870
  exit: 1
328906
328871
  });
328907
328872
  }
328908
328873
  const { branchName } = await this.validateApplicationGitSetup(
328909
- import_util38.ComponentEvent.INIT
328874
+ import_util37.ComponentEvent.INIT
328910
328875
  );
328911
328876
  ux.action.start("Checking application...");
328912
328877
  try {
@@ -328996,8 +328961,8 @@ var Commits = class _Commits extends AuthenticatedCommand {
328996
328961
  [
328997
328962
  ctx.existingSuperblocksRootConfig,
328998
328963
  ctx.superblocksRootConfigPath
328999
- ] = await (0, import_util39.getSuperblocksMonorepoConfigJson)(true);
329000
- ctx.existingSuperblocksResourceConfig = await (0, import_util39.getSuperblocksResourceConfigIfExists)();
328964
+ ] = await (0, import_util38.getSuperblocksMonorepoConfigJson)(true);
328965
+ ctx.existingSuperblocksResourceConfig = await (0, import_util38.getSuperblocksResourceConfigIfExists)();
329001
328966
  ctx.superblocksRootPath = path38.resolve(
329002
328967
  path38.dirname(ctx.superblocksRootConfigPath),
329003
328968
  ".."
@@ -329038,7 +329003,7 @@ var Commits = class _Commits extends AuthenticatedCommand {
329038
329003
  skipSigningVerification: true
329039
329004
  });
329040
329005
  } catch (error) {
329041
- if (error instanceof import_util39.NotFoundError) {
329006
+ if (error instanceof import_util38.NotFoundError) {
329042
329007
  ctx.removedResourceIds.push(resourceId);
329043
329008
  } else {
329044
329009
  throw error;
@@ -329054,7 +329019,7 @@ var Commits = class _Commits extends AuthenticatedCommand {
329054
329019
  skipSigningVerification: true
329055
329020
  });
329056
329021
  } catch (error) {
329057
- if (error instanceof import_util39.NotFoundError) {
329022
+ if (error instanceof import_util38.NotFoundError) {
329058
329023
  ctx.removedResourceIds.push(resourceId);
329059
329024
  } else {
329060
329025
  throw error;
@@ -329127,7 +329092,7 @@ Would you like to also delete these resources from your filesystem?`
329127
329092
  title: `Fetching commits for application ${resource.location} from branch ${branchName}...`,
329128
329093
  task: async (_ctx, task2) => {
329129
329094
  const headers = {
329130
- [import_util39.COMPONENT_EVENT_HEADER]: import_util39.ComponentEvent.COMMITS
329095
+ [import_util38.COMPONENT_EVENT_HEADER]: import_util38.ComponentEvent.COMMITS
329131
329096
  };
329132
329097
  try {
329133
329098
  task2.title += `: fetched`;
@@ -329141,7 +329106,7 @@ Would you like to also delete these resources from your filesystem?`
329141
329106
  this.printCommits(applicationCommits, branchName);
329142
329107
  task2.title += `: done`;
329143
329108
  } catch (e) {
329144
- if (e instanceof import_util39.NotFoundError) {
329109
+ if (e instanceof import_util38.NotFoundError) {
329145
329110
  task2.title += `: not found in this branch. skipped`;
329146
329111
  } else {
329147
329112
  throw e;
@@ -329202,7 +329167,7 @@ Would you like to also delete these resources from your filesystem?`
329202
329167
  `No resource found with the given location: ${resourcePath}`
329203
329168
  );
329204
329169
  }
329205
- const resourceConfig = await (0, import_util39.getSuperblocksResourceConfigIfExists)();
329170
+ const resourceConfig = await (0, import_util38.getSuperblocksResourceConfigIfExists)();
329206
329171
  if (resourceConfig) {
329207
329172
  return resourceConfig.id;
329208
329173
  }
@@ -329260,7 +329225,7 @@ Would you like to also delete these resources from your filesystem?`
329260
329225
 
329261
329226
  // src/commands/components/create.mts
329262
329227
  init_cjs_shims();
329263
- var import_util40 = __toESM(require_dist3(), 1);
329228
+ var import_util39 = __toESM(require_dist3(), 1);
329264
329229
  import { exec as exec6 } from "node:child_process";
329265
329230
  import { randomUUID as randomUUID3 } from "node:crypto";
329266
329231
  import path39 from "node:path";
@@ -329385,8 +329350,8 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
329385
329350
  type: "input",
329386
329351
  name: "name",
329387
329352
  message: "What is the machine readable name of the component you want to create?",
329388
- validate: (response) => (0, import_util40.isValidIdentifier)(response) || "Invalid identifier",
329389
- initial: (0, import_util40.suggestIdentifier)(displayName, true) || "ToDoList"
329353
+ validate: (response) => (0, import_util39.isValidIdentifier)(response) || "Invalid identifier",
329354
+ initial: (0, import_util39.suggestIdentifier)(displayName, true) || "ToDoList"
329390
329355
  })).name;
329391
329356
  this.log();
329392
329357
  this.log(
@@ -329411,8 +329376,8 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
329411
329376
  name: "path",
329412
329377
  message: "What is the path of the property? This will be used to access the property in your code (e.g. currentTasks)",
329413
329378
  validate: (response) => {
329414
- if (!(0, import_util40.isValidIdentifier)(response)) return "Invalid identifier";
329415
- if ((0, import_util40.isReservedPropertyName)(response))
329379
+ if (!(0, import_util39.isValidIdentifier)(response)) return "Invalid identifier";
329380
+ if ((0, import_util39.isReservedPropertyName)(response))
329416
329381
  return "Reserved property path (see https://docs.superblocks.com/applications/custom-components/faq#what-is-a-reserved-property)";
329417
329382
  if (properties.some((v) => v.path === response))
329418
329383
  return "Duplicate property path";
@@ -329423,7 +329388,7 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
329423
329388
  type: "select",
329424
329389
  name: "type",
329425
329390
  message: `What is the type of ${propertyPath}?`,
329426
- choices: Object.entries(import_util40.dataTypeDefinions).map(
329391
+ choices: Object.entries(import_util39.dataTypeDefinions).map(
329427
329392
  ([k, v]) => ({
329428
329393
  name: k,
329429
329394
  message: v.prompt,
@@ -329506,10 +329471,10 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
329506
329471
  name: "value",
329507
329472
  message: "What is the path of the event? This will be used to trigger the event in your code (e.g. onChange)",
329508
329473
  type: "input",
329509
- initial: (0, import_util40.suggestIdentifier)(eventHandlerName) || "onChange",
329474
+ initial: (0, import_util39.suggestIdentifier)(eventHandlerName) || "onChange",
329510
329475
  validate: (response) => {
329511
- if (!(0, import_util40.isValidIdentifier)(response)) return "Invalid identifier";
329512
- if ((0, import_util40.isReservedPropertyName)(response))
329476
+ if (!(0, import_util39.isValidIdentifier)(response)) return "Invalid identifier";
329477
+ if ((0, import_util39.isReservedPropertyName)(response))
329513
329478
  return "Reserved property path (see https://docs.superblocks.com/applications/custom-components/faq#what-is-a-reserved-property)";
329514
329479
  if (events.some((v) => v.path === response))
329515
329480
  return "Duplicate property path";
@@ -329671,7 +329636,7 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
329671
329636
  ux2.action.stop();
329672
329637
  }
329673
329638
  const headers = {
329674
- [import_util40.COMPONENT_EVENT_HEADER]: import_util40.ComponentEvent.CREATE
329639
+ [import_util39.COMPONENT_EVENT_HEADER]: import_util39.ComponentEvent.CREATE
329675
329640
  };
329676
329641
  await this.registerComponents(headers);
329677
329642
  }
@@ -329679,13 +329644,13 @@ var CreateComponent = class _CreateComponent extends AuthenticatedApplicationCom
329679
329644
 
329680
329645
  // src/commands/components/register.mts
329681
329646
  init_cjs_shims();
329682
- var import_util41 = __toESM(require_dist3(), 1);
329647
+ var import_util40 = __toESM(require_dist3(), 1);
329683
329648
  var Register = class extends AuthenticatedApplicationCommand {
329684
329649
  static description = "Registers all local component config files";
329685
329650
  static examples = ["superblocks components register"];
329686
329651
  async run() {
329687
329652
  const headers = {
329688
- [import_util41.COMPONENT_EVENT_HEADER]: import_util41.ComponentEvent.REGISTER
329653
+ [import_util40.COMPONENT_EVENT_HEADER]: import_util40.ComponentEvent.REGISTER
329689
329654
  };
329690
329655
  await this.registerComponents(headers);
329691
329656
  }
@@ -329693,7 +329658,7 @@ var Register = class extends AuthenticatedApplicationCommand {
329693
329658
 
329694
329659
  // src/commands/components/upload.mts
329695
329660
  init_cjs_shims();
329696
- var import_util42 = __toESM(require_dist3(), 1);
329661
+ var import_util41 = __toESM(require_dist3(), 1);
329697
329662
  import { Flags as Flags3, ux as ux3 } from "@oclif/core";
329698
329663
  import react4 from "@vitejs/plugin-react";
329699
329664
  var import_fs_extra9 = __toESM(require_lib(), 1);
@@ -329913,7 +329878,7 @@ var Upload = class _Upload extends AuthenticatedApplicationCommand {
329913
329878
  async run() {
329914
329879
  const { flags } = await this.parse(_Upload);
329915
329880
  ux3.action.start("Scanning for Superblocks components...");
329916
- const exists2 = await import_fs_extra9.default.pathExists(import_util42.CUSTOM_COMPONENTS_PATH);
329881
+ const exists2 = await import_fs_extra9.default.pathExists(import_util41.CUSTOM_COMPONENTS_PATH);
329917
329882
  if (!exists2) {
329918
329883
  ux3.action.stop();
329919
329884
  this.error(
@@ -329924,11 +329889,11 @@ var Upload = class _Upload extends AuthenticatedApplicationCommand {
329924
329889
  );
329925
329890
  }
329926
329891
  const { branchName } = await this.validateApplicationGitSetup(
329927
- import_util42.ComponentEvent.UPLOAD,
329892
+ import_util41.ComponentEvent.UPLOAD,
329928
329893
  flags.branch
329929
329894
  );
329930
329895
  const headers = {
329931
- [import_util42.COMPONENT_EVENT_HEADER]: import_util42.ComponentEvent.REGISTER
329896
+ [import_util41.COMPONENT_EVENT_HEADER]: import_util41.ComponentEvent.REGISTER
329932
329897
  };
329933
329898
  const configs = await this.registerComponents(headers);
329934
329899
  if (!configs) return;
@@ -330011,14 +329976,14 @@ var Upload = class _Upload extends AuthenticatedApplicationCommand {
330011
329976
 
330012
329977
  // src/commands/components/watch.mts
330013
329978
  init_cjs_shims();
330014
- var import_util44 = __toESM(require_dist3(), 1);
329979
+ var import_util43 = __toESM(require_dist3(), 1);
330015
329980
  import react5 from "@vitejs/plugin-react";
330016
329981
  import { createLogger as createLogger7, createServer as createServer2 } from "vite";
330017
329982
 
330018
329983
  // src/appendHotReloadEventPlugin.mts
330019
329984
  init_cjs_shims();
330020
329985
  import path44 from "path";
330021
- var import_util43 = __toESM(require_dist3(), 1);
329986
+ var import_util42 = __toESM(require_dist3(), 1);
330022
329987
  var appendHotReloadEventPlugin = (getBranch) => {
330023
329988
  return {
330024
329989
  name: "append-code-plugin",
@@ -330029,15 +329994,15 @@ var appendHotReloadEventPlugin = (getBranch) => {
330029
329994
  const isConfigFile = path44.basename(ctx.file) === "config.ts";
330030
329995
  if (!isConfigFile) return;
330031
329996
  try {
330032
- const result = await (0, import_util43.getLocalTokenWithUrl)();
329997
+ const result = await (0, import_util42.getLocalTokenWithUrl)();
330033
329998
  if (!result || !("token" in result)) {
330034
329999
  throw new Error("Please run `superblocks login` to login.");
330035
330000
  }
330036
330001
  const { token: token2, superblocksBaseUrl } = result;
330037
- const resourceConfig = await (0, import_util43.getSuperblocksApplicationConfigJson)();
330038
- const { configs, hasError } = await (0, import_util43.getComponentConfigs)(true);
330002
+ const resourceConfig = await (0, import_util42.getSuperblocksApplicationConfigJson)();
330003
+ const { configs, hasError } = await (0, import_util42.getComponentConfigs)(true);
330039
330004
  if (hasError) return;
330040
- const [rootSettings] = await (0, import_util43.getSuperblocksMonorepoConfigJson)(true);
330005
+ const [rootSettings] = await (0, import_util42.getSuperblocksMonorepoConfigJson)(true);
330041
330006
  const sdk2 = new SuperblocksSdk(
330042
330007
  token2,
330043
330008
  superblocksBaseUrl,
@@ -330046,7 +330011,7 @@ var appendHotReloadEventPlugin = (getBranch) => {
330046
330011
  console.log("Registering components...");
330047
330012
  const branch = await getBranch();
330048
330013
  const headers = {
330049
- [import_util43.COMPONENT_EVENT_HEADER]: import_util43.ComponentEvent.REGISTER
330014
+ [import_util42.COMPONENT_EVENT_HEADER]: import_util42.ComponentEvent.REGISTER
330050
330015
  };
330051
330016
  await sdk2.registerComponents(
330052
330017
  resourceConfig.id,
@@ -330093,7 +330058,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
330093
330058
  static description = "watch for changes to your custom components";
330094
330059
  async run() {
330095
330060
  const headers = {
330096
- [import_util44.COMPONENT_EVENT_HEADER]: import_util44.ComponentEvent.REGISTER
330061
+ [import_util43.COMPONENT_EVENT_HEADER]: import_util43.ComponentEvent.REGISTER
330097
330062
  };
330098
330063
  await this.registerComponents(headers);
330099
330064
  this.log(
@@ -330104,7 +330069,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
330104
330069
  this.log();
330105
330070
  const editModeUrl = new URL(await this.getEditModeUrl());
330106
330071
  editModeUrl.searchParams.set("devMode", "true");
330107
- const { branchName, localBranchName } = await this.validateApplicationGitSetup(import_util44.ComponentEvent.REGISTER);
330072
+ const { branchName, localBranchName } = await this.validateApplicationGitSetup(import_util43.ComponentEvent.REGISTER);
330108
330073
  if (branchName) {
330109
330074
  editModeUrl.searchParams.set("branch", branchName);
330110
330075
  }
@@ -330120,7 +330085,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
330120
330085
  if (curLocalBranchName === lastLocalBranchName) {
330121
330086
  return lastBranchName;
330122
330087
  } else {
330123
- const { branchName: branchName2, localBranchName: localBranchName2 } = await this.validateApplicationGitSetup(import_util44.ComponentEvent.REGISTER);
330088
+ const { branchName: branchName2, localBranchName: localBranchName2 } = await this.validateApplicationGitSetup(import_util43.ComponentEvent.REGISTER);
330124
330089
  lastBranchName = branchName2;
330125
330090
  lastLocalBranchName = localBranchName2;
330126
330091
  return branchName2;
@@ -330180,7 +330145,7 @@ var Watch = class extends AuthenticatedApplicationCommand {
330180
330145
 
330181
330146
  // src/commands/config/set.mts
330182
330147
  init_cjs_shims();
330183
- var import_util46 = __toESM(require_dist3(), 1);
330148
+ var import_util45 = __toESM(require_dist3(), 1);
330184
330149
  import dns from "dns";
330185
330150
  import { promisify as promisify3 } from "util";
330186
330151
  import { Args as Args2, Command as Command2 } from "@oclif/core";
@@ -330209,21 +330174,21 @@ var SetSuperblocksConfig = class _SetSuperblocksConfig extends Command2 {
330209
330174
  const newDomain = args.value;
330210
330175
  const newSuperblocksBaseUrl = `https://${newDomain}/`;
330211
330176
  await this.validateDomain(newDomain);
330212
- const result = await (0, import_util46.getLocalTokenWithUrlIfExists)();
330177
+ const result = await (0, import_util45.getLocalTokenWithUrlIfExists)();
330213
330178
  if (result) {
330214
330179
  if (!("token" in result)) {
330215
- await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl);
330180
+ await (0, import_util45.saveApiToken)(newSuperblocksBaseUrl);
330216
330181
  break;
330217
330182
  }
330218
330183
  const { token: token2, superblocksBaseUrl } = result;
330219
330184
  const tokenToSave = newSuperblocksBaseUrl === superblocksBaseUrl ? token2 : void 0;
330220
330185
  if (tokenToSave) {
330221
- await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl, tokenToSave);
330186
+ await (0, import_util45.saveApiToken)(newSuperblocksBaseUrl, tokenToSave);
330222
330187
  } else {
330223
- await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl);
330188
+ await (0, import_util45.saveApiToken)(newSuperblocksBaseUrl);
330224
330189
  }
330225
330190
  } else {
330226
- await (0, import_util46.saveApiToken)(newSuperblocksBaseUrl);
330191
+ await (0, import_util45.saveApiToken)(newSuperblocksBaseUrl);
330227
330192
  }
330228
330193
  break;
330229
330194
  }
@@ -330532,7 +330497,7 @@ var Dev2 = class extends Command5 {
330532
330497
  init_cjs_shims();
330533
330498
  import path46 from "path";
330534
330499
  import { Args as Args3, Flags as Flags7 } from "@oclif/core";
330535
- var import_util47 = __toESM(require_dist3(), 1);
330500
+ var import_util46 = __toESM(require_dist3(), 1);
330536
330501
  var import_fs_extra12 = __toESM(require_lib(), 1);
330537
330502
  init_lodash();
330538
330503
  var Initialize = class _Initialize extends AuthenticatedCommand {
@@ -330582,7 +330547,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
330582
330547
  [
330583
330548
  ctx.existingSuperblocksRootConfig,
330584
330549
  ctx.superblocksRootConfigPath
330585
- ] = await (0, import_util47.getSuperblocksMonorepoConfigJson)(true);
330550
+ ] = await (0, import_util46.getSuperblocksMonorepoConfigJson)(true);
330586
330551
  } catch {
330587
330552
  }
330588
330553
  }
@@ -330624,12 +330589,12 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
330624
330589
  title: "Fetching resource by resourceUrl...",
330625
330590
  enabled: () => !isEmpty_default(args.resource_url),
330626
330591
  task: async (ctx2, task2) => {
330627
- const [resourceId, resourceType] = (0, import_util47.getResourceIdFromUrl)(
330592
+ const [resourceId, resourceType] = (0, import_util46.getResourceIdFromUrl)(
330628
330593
  args.resource_url
330629
330594
  );
330630
330595
  if (resourceType === "APPLICATION") {
330631
330596
  const headers = {
330632
- [import_util47.COMPONENT_EVENT_HEADER]: import_util47.ComponentEvent.INIT
330597
+ [import_util46.COMPONENT_EVENT_HEADER]: import_util46.ComponentEvent.INIT
330633
330598
  };
330634
330599
  const application = await this.getSdk().fetchApplicationWithComponents({
330635
330600
  applicationId: resourceId,
@@ -330638,7 +330603,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
330638
330603
  skipSigningVerification
330639
330604
  });
330640
330605
  if (!application) {
330641
- throw new import_util47.NotFoundError(
330606
+ throw new import_util46.NotFoundError(
330642
330607
  `Application ${resourceId} was not found`
330643
330608
  );
330644
330609
  }
@@ -330767,16 +330732,16 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
330767
330732
  )) {
330768
330733
  superblocksConfig.resources[resourceId] = resource;
330769
330734
  }
330770
- if (!await import_fs_extra12.default.exists(import_util47.SUPERBLOCKS_HOME_FOLDER_NAME)) {
330771
- await import_fs_extra12.default.mkdir(import_util47.SUPERBLOCKS_HOME_FOLDER_NAME);
330735
+ if (!await import_fs_extra12.default.exists(import_util46.SUPERBLOCKS_HOME_FOLDER_NAME)) {
330736
+ await import_fs_extra12.default.mkdir(import_util46.SUPERBLOCKS_HOME_FOLDER_NAME);
330772
330737
  }
330773
330738
  await import_fs_extra12.default.writeFile(
330774
- ctx.superblocksRootConfigPath ?? import_util47.RESOURCE_CONFIG_PATH,
330739
+ ctx.superblocksRootConfigPath ?? import_util46.RESOURCE_CONFIG_PATH,
330775
330740
  JSON.stringify(sortByKey(superblocksConfig), null, 2)
330776
330741
  );
330777
330742
  if (ctx.existingSuperblocksRootConfig) {
330778
330743
  this.log(
330779
- `Superblocks resources added at ${ctx.superblocksRootConfigPath?.replace(import_util47.RESOURCE_CONFIG_PATH, "")}`
330744
+ `Superblocks resources added at ${ctx.superblocksRootConfigPath?.replace(import_util46.RESOURCE_CONFIG_PATH, "")}`
330780
330745
  );
330781
330746
  }
330782
330747
  }
@@ -330791,7 +330756,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
330791
330756
  async getResourcesToInitialize(ctx, task, args) {
330792
330757
  if (args.resource_url) {
330793
330758
  try {
330794
- const [resourceId] = (0, import_util47.getResourceIdFromUrl)(args.resource_url);
330759
+ const [resourceId] = (0, import_util46.getResourceIdFromUrl)(args.resource_url);
330795
330760
  return [resourceId];
330796
330761
  } catch {
330797
330762
  throw new Error(`Invalid resource URL: ${args.resource_url}`);
@@ -330873,7 +330838,7 @@ var Initialize = class _Initialize extends AuthenticatedCommand {
330873
330838
  // src/commands/login.mts
330874
330839
  init_cjs_shims();
330875
330840
  import { Command as Command6, Flags as Flags8 } from "@oclif/core";
330876
- var import_util48 = __toESM(require_dist3(), 1);
330841
+ var import_util47 = __toESM(require_dist3(), 1);
330877
330842
  var import_enquirer2 = __toESM(require_enquirer(), 1);
330878
330843
  init_lodash();
330879
330844
  var { prompt: prompt2 } = import_enquirer2.default;
@@ -330890,7 +330855,7 @@ var Login = class _Login extends Command6 {
330890
330855
  async run() {
330891
330856
  const { flags } = await this.parse(_Login);
330892
330857
  let token2 = flags.token;
330893
- const result = await (0, import_util48.getLocalTokenWithUrlIfExists)();
330858
+ const result = await (0, import_util47.getLocalTokenWithUrlIfExists)();
330894
330859
  const superblocksBaseUrl = result?.superblocksBaseUrl ?? this.DEFAULT_BASE_URL;
330895
330860
  if (!token2) {
330896
330861
  if (result && "token" in result) {
@@ -330916,10 +330881,10 @@ var Login = class _Login extends Command6 {
330916
330881
  this.config.version
330917
330882
  );
330918
330883
  const user = await sdk2.fetchCurrentUser();
330919
- await (0, import_util48.saveApiToken)(superblocksBaseUrl, token2);
330884
+ await (0, import_util47.saveApiToken)(superblocksBaseUrl, token2);
330920
330885
  this.log(green(`Welcome to the Superblocks \u{1F428} CLI ${user.user.name}!`));
330921
330886
  } catch (error) {
330922
- if (error instanceof import_util48.FileAccessError) {
330887
+ if (error instanceof import_util47.FileAccessError) {
330923
330888
  this.log(
330924
330889
  red(
330925
330890
  "Could not save token, ensure the Superblocks CLI has access to create folders in your home directory."
@@ -330944,7 +330909,7 @@ init_cjs_shims();
330944
330909
  import { exec as exec7 } from "node:child_process";
330945
330910
  import path47 from "node:path";
330946
330911
  import util6 from "node:util";
330947
- var import_util49 = __toESM(require_dist3(), 1);
330912
+ var import_util48 = __toESM(require_dist3(), 1);
330948
330913
  var import_fs_extra13 = __toESM(require_lib(), 1);
330949
330914
  var import_semver7 = __toESM(require_semver2(), 1);
330950
330915
  var Migrate = class extends AuthenticatedCommand {
@@ -330964,8 +330929,8 @@ var Migrate = class extends AuthenticatedCommand {
330964
330929
  [
330965
330930
  ctx.existingSuperblocksRootConfig,
330966
330931
  ctx.superblocksRootConfigPath
330967
- ] = await (0, import_util49.getSuperblocksMonorepoConfigJson)(true);
330968
- ctx.existingSuperblocksResourceConfig = await (0, import_util49.getSuperblocksResourceConfigIfExists)();
330932
+ ] = await (0, import_util48.getSuperblocksMonorepoConfigJson)(true);
330933
+ ctx.existingSuperblocksResourceConfig = await (0, import_util48.getSuperblocksResourceConfigIfExists)();
330969
330934
  } catch {
330970
330935
  this.error(
330971
330936
  `No Superblocks project found in the current folder hierarchy. Run ${cyan(
@@ -331168,7 +331133,7 @@ var Migrate = class extends AuthenticatedCommand {
331168
331133
  init_cjs_shims();
331169
331134
  import path48 from "node:path";
331170
331135
  import { Args as Args4, Flags as Flags9 } from "@oclif/core";
331171
- var import_util50 = __toESM(require_dist3(), 1);
331136
+ var import_util49 = __toESM(require_dist3(), 1);
331172
331137
  var Pull = class _Pull extends AuthenticatedCommand {
331173
331138
  static description = "Download objects from Superblocks and save them locally";
331174
331139
  static examples = [
@@ -331228,8 +331193,8 @@ var Pull = class _Pull extends AuthenticatedCommand {
331228
331193
  [
331229
331194
  ctx.existingSuperblocksRootConfig,
331230
331195
  ctx.superblocksRootConfigPath
331231
- ] = await (0, import_util50.getSuperblocksMonorepoConfigJson)(true);
331232
- ctx.existingSuperblocksResourceConfig = await (0, import_util50.getSuperblocksResourceConfigIfExists)();
331196
+ ] = await (0, import_util49.getSuperblocksMonorepoConfigJson)(true);
331197
+ ctx.existingSuperblocksResourceConfig = await (0, import_util49.getSuperblocksResourceConfigIfExists)();
331233
331198
  ctx.superblocksRootPath = path48.resolve(
331234
331199
  path48.dirname(ctx.superblocksRootConfigPath),
331235
331200
  ".."
@@ -331270,7 +331235,7 @@ var Pull = class _Pull extends AuthenticatedCommand {
331270
331235
  skipSigningVerification: true
331271
331236
  });
331272
331237
  } catch (error) {
331273
- if (error instanceof import_util50.NotFoundError) {
331238
+ if (error instanceof import_util49.NotFoundError) {
331274
331239
  ctx.removedResourceIds.push(resourceId);
331275
331240
  } else {
331276
331241
  throw error;
@@ -331286,7 +331251,7 @@ var Pull = class _Pull extends AuthenticatedCommand {
331286
331251
  skipSigningVerification: true
331287
331252
  });
331288
331253
  } catch (error) {
331289
- if (error instanceof import_util50.NotFoundError) {
331254
+ if (error instanceof import_util49.NotFoundError) {
331290
331255
  ctx.removedResourceIds.push(resourceId);
331291
331256
  } else {
331292
331257
  throw error;
@@ -331361,7 +331326,7 @@ Would you like to also delete these resources from your filesystem?`
331361
331326
  const { branchName } = await this.validateGitSetup(
331362
331327
  resource?.resourceType,
331363
331328
  resourceId,
331364
- import_util50.ComponentEvent.PULL,
331329
+ import_util49.ComponentEvent.PULL,
331365
331330
  ctx.localBranchName
331366
331331
  );
331367
331332
  ctx.branchToPullFrom.set(resourceId, branchName);
@@ -331419,7 +331384,7 @@ ${error.message}.`
331419
331384
  title: `Pulling application ${resource.location} from branch ${branchName}...`,
331420
331385
  task: async (_ctx, task2) => {
331421
331386
  const headers = {
331422
- [import_util50.COMPONENT_EVENT_HEADER]: import_util50.ComponentEvent.PULL
331387
+ [import_util49.COMPONENT_EVENT_HEADER]: import_util49.ComponentEvent.PULL
331423
331388
  };
331424
331389
  try {
331425
331390
  task2.title += `: fetched`;
@@ -331454,7 +331419,7 @@ ${error.message}.`
331454
331419
  }
331455
331420
  task2.title += `: done`;
331456
331421
  } catch (e) {
331457
- if (e instanceof import_util50.NotFoundError) {
331422
+ if (e instanceof import_util49.NotFoundError) {
331458
331423
  task2.title += `: not found in this branch. skipped`;
331459
331424
  } else {
331460
331425
  throw e;
@@ -331524,7 +331489,7 @@ ${error.message}.`
331524
331489
  `No resource found with the given location: ${resourcePath}`
331525
331490
  );
331526
331491
  }
331527
- const resourceConfig = await (0, import_util50.getSuperblocksResourceConfigIfExists)();
331492
+ const resourceConfig = await (0, import_util49.getSuperblocksResourceConfigIfExists)();
331528
331493
  if (resourceConfig) {
331529
331494
  return [resourceConfig.id];
331530
331495
  }
@@ -331566,7 +331531,7 @@ ${error.message}.`
331566
331531
  init_cjs_shims();
331567
331532
  import path49 from "node:path";
331568
331533
  import { Args as Args5, Flags as Flags10 } from "@oclif/core";
331569
- var import_util51 = __toESM(require_dist3(), 1);
331534
+ var import_util50 = __toESM(require_dist3(), 1);
331570
331535
  init_lodash();
331571
331536
  var Push = class _Push extends AuthenticatedCommand {
331572
331537
  static description = "Import objects from local filesystem to Superblocks";
@@ -331613,8 +331578,8 @@ var Push = class _Push extends AuthenticatedCommand {
331613
331578
  [
331614
331579
  ctx.existingSuperblocksRootConfig,
331615
331580
  ctx.superblocksRootConfigPath
331616
- ] = await (0, import_util51.getSuperblocksMonorepoConfigJson)(true);
331617
- ctx.existingSuperblocksResourceConfig = await (0, import_util51.getSuperblocksResourceConfigIfExists)();
331581
+ ] = await (0, import_util50.getSuperblocksMonorepoConfigJson)(true);
331582
+ ctx.existingSuperblocksResourceConfig = await (0, import_util50.getSuperblocksResourceConfigIfExists)();
331618
331583
  ctx.superblocksRootPath = path49.resolve(
331619
331584
  path49.dirname(ctx.superblocksRootConfigPath),
331620
331585
  ".."
@@ -331685,7 +331650,7 @@ If resource is not connected to git repository, pass "main" as branch name.`
331685
331650
  skipSigningVerification: true
331686
331651
  });
331687
331652
  } catch (error) {
331688
- if (error instanceof import_util51.NotFoundError) {
331653
+ if (error instanceof import_util50.NotFoundError) {
331689
331654
  ctx.removedResourceIds.push(resourceId);
331690
331655
  } else {
331691
331656
  throw error;
@@ -331701,7 +331666,7 @@ If resource is not connected to git repository, pass "main" as branch name.`
331701
331666
  skipSigningVerification: true
331702
331667
  });
331703
331668
  } catch (error) {
331704
- if (error instanceof import_util51.NotFoundError) {
331669
+ if (error instanceof import_util50.NotFoundError) {
331705
331670
  ctx.removedResourceIds.push(resourceId);
331706
331671
  } else {
331707
331672
  throw error;
@@ -331780,7 +331745,7 @@ Would you like to also delete these resources from your filesystem?`
331780
331745
  const { branchName } = await this.validateGitSetup(
331781
331746
  resource?.resourceType,
331782
331747
  resourceId,
331783
- import_util51.ComponentEvent.PUSH,
331748
+ import_util50.ComponentEvent.PUSH,
331784
331749
  ctx.localBranchName
331785
331750
  );
331786
331751
  ctx.branchToPushTo.set(resourceId, branchName);
@@ -331870,7 +331835,7 @@ ${error.message}.`
331870
331835
  task: async (_ctx, task2) => {
331871
331836
  let configType;
331872
331837
  try {
331873
- const applicationConfig2 = await (0, import_util51.getSuperblocksApplicationV2ConfigJson)(
331838
+ const applicationConfig2 = await (0, import_util50.getSuperblocksApplicationV2ConfigJson)(
331874
331839
  path49.join(superblocksRootPath, resource.location)
331875
331840
  );
331876
331841
  configType = applicationConfig2.configType;
@@ -332039,7 +332004,7 @@ ${error.message}.`
332039
332004
  `No resource found with the given location: ${resourcePath}`
332040
332005
  );
332041
332006
  }
332042
- const resourceConfig = await (0, import_util51.getSuperblocksResourceConfigIfExists)();
332007
+ const resourceConfig = await (0, import_util50.getSuperblocksResourceConfigIfExists)();
332043
332008
  if (resourceConfig) {
332044
332009
  return [resourceConfig.id];
332045
332010
  }
@@ -332077,7 +332042,7 @@ ${error.message}.`
332077
332042
  init_cjs_shims();
332078
332043
  import path50 from "path";
332079
332044
  import { Args as Args6 } from "@oclif/core";
332080
- var import_util52 = __toESM(require_dist3(), 1);
332045
+ var import_util51 = __toESM(require_dist3(), 1);
332081
332046
  var import_fs_extra14 = __toESM(require_lib(), 1);
332082
332047
  init_lodash();
332083
332048
  var Remove = class _Remove extends AuthenticatedCommand {
@@ -332112,7 +332077,7 @@ var Remove = class _Remove extends AuthenticatedCommand {
332112
332077
  [
332113
332078
  ctx.existingSuperblocksRootConfig,
332114
332079
  ctx.superblocksRootConfigPath
332115
- ] = await (0, import_util52.getSuperblocksMonorepoConfigJson)(true);
332080
+ ] = await (0, import_util51.getSuperblocksMonorepoConfigJson)(true);
332116
332081
  ctx.superblocksRootPath = path50.resolve(
332117
332082
  path50.dirname(ctx.superblocksRootConfigPath),
332118
332083
  ".."
@@ -332199,7 +332164,7 @@ var Remove = class _Remove extends AuthenticatedCommand {
332199
332164
  {
332200
332165
  title: "Updating Superblocks project file...",
332201
332166
  task: async (ctx) => {
332202
- const [superblocksRootConfig, rootConfigPath] = await (0, import_util52.getSuperblocksMonorepoConfigJson)(true);
332167
+ const [superblocksRootConfig, rootConfigPath] = await (0, import_util51.getSuperblocksMonorepoConfigJson)(true);
332203
332168
  for (const removedResourceId of ctx.removedResourceIds) {
332204
332169
  delete superblocksRootConfig.resources[removedResourceId];
332205
332170
  }
@@ -332302,7 +332267,7 @@ function getResourceIdFromLocation(ctx, resourceLocation) {
332302
332267
  init_cjs_shims();
332303
332268
  import path51 from "node:path";
332304
332269
  import { Args as Args7, Flags as Flags11 } from "@oclif/core";
332305
- var import_util53 = __toESM(require_dist3(), 1);
332270
+ var import_util52 = __toESM(require_dist3(), 1);
332306
332271
  init_lodash();
332307
332272
  var Upload3 = class _Upload extends AuthenticatedCommand {
332308
332273
  static description = "Upload your local files to Superblocks live edit";
@@ -332339,8 +332304,8 @@ var Upload3 = class _Upload extends AuthenticatedCommand {
332339
332304
  [
332340
332305
  ctx.existingSuperblocksRootConfig,
332341
332306
  ctx.superblocksRootConfigPath
332342
- ] = await (0, import_util53.getSuperblocksMonorepoConfigJson)(true);
332343
- ctx.existingSuperblocksResourceConfig = await (0, import_util53.getSuperblocksResourceConfigIfExists)();
332307
+ ] = await (0, import_util52.getSuperblocksMonorepoConfigJson)(true);
332308
+ ctx.existingSuperblocksResourceConfig = await (0, import_util52.getSuperblocksResourceConfigIfExists)();
332344
332309
  ctx.superblocksRootPath = path51.resolve(
332345
332310
  path51.dirname(ctx.superblocksRootConfigPath),
332346
332311
  ".."
@@ -332375,7 +332340,7 @@ var Upload3 = class _Upload extends AuthenticatedCommand {
332375
332340
  skipSigningVerification: true
332376
332341
  });
332377
332342
  } catch (error) {
332378
- if (error instanceof import_util53.NotFoundError) {
332343
+ if (error instanceof import_util52.NotFoundError) {
332379
332344
  ctx.removedResourceIds.push(resourceId);
332380
332345
  } else {
332381
332346
  throw error;
@@ -332391,7 +332356,7 @@ var Upload3 = class _Upload extends AuthenticatedCommand {
332391
332356
  skipSigningVerification: true
332392
332357
  });
332393
332358
  } catch (error) {
332394
- if (error instanceof import_util53.NotFoundError) {
332359
+ if (error instanceof import_util52.NotFoundError) {
332395
332360
  ctx.removedResourceIds.push(resourceId);
332396
332361
  } else {
332397
332362
  throw error;
@@ -332498,7 +332463,7 @@ Would you like to also delete these resources from your filesystem?`
332498
332463
  title: `Uploading application ${resource.location}...`,
332499
332464
  task: async (_ctx, task2) => {
332500
332465
  try {
332501
- await (0, import_util53.getSuperblocksApplicationV2ConfigJson)(
332466
+ await (0, import_util52.getSuperblocksApplicationV2ConfigJson)(
332502
332467
  path51.join(superblocksRootPath, resource.location)
332503
332468
  );
332504
332469
  } catch {
@@ -332561,7 +332526,7 @@ Would you like to also delete these resources from your filesystem?`
332561
332526
  `No resource found with the given location: ${resourcePath}`
332562
332527
  );
332563
332528
  }
332564
- const resourceConfig = await (0, import_util53.getSuperblocksResourceConfigIfExists)();
332529
+ const resourceConfig = await (0, import_util52.getSuperblocksResourceConfigIfExists)();
332565
332530
  if (resourceConfig) {
332566
332531
  return [resourceConfig.id];
332567
332532
  }