@superblocksteam/vite-plugin-file-sync 2.0.6-next.2 → 2.0.6-next.21

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.
Files changed (103) hide show
  1. package/dist/ai-service/app-interface/shell.d.ts +1 -0
  2. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  3. package/dist/ai-service/app-interface/shell.js +8 -1
  4. package/dist/ai-service/app-interface/shell.js.map +1 -1
  5. package/dist/ai-service/const.d.ts +2 -0
  6. package/dist/ai-service/const.d.ts.map +1 -1
  7. package/dist/ai-service/const.js +2 -0
  8. package/dist/ai-service/const.js.map +1 -1
  9. package/dist/ai-service/prompts/generated/library-components/SbButtonPropsDocs.js +1 -1
  10. package/dist/ai-service/prompts/generated/library-components/SbCheckboxPropsDocs.js +1 -1
  11. package/dist/ai-service/prompts/generated/library-components/SbColumnPropsDocs.js +1 -1
  12. package/dist/ai-service/prompts/generated/library-components/SbContainerPropsDocs.js +1 -1
  13. package/dist/ai-service/prompts/generated/library-components/SbDatePickerPropsDocs.js +1 -1
  14. package/dist/ai-service/prompts/generated/library-components/SbDropdownPropsDocs.js +1 -1
  15. package/dist/ai-service/prompts/generated/library-components/SbIconPropsDocs.js +1 -1
  16. package/dist/ai-service/prompts/generated/library-components/SbImagePropsDocs.js +1 -1
  17. package/dist/ai-service/prompts/generated/library-components/SbInputPropsDocs.js +1 -1
  18. package/dist/ai-service/prompts/generated/library-components/SbModalPropsDocs.js +1 -1
  19. package/dist/ai-service/prompts/generated/library-components/SbPagePropsDocs.js +1 -1
  20. package/dist/ai-service/prompts/generated/library-components/SbSectionPropsDocs.js +1 -1
  21. package/dist/ai-service/prompts/generated/library-components/SbSlideoutPropsDocs.js +1 -1
  22. package/dist/ai-service/prompts/generated/library-components/SbSwitchPropsDocs.js +1 -1
  23. package/dist/ai-service/prompts/generated/library-components/SbTablePropsDocs.js +1 -1
  24. package/dist/ai-service/prompts/generated/library-components/SbTextPropsDocs.js +1 -1
  25. package/dist/ai-service/prompts/generated/library-typedefs/Dim.js +1 -1
  26. package/dist/ai-service/prompts/generated/library-typedefs/SbEventFlow.js +1 -1
  27. package/dist/ai-service/prompts/generated/subprompts/full-examples.js +1 -1
  28. package/dist/ai-service/prompts/generated/subprompts/superblocks-api.js +1 -1
  29. package/dist/ai-service/prompts/generated/subprompts/superblocks-components-rules.js +1 -1
  30. package/dist/ai-service/prompts/generated/subprompts/superblocks-custom-components.js +1 -1
  31. package/dist/ai-service/prompts/generated/subprompts/superblocks-data-filtering.js +1 -1
  32. package/dist/ai-service/prompts/generated/subprompts/superblocks-event-flow.js +1 -1
  33. package/dist/ai-service/prompts/generated/subprompts/superblocks-forms.js +1 -1
  34. package/dist/ai-service/prompts/generated/subprompts/superblocks-layouts.js +1 -1
  35. package/dist/ai-service/prompts/generated/subprompts/superblocks-page.js +1 -1
  36. package/dist/ai-service/prompts/generated/subprompts/superblocks-rbac.js +1 -1
  37. package/dist/ai-service/prompts/generated/subprompts/superblocks-routes.js +1 -1
  38. package/dist/ai-service/prompts/generated/subprompts/superblocks-state.js +1 -1
  39. package/dist/ai-service/prompts/generated/subprompts/superblocks-theming.js +1 -1
  40. package/dist/ai-service/prompts/generated/subprompts/system.js +1 -1
  41. package/dist/ai-service/state-machine/clark-fsm.d.ts +1 -0
  42. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  43. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  44. package/dist/ai-service/state-machine/handlers/agent-planning.js +2 -0
  45. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  46. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts +1 -1
  47. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  48. package/dist/ai-service/state-machine/handlers/llm-generating.js +40 -8
  49. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  50. package/dist/ai-service/types.d.ts +1 -0
  51. package/dist/ai-service/types.d.ts.map +1 -1
  52. package/dist/ai-service/types.js.map +1 -1
  53. package/dist/binding-extraction/index.d.ts +2 -0
  54. package/dist/binding-extraction/index.d.ts.map +1 -0
  55. package/dist/binding-extraction/index.js +2 -0
  56. package/dist/binding-extraction/index.js.map +1 -0
  57. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  58. package/dist/file-sync-vite-plugin.js +12 -3
  59. package/dist/file-sync-vite-plugin.js.map +1 -1
  60. package/dist/file-system-helpers.d.ts +2 -0
  61. package/dist/file-system-helpers.d.ts.map +1 -1
  62. package/dist/file-system-helpers.js +6 -0
  63. package/dist/file-system-helpers.js.map +1 -1
  64. package/dist/file-system-manager.d.ts +11 -2
  65. package/dist/file-system-manager.d.ts.map +1 -1
  66. package/dist/file-system-manager.js +207 -135
  67. package/dist/file-system-manager.js.map +1 -1
  68. package/dist/index.d.ts +1 -0
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +1 -0
  71. package/dist/index.js.map +1 -1
  72. package/dist/inject-index-vite-plugin.js.map +1 -1
  73. package/dist/injected-index.d.ts +2 -2
  74. package/dist/injected-index.d.ts.map +1 -1
  75. package/dist/injected-index.js.map +1 -1
  76. package/dist/lock-service/index.d.ts.map +1 -1
  77. package/dist/lock-service/index.js +10 -2
  78. package/dist/lock-service/index.js.map +1 -1
  79. package/dist/operations/operation-processor.d.ts +24 -0
  80. package/dist/operations/operation-processor.d.ts.map +1 -0
  81. package/dist/operations/operation-processor.js +80 -0
  82. package/dist/operations/operation-processor.js.map +1 -0
  83. package/dist/operations/types.d.ts +8 -0
  84. package/dist/operations/types.d.ts.map +1 -0
  85. package/dist/operations/types.js +2 -0
  86. package/dist/operations/types.js.map +1 -0
  87. package/dist/parsing/events/to-code-events.d.ts.map +1 -1
  88. package/dist/parsing/events/to-code-events.js +7 -0
  89. package/dist/parsing/events/to-code-events.js.map +1 -1
  90. package/dist/parsing/events/to-value-events.d.ts.map +1 -1
  91. package/dist/parsing/events/to-value-events.js +28 -0
  92. package/dist/parsing/events/to-value-events.js.map +1 -1
  93. package/dist/parsing/index.d.ts +3 -0
  94. package/dist/parsing/index.d.ts.map +1 -0
  95. package/dist/parsing/index.js +3 -0
  96. package/dist/parsing/index.js.map +1 -0
  97. package/dist/socket-manager.d.ts +2 -2
  98. package/dist/socket-manager.d.ts.map +1 -1
  99. package/dist/source-tracker.d.ts +20 -20
  100. package/dist/source-tracker.d.ts.map +1 -1
  101. package/dist/source-tracker.js +26 -12
  102. package/dist/source-tracker.js.map +1 -1
  103. package/package.json +14 -6
@@ -12,8 +12,9 @@ import { generateJSXAttribute } from "./codegen.js";
12
12
  import { ComponentsManager } from "./components-manager.js";
13
13
  import { addLegacyCustomComponentVariables, modifyLegacyCustomComponentElements, modifyLegacyCustomComponentImports, } from "./custom-components.js";
14
14
  import { applyErrorHandling, } from "./errors/error-handler.js";
15
- import { getPageFolder, PAGES_DIRECTORY, ROUTES_FILE, SCOPE_FILE, } from "./file-system-helpers.js";
15
+ import { getPageFolder, isPageFilePath, PAGES_DIRECTORY, ROUTES_FILE, SCOPE_FILE, } from "./file-system-helpers.js";
16
16
  import { generate } from "./generate.js";
17
+ import { OperationProcessor } from "./operations/operation-processor.js";
17
18
  import { doesElementHaveBinding } from "./parsing/bindings.js";
18
19
  import { getSbElementId } from "./parsing/ids.js";
19
20
  import { makeJSXAttribute } from "./parsing/jsx.js";
@@ -47,12 +48,13 @@ const SUPPORTED_FILETYPES = [
47
48
  },
48
49
  ];
49
50
  const APP_THEME_FILE_NAME = "appTheme.ts";
50
- export class FileSyncManager extends TracedEventEmitter {
51
+ export class FileSystemManager extends TracedEventEmitter {
51
52
  rootDir;
52
53
  tsFiles = {};
53
54
  apiFiles = {};
54
55
  sourceTracker;
55
56
  fsOperationQueue;
57
+ operationProcessor;
56
58
  generationNumberSequence;
57
59
  routes = {};
58
60
  watcher;
@@ -65,6 +67,12 @@ export class FileSyncManager extends TracedEventEmitter {
65
67
  this.fsOperationQueue = fsOperationQueue;
66
68
  this.generationNumberSequence = generationNumberSequence;
67
69
  this._tracer = tracer;
70
+ // intentionally a new queue here, we don't want to share the queue with the fsOperationQueue
71
+ this.operationProcessor = new OperationProcessor({
72
+ batchWindowMs: 50,
73
+ maxBatchSize: 100,
74
+ });
75
+ this.operationProcessor.disable();
68
76
  applyErrorHandling(this, {
69
77
  watch: { operation: "editing from code" },
70
78
  handleCreatePage: { operation: "creating a page" },
@@ -219,139 +227,203 @@ export class FileSyncManager extends TracedEventEmitter {
219
227
  this.updateApi(content, path);
220
228
  }
221
229
  });
222
- const handleFileChange = async (event, filePath) => {
223
- logger.info(`File changed: ${filePath}, event: ${event}`);
224
- switch (event) {
225
- case "add": {
226
- const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
227
- if (!fileType || !filePath.startsWith(rootPath)) {
228
- return;
229
- }
230
- const data = await readFile(filePath);
231
- if (typeof data !== "string")
232
- return;
233
- // if we match pages/*/index.tsx, we want to emit an addPage event
234
- if (/pages\/.*\/index\.tsx/.test(filePath)) {
235
- const file = await readFile(filePath);
236
- if (!file) {
237
- logger.error(`Failed to read file: ${filePath}`);
238
- return;
239
- }
240
- if (!(filePath in this.tsFiles)) {
241
- this.tsFiles[filePath] = file;
242
- this.handleNonVisualChangeByDeletingIds(filePath, file);
243
- this.emit("addPage", filePath);
244
- }
245
- }
246
- switch (fileType.type) {
247
- case "api":
248
- case "python-api-step":
249
- case "js-api-step": {
250
- await this.processApiUpdates(filePath, fileType);
251
- break;
252
- }
253
- }
254
- break;
230
+ watcher.on("all", this.handleFileChange);
231
+ }
232
+ enableOperationsQueue() {
233
+ this.operationProcessor.enable();
234
+ }
235
+ disableOperationsQueue() {
236
+ this.operationProcessor.disable();
237
+ }
238
+ async flushOperations() {
239
+ await this.operationProcessor.flush();
240
+ }
241
+ handleFileChange = async (event, filePath) => {
242
+ const logger = getLogger();
243
+ logger.info(`File changed: ${filePath}, event: ${event}`);
244
+ const rootPath = this.rootDir;
245
+ if (!rootPath) {
246
+ throw new Error("Root directory not set");
247
+ }
248
+ // Skip directory events
249
+ if (event === "addDir" || event === "unlinkDir") {
250
+ return;
251
+ }
252
+ const routePath = path.join(rootPath, ROUTES_FILE);
253
+ const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
254
+ // Only handle files we care about and that are in our root path
255
+ if (!fileType || !filePath.startsWith(rootPath)) {
256
+ return;
257
+ }
258
+ // Queue the operation based on the event type
259
+ switch (event) {
260
+ case "add": {
261
+ const data = await readFile(filePath);
262
+ if (typeof data !== "string")
263
+ return;
264
+ const isPage = isPageFilePath(filePath);
265
+ if (isPage) {
266
+ void this.operationProcessor.addOperation({
267
+ metadata: {
268
+ filePath,
269
+ },
270
+ execute: async () => {
271
+ const file = await readFile(filePath);
272
+ if (!file) {
273
+ logger.error(`Failed to read file: ${filePath}`);
274
+ return;
275
+ }
276
+ if (!(filePath in this.tsFiles)) {
277
+ this.tsFiles[filePath] = file;
278
+ this.handleNonVisualChangeByDeletingIds(filePath, file);
279
+ this.emit("addPage", filePath);
280
+ }
281
+ },
282
+ });
255
283
  }
256
- case "change": {
257
- // Special routes file handling
258
- if (filePath === routePath) {
259
- const data = await readFile(filePath);
260
- try {
261
- this.routes = JSON.parse(data);
262
- this.emit("routesChanged", this.routes);
263
- }
264
- catch (e) {
265
- logger.error("Error parsing routes file", getErrorMeta(e));
266
- }
267
- return;
268
- }
269
- const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
270
- if (!fileType || !filePath.startsWith(rootPath)) {
271
- return;
272
- }
273
- const data = await readFile(filePath);
274
- if (typeof data !== "string")
275
- return;
276
- switch (fileType.type) {
277
- case "tsx":
278
- case "scope":
279
- {
280
- if (!(filePath in this.tsFiles && this.tsFiles[filePath] === data)) {
281
- logger.info(`File changed: ${filePath} updating AST tracker`);
282
- this.tsFiles[filePath] = data;
283
- // only update the source tracker if the file is different
284
- this.handleNonVisualChangeByDeletingIds(filePath, data);
285
- this.emit("fileChanged", filePath, data, true);
284
+ else {
285
+ void this.operationProcessor.addOperation({
286
+ metadata: {
287
+ filePath,
288
+ },
289
+ execute: async () => {
290
+ switch (fileType.type) {
291
+ case "api":
292
+ case "python-api-step":
293
+ case "js-api-step": {
294
+ await this.processApiUpdates(filePath, fileType);
295
+ break;
286
296
  }
287
- else {
288
- logger.info(`File unchanged from last tracked state: ${filePath}`);
289
- this.emit("fileChanged", filePath, data, false);
297
+ }
298
+ },
299
+ });
300
+ }
301
+ break;
302
+ }
303
+ case "change": {
304
+ if (filePath === routePath) {
305
+ void this.operationProcessor.addOperation({
306
+ metadata: {
307
+ filePath,
308
+ },
309
+ priority: true,
310
+ execute: async () => {
311
+ try {
312
+ const data = JSON.parse((await readFile(filePath)) ?? "{}");
313
+ if (!isEqual(this.routes, data)) {
314
+ this.routes = data;
315
+ this.emit("routesChanged", this.routes);
290
316
  }
291
317
  }
292
- break;
293
- case "api":
294
- case "python-api-step":
295
- case "js-api-step":
296
- {
297
- await this.processApiUpdates(filePath, fileType);
318
+ catch (e) {
319
+ logger.error("Error parsing routes file", getErrorMeta(e));
298
320
  }
299
- break;
300
- }
301
- break;
321
+ },
322
+ });
323
+ return;
302
324
  }
303
- case "unlink": {
304
- if (filePath in this.apiFiles) {
305
- const api = this.apiFiles[filePath];
306
- delete this.apiFiles[filePath];
307
- if (!api || !this.sourceTracker)
308
- break;
309
- const scopeId = await this.sourceTracker.deleteApi({
310
- pageName: api.pageName,
311
- apiName: api.apiPb.metadata.name,
312
- });
313
- const changes = (await this.sourceTracker?.getAndFlushChanges()) ?? [];
314
- await this.writeChanges(changes);
315
- this.emit("apiManualDelete", {
316
- api: {
317
- id: getClientApiId(api.apiPb.metadata.name, api.pageName),
318
- apiName: api.apiPb.metadata.name,
319
- // TODO(saksham): get pagename more defensively
320
- pageName: getPageName(filePath),
321
- scopeId,
322
- },
323
- });
324
- }
325
- if (filePath in this.tsFiles) {
326
- delete this.tsFiles[filePath];
327
- this.sourceTracker?.removeFile(filePath);
328
- this.emit("deletePage", filePath);
329
- }
330
- break;
325
+ else {
326
+ void this.operationProcessor.addOperation({
327
+ metadata: {
328
+ filePath,
329
+ },
330
+ execute: async () => {
331
+ const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
332
+ if (!fileType || !filePath.startsWith(rootPath)) {
333
+ return;
334
+ }
335
+ const data = await readFile(filePath);
336
+ if (typeof data !== "string")
337
+ return;
338
+ switch (fileType.type) {
339
+ case "tsx":
340
+ case "scope":
341
+ {
342
+ if (!(filePath in this.tsFiles &&
343
+ this.tsFiles[filePath] === data)) {
344
+ logger.info(`File changed: ${filePath} updating AST tracker`);
345
+ this.tsFiles[filePath] = data;
346
+ // only update the source tracker if the file is different
347
+ this.handleNonVisualChangeByDeletingIds(filePath, data);
348
+ this.emit("fileChanged", filePath, data, true);
349
+ }
350
+ else {
351
+ logger.info(`File unchanged from last tracked state: ${filePath}`);
352
+ this.emit("fileChanged", filePath, data, false);
353
+ }
354
+ }
355
+ break;
356
+ case "api":
357
+ case "python-api-step":
358
+ case "js-api-step":
359
+ {
360
+ await this.processApiUpdates(filePath, fileType);
361
+ }
362
+ break;
363
+ }
364
+ },
365
+ });
331
366
  }
367
+ break;
332
368
  }
333
- };
334
- watcher.on("all", async (event, filePath) => {
335
- const fileType = SUPPORTED_FILETYPES.find((f) => filePath.endsWith(f.extension));
336
- switch (fileType?.type) {
337
- case "tsx":
338
- case "scope":
339
- // these can be awaited to ensure sequential execution
340
- this.fsOperationQueue.enqueue(async () => {
341
- return await handleFileChange(event, filePath);
369
+ case "unlink": {
370
+ if (filePath in this.tsFiles) {
371
+ void this.operationProcessor.addOperation({
372
+ metadata: {
373
+ filePath,
374
+ },
375
+ execute: async () => {
376
+ await this.deleteTsFile(filePath);
377
+ },
342
378
  });
343
- break;
344
- default:
345
- // some files including APIs cannot be awaited currently
346
- this.fsOperationQueue.enqueue(async () => {
347
- void handleFileChange(event, filePath);
379
+ }
380
+ else if (filePath in this.apiFiles) {
381
+ void this.operationProcessor.addOperation({
382
+ metadata: {
383
+ filePath,
384
+ },
385
+ execute: async () => {
386
+ await this.deleteApiFile(filePath);
387
+ },
348
388
  });
389
+ }
390
+ break;
349
391
  }
350
- });
351
- }
392
+ }
393
+ };
352
394
  getApiFiles() {
353
395
  return this.formatApisToClientApis(this.apiFiles);
354
396
  }
397
+ async deleteTsFile(filePath) {
398
+ delete this.tsFiles[filePath];
399
+ this.sourceTracker?.removeFile(filePath);
400
+ if (isPageFilePath(filePath)) {
401
+ this.emit("deletePage", filePath);
402
+ }
403
+ }
404
+ async deleteApiFile(filePath) {
405
+ const api = this.apiFiles[filePath];
406
+ if (!api) {
407
+ return;
408
+ }
409
+ delete this.apiFiles[filePath];
410
+ this.sourceTracker?.deleteApi({
411
+ pageName: api.pageName,
412
+ apiName: api.apiPb.metadata.name,
413
+ });
414
+ const changes = (await this.sourceTracker?.getAndFlushChanges()) ?? [];
415
+ await this.writeChanges(changes);
416
+ const scopeId = this.sourceTracker?.getScopeDefinitionForPage(api.pageName)?.id;
417
+ this.emit("apiManualDelete", {
418
+ api: {
419
+ id: getClientApiId(api.apiPb.metadata.name, api.pageName),
420
+ apiName: api.apiPb.metadata.name,
421
+ // TODO(saksham): get pagename more defensively
422
+ pageName: getPageName(filePath),
423
+ scopeId,
424
+ },
425
+ });
426
+ }
355
427
  getTsFilePaths() {
356
428
  return Object.keys(this.tsFiles);
357
429
  }
@@ -568,11 +640,11 @@ export default registerPage(Page, { name: "${name}" });
568
640
  handleReparent = async (payload, writeFile = true) => {
569
641
  const { from, to, changedProps, transaction } = payload;
570
642
  this.trackTransaction(transaction?.id);
571
- await this.sourceTracker?.setProperties({
643
+ this.sourceTracker?.setProperties({
572
644
  source: from.source,
573
645
  changes: changedProps ?? {},
574
646
  });
575
- await this.sourceTracker?.moveElement({
647
+ this.sourceTracker?.moveElement({
576
648
  from,
577
649
  to,
578
650
  });
@@ -586,7 +658,7 @@ export default registerPage(Page, { name: "${name}" });
586
658
  };
587
659
  handleCreateComponent = async (payload, writeFile = true) => {
588
660
  this.trackTransaction(payload.transaction?.id);
589
- const sourceId = await this.sourceTracker?.addElement(payload);
661
+ const sourceId = this.sourceTracker?.addElement(payload);
590
662
  if (writeFile) {
591
663
  const changes = (await this.sourceTracker?.getAndFlushChanges()) ?? [];
592
664
  await this.writeChanges(changes ?? [], (fileName) => {
@@ -600,7 +672,7 @@ export default registerPage(Page, { name: "${name}" });
600
672
  const { elements, transaction } = payload;
601
673
  this.trackTransaction(transaction?.id);
602
674
  for (const element of elements) {
603
- await this.sourceTracker?.deleteElement({
675
+ this.sourceTracker?.deleteElement({
604
676
  source: element.source,
605
677
  scopeName: element.scopeName,
606
678
  });
@@ -616,7 +688,7 @@ export default registerPage(Page, { name: "${name}" });
616
688
  handleSetProperty = async (payload, writeFile = true) => {
617
689
  const { element: { source }, property, value, transaction, } = payload;
618
690
  this.trackTransaction(transaction?.id);
619
- await this.sourceTracker?.setProperty({
691
+ this.sourceTracker?.setProperty({
620
692
  source,
621
693
  property,
622
694
  info: value,
@@ -631,7 +703,7 @@ export default registerPage(Page, { name: "${name}" });
631
703
  handleSetProperties = async (payload, writeFile = true) => {
632
704
  const { element: { source }, properties, transaction, } = payload;
633
705
  this.trackTransaction(transaction?.id);
634
- await this.sourceTracker?.setProperties({
706
+ this.sourceTracker?.setProperties({
635
707
  source,
636
708
  changes: properties,
637
709
  });
@@ -765,7 +837,7 @@ export default registerPage(Page, { name: "${name}" });
765
837
  await fs.rmdir(apiDir, { recursive: true });
766
838
  }
767
839
  delete this.apiFiles[apiFilePath];
768
- const scopeId = await this.sourceTracker.deleteApi({
840
+ const scopeId = this.sourceTracker.deleteApi({
769
841
  pageName,
770
842
  apiName,
771
843
  });
@@ -864,7 +936,7 @@ export default registerPage(Page, { name: "${name}" });
864
936
  }));
865
937
  };
866
938
  handleAddEntity = async (payload) => {
867
- await this.sourceTracker?.addEntity({
939
+ this.sourceTracker?.addEntity({
868
940
  scopeId: payload.scopeId,
869
941
  entity: {
870
942
  type: payload.type,
@@ -878,7 +950,7 @@ export default registerPage(Page, { name: "${name}" });
878
950
  });
879
951
  };
880
952
  handleUpdateEntity = async (payload) => {
881
- await this.sourceTracker?.updateEntity({
953
+ this.sourceTracker?.updateEntity({
882
954
  entityId: payload.entityId,
883
955
  updates: payload.updates,
884
956
  });
@@ -888,7 +960,7 @@ export default registerPage(Page, { name: "${name}" });
888
960
  });
889
961
  };
890
962
  handleDeleteEntity = async (payload) => {
891
- const deletedEntityName = await this.sourceTracker?.deleteEntity({
963
+ const deletedEntityName = this.sourceTracker?.deleteEntity({
892
964
  entityId: payload.entityId,
893
965
  });
894
966
  const changes = (await this.sourceTracker?.getAndFlushChanges()) ?? [];
@@ -904,7 +976,7 @@ export default registerPage(Page, { name: "${name}" });
904
976
  throw new Error("Root directory not set");
905
977
  }
906
978
  const filePath = path.join(this.rootDir, APP_THEME_FILE_NAME);
907
- await this.sourceTracker?.updateTheme({
979
+ this.sourceTracker?.updateTheme({
908
980
  themeFilePath: filePath,
909
981
  theme,
910
982
  });
@@ -942,7 +1014,7 @@ export default registerPage(Page, { name: "${name}" });
942
1014
  };
943
1015
  handleRenameEntity = async (payload) => {
944
1016
  const { elementId, newName, oldName, scopeName } = payload;
945
- await this.sourceTracker?.renameEntity({
1017
+ this.sourceTracker?.renameEntity({
946
1018
  entityId: elementId,
947
1019
  oldName,
948
1020
  newName,
@@ -1161,7 +1233,7 @@ export default registerPage(Page, { name: "${name}" });
1161
1233
  }
1162
1234
  }
1163
1235
  // Add new mock implementation
1164
- export class MockFileSyncManager extends FileSyncManager {
1236
+ export class MockFileSyncManager extends FileSystemManager {
1165
1237
  tsFiles = {};
1166
1238
  apiFiles = {};
1167
1239
  async watch(_watcher, _path) {
@@ -1237,7 +1309,7 @@ async function readFiles(dir) {
1237
1309
  const getMergedApiContent = async (path) => {
1238
1310
  return readAppApiYamlFile(path.split("/").slice(0, -1).join("/"));
1239
1311
  };
1240
- const getPageName = (path) => {
1312
+ export const getPageName = (path) => {
1241
1313
  const parts = path.split("/");
1242
1314
  const pagesIndex = parts.findIndex((part) => part === "pages");
1243
1315
  if (pagesIndex !== -1 && parts[pagesIndex + 1]) {