@malloy-publisher/server 0.0.176 → 0.0.178

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.
@@ -121,7 +121,7 @@ export class Project {
121
121
  projectPath: string,
122
122
  connections: ApiConnection[],
123
123
  ): Promise<Project> {
124
- if (!(await fs.promises.stat(projectPath)).isDirectory()) {
124
+ if (!(await fs.promises.stat(projectPath))?.isDirectory()) {
125
125
  throw new ProjectNotFoundError(
126
126
  `Project path ${projectPath} not found`,
127
127
  );
@@ -383,7 +383,7 @@ export class Project {
383
383
  .access(packagePath)
384
384
  .then(() => true)
385
385
  .catch(() => false)) ||
386
- !(await fs.promises.stat(packagePath)).isDirectory()
386
+ !(await fs.promises.stat(packagePath))?.isDirectory()
387
387
  ) {
388
388
  throw new PackageNotFoundError(`Package ${packageName} not found`);
389
389
  }
@@ -569,22 +569,10 @@ export class ProjectStore {
569
569
  private async cleanupAndCreatePublisherPath() {
570
570
  const reInit = process.env.INITIALIZE_STORAGE === "true";
571
571
 
572
- // Ensure serverRootPath exists and is a directory
573
- try {
574
- const stats = await fs.promises.stat(this.serverRootPath);
575
- if (!stats.isDirectory()) {
576
- throw new Error(
577
- `Server root path ${this.serverRootPath} exists but is not a directory`,
578
- );
579
- }
580
- } catch (error) {
581
- if ((error as NodeJS.ErrnoException).code === "ENOENT") {
582
- // Directory doesn't exist, create it
583
- await fs.promises.mkdir(this.serverRootPath, { recursive: true });
584
- } else {
585
- throw error;
586
- }
587
- }
572
+ // Ensure serverRootPath exists as a directory (mkdir recursive is a
573
+ // no-op when the directory already exists and avoids a Bun-on-Windows
574
+ // bug where fs.promises.stat resolves to undefined instead of throwing)
575
+ await fs.promises.mkdir(this.serverRootPath, { recursive: true });
588
576
 
589
577
  if (reInit) {
590
578
  const uploadDocsPath = path.join(
@@ -1233,9 +1221,8 @@ export class ProjectStore {
1233
1221
  if (projectPath.endsWith(".zip")) {
1234
1222
  projectPath = await this.unzipProject(projectPath);
1235
1223
  }
1236
- const projectDirExists = (
1237
- await fs.promises.stat(projectPath)
1238
- ).isDirectory();
1224
+ const projectDirExists =
1225
+ (await fs.promises.stat(projectPath))?.isDirectory() ?? false;
1239
1226
  if (projectDirExists) {
1240
1227
  await fs.promises.rm(absoluteTargetPath, {
1241
1228
  recursive: true,
@@ -10,7 +10,7 @@ import {
10
10
  } from "../../../src/service/connection";
11
11
  import {
12
12
  getSchemasForConnection,
13
- getTablesForSchema,
13
+ listTablesForSchema,
14
14
  } from "../../../src/service/db_utils";
15
15
 
16
16
  type ApiConnection = components["schemas"]["Connection"];
@@ -421,8 +421,8 @@ describe("DuckLake Connection Tests", () => {
421
421
  }
422
422
 
423
423
  // Test table listing for first schema
424
- const schemaName = schemas[0].name;
425
- const tables = await getTablesForSchema(
424
+ const schemaName = schemas[0].name!;
425
+ const tables = await listTablesForSchema(
426
426
  ducklakeConnection,
427
427
  schemaName,
428
428
  connection,