@lobb-js/lobb-ext-storage 0.8.4 → 0.9.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/README.md CHANGED
@@ -1 +1 @@
1
- # @lobb-js/lobb-ext-storage
1
+ # @lobb-js/lobb-ext-storage
@@ -10,7 +10,7 @@ const unlinkAsync = promisify(unlink);
10
10
  export class LocalStorageAdapter extends StorageAdapter {
11
11
  public async createFile(id: string, file: File): Promise<void> {
12
12
  const fullPath = join(
13
- this.config.storagePath,
13
+ this.config.uploadsPath,
14
14
  String(id),
15
15
  );
16
16
 
@@ -19,7 +19,7 @@ export class LocalStorageAdapter extends StorageAdapter {
19
19
 
20
20
  public async readFile(id: string): Promise<Uint8Array> {
21
21
  const fullPath = join(
22
- this.config.storagePath,
22
+ this.config.uploadsPath,
23
23
  String(id),
24
24
  );
25
25
 
@@ -39,7 +39,7 @@ export class LocalStorageAdapter extends StorageAdapter {
39
39
 
40
40
  public async removeFile(id: string): Promise<void> {
41
41
  const fullPath = join(
42
- this.config.storagePath,
42
+ this.config.uploadsPath,
43
43
  String(id),
44
44
  );
45
45
 
@@ -8,7 +8,7 @@ interface ExtendFs {
8
8
 
9
9
  type LocalAdapter = BaseSchema & {
10
10
  adapter: "local";
11
- storagePath: string;
11
+ uploadsPath: string;
12
12
  extend_fs?: ExtendFs;
13
13
  };
14
14
 
@@ -3,7 +3,6 @@ import type { ExtensionConfig } from "./config/extensionConfigSchema.ts";
3
3
  export type { StorageFsCreateOne, StorageFsFindOne } from "./types.ts";
4
4
 
5
5
  import packageJson from "../../package.json" with { type: "json" };
6
- import studioExtension from "./studioExtension.json" with { type: "json" };
7
6
  import { collections } from "./collections/index.ts";
8
7
  import { init } from "./init.ts";
9
8
  import { meta } from "./meta.ts";
@@ -21,6 +20,5 @@ export default function storage(extensionConfig: ExtensionConfig): Extension {
21
20
  meta: meta,
22
21
  workflows: getWorkflows(extensionConfig),
23
22
  openapi: openapi,
24
- dashboard: studioExtension,
25
23
  };
26
24
  }
@@ -2,5 +2,5 @@ import { mkdir } from "node:fs/promises";
2
2
  import type { ExtensionConfig } from "./config/extensionConfigSchema.ts";
3
3
 
4
4
  export async function init(storageConfig: ExtensionConfig) {
5
- await mkdir(storageConfig.storagePath, { recursive: true });
5
+ await mkdir(storageConfig.uploadsPath, { recursive: true });
6
6
  }
@@ -3,10 +3,10 @@ import storage from "../../index.ts";
3
3
  import { join } from "node:path";
4
4
  import { tmpdir } from "node:os";
5
5
 
6
- export function createSimpleConfig(storagePath?: string): Config & { storagePath: string } {
7
- const resolvedStoragePath = storagePath ?? join(tmpdir(), "lobb_storage_" + crypto.randomUUID());
6
+ export function createSimpleConfig(uploadsPath?: string): Config & { uploadsPath: string } {
7
+ const resolvedUploadsPath = uploadsPath ?? join(tmpdir(), "lobb_storage_" + crypto.randomUUID());
8
8
  return {
9
- storagePath: resolvedStoragePath,
9
+ uploadsPath: resolvedUploadsPath,
10
10
  project: {
11
11
  name: "Lobb",
12
12
  force_sync: true,
@@ -28,7 +28,7 @@ export function createSimpleConfig(storagePath?: string): Config & { storagePath
28
28
  extensions: [
29
29
  storage({
30
30
  adapter: "local",
31
- storagePath: resolvedStoragePath,
31
+ uploadsPath: resolvedUploadsPath,
32
32
  }),
33
33
  ],
34
34
  collections: {
@@ -6,12 +6,12 @@ import { createSimpleConfig } from "./configs/simple.ts";
6
6
  describe("Files Storage", () => {
7
7
  let lobb: Lobb;
8
8
  let baseUrl: string;
9
- let storagePath: string;
9
+ let uploadsPath: string;
10
10
  let createdFileId: number;
11
11
 
12
12
  beforeAll(async () => {
13
13
  const config = createSimpleConfig();
14
- storagePath = config.storagePath;
14
+ uploadsPath = config.uploadsPath;
15
15
  lobb = await Lobb.init(config);
16
16
  baseUrl = `http://127.0.0.1:${lobb.webServer.port}`;
17
17
  });
@@ -92,7 +92,7 @@ describe("Files Storage", () => {
92
92
  },
93
93
  });
94
94
 
95
- const uploadedFileExists = existsSync(`${storagePath}/${createdFileId}`);
95
+ const uploadedFileExists = existsSync(`${uploadsPath}/${createdFileId}`);
96
96
 
97
97
  expect(uploadedFileExists).toBe(true);
98
98
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobb-js/lobb-ext-storage",
3
- "version": "0.8.4",
3
+ "version": "0.9.1",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -21,27 +21,27 @@
21
21
  "test": "bun run test:lobb && bun run test:studio",
22
22
  "test:lobb": "bun test extensions/storage/tests",
23
23
  "test:studio": "bun --bun playwright test --config extensions/storage/studio/tests/playwright.config.cjs",
24
- "dev": "bun run lobb.ts",
25
- "start": "LOBB_MODE=prod bun run lobb.ts",
24
+ "dev": "bun run --watch lobb.ts",
25
+ "dev:studio": "vite dev",
26
+ "build": "vite build",
27
+ "start": "bun run lobb.ts",
26
28
  "prepare": "svelte-kit sync || echo ''",
27
29
  "preview": "vite preview",
28
30
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
29
31
  "postinstall": "bun --bun playwright install chromium",
30
- "prepublishOnly": "./scripts/prepublish.sh",
31
- "postpublish": "./scripts/postpublish.sh",
32
- "package": "svelte-package --input extensions/storage/studio",
33
- "dev:studio": "vite dev",
34
- "build:studio": "vite build"
32
+ "prepublishOnly": "lobb-ext-prepublish",
33
+ "postpublish": "lobb-ext-postpublish",
34
+ "package": "svelte-package --input extensions/storage/studio"
35
35
  },
36
36
  "dependencies": {
37
- "@lobb-js/core": "^0.13.3",
37
+ "@lobb-js/core": "^0.14.0",
38
38
  "browser-fs-access": "^0.35.0",
39
39
  "hono": "^4.7.0",
40
40
  "openapi-types": "^12.1.3",
41
41
  "path-browserify": "^1.0.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@lobb-js/studio": "^0.7.3",
44
+ "@lobb-js/studio": "^0.8.0",
45
45
  "@lucide/svelte": "^0.563.1",
46
46
  "@playwright/test": "^1.58.2",
47
47
  "@sveltejs/adapter-node": "^5.5.4",
@@ -1 +0,0 @@
1
- {}