@lobb-js/lobb-ext-storage 0.8.3 โ†’ 0.9.0

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 (43) hide show
  1. package/dist/extension.types.d.ts +25 -0
  2. package/dist/extension.types.js +1 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +25 -0
  5. package/dist/lib/components/childrenFileExplorer.svelte +12 -0
  6. package/dist/lib/components/childrenFileExplorer.svelte.d.ts +14 -0
  7. package/dist/lib/components/explorerNotSupported.svelte +13 -0
  8. package/dist/lib/components/explorerNotSupported.svelte.d.ts +14 -0
  9. package/dist/lib/components/fileExplorer.svelte +399 -0
  10. package/dist/lib/components/fileExplorer.svelte.d.ts +22 -0
  11. package/dist/lib/components/fileIcon.svelte +45 -0
  12. package/dist/lib/components/fileIcon.svelte.d.ts +14 -0
  13. package/dist/lib/components/fileManagerBreadCrumbs.svelte +50 -0
  14. package/dist/lib/components/fileManagerBreadCrumbs.svelte.d.ts +14 -0
  15. package/dist/lib/components/foreignKeyComponent.svelte +44 -0
  16. package/dist/lib/components/foreignKeyComponent.svelte.d.ts +14 -0
  17. package/dist/lib/components/pages/fileExplorerPage.svelte +66 -0
  18. package/dist/lib/components/pages/fileExplorerPage.svelte.d.ts +14 -0
  19. package/dist/lib/index.d.ts +0 -0
  20. package/dist/lib/index.js +2 -0
  21. package/dist/lib/utils.d.ts +12 -0
  22. package/dist/lib/utils.js +5 -0
  23. package/dist/tests/fileManager.spec.d.ts +1 -0
  24. package/dist/tests/fileManager.spec.js +18 -0
  25. package/dist/tests/package.json +1 -0
  26. package/dist/tests/playwright.config.cjs +27 -0
  27. package/dist/tests/playwright.config.d.cts +2 -0
  28. package/package.json +8 -4
  29. package/.vscode/settings.json +0 -5
  30. package/CHANGELOG.md +0 -216
  31. package/lobb.ts +0 -54
  32. package/scripts/postpublish.sh +0 -12
  33. package/scripts/prepublish.sh +0 -17
  34. package/studio/app.html +0 -12
  35. package/studio/routes/+layout.svelte +0 -7
  36. package/studio/routes/+layout.ts +0 -1
  37. package/studio/routes/[...path]/+page.svelte +0 -6
  38. package/svelte.config.js +0 -24
  39. package/todo.md +0 -36
  40. package/tsconfig.app.json +0 -27
  41. package/tsconfig.json +0 -13
  42. package/tsconfig.node.json +0 -26
  43. package/vite.config.ts +0 -8
@@ -0,0 +1,44 @@
1
+ <script lang="ts">
2
+ import type { ExtensionProps } from "@lobb-js/studio";
3
+ import FileExplorer, { type Entry } from "./fileExplorer.svelte";
4
+ import FileIcon from "./fileIcon.svelte";
5
+
6
+ interface Props extends ExtensionProps {
7
+ value: Entry;
8
+ }
9
+
10
+ let { utils, value = $bindable(), ...props }: Props = $props();
11
+
12
+ const { FilePlus2 } = utils.components.Icons;
13
+ const { Drawer } = utils.components;
14
+
15
+ let openDrawer = $state(false);
16
+
17
+ function handleClick() {
18
+ openDrawer = true;
19
+ }
20
+
21
+ async function onHideHandle() {
22
+ openDrawer = false;
23
+ }
24
+
25
+ async function handleOnFileSelect(entry: Entry) {
26
+ value = entry;
27
+ openDrawer = false;
28
+ }
29
+ </script>
30
+
31
+ <button onclick={handleClick} class="flex flex-col items-center gap-2 w-full border p-4 rounded-md bg-muted/30">
32
+ {#if value}
33
+ <FileIcon entry={value} {utils} />
34
+ {:else}
35
+ <FilePlus2 class="text-muted-foreground" />
36
+ <div class="text-sm text-muted-foreground">Click to add an asset</div>
37
+ {/if}
38
+ </button>
39
+
40
+ {#if openDrawer}
41
+ <Drawer onHide={onHideHandle}>
42
+ <FileExplorer onFileSelect={handleOnFileSelect} utils={utils} {...props} />
43
+ </Drawer>
44
+ {/if}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ForeignKeyComponentProps = typeof __propDef.props;
10
+ export type ForeignKeyComponentEvents = typeof __propDef.events;
11
+ export type ForeignKeyComponentSlots = typeof __propDef.slots;
12
+ export default class ForeignKeyComponent extends SvelteComponentTyped<ForeignKeyComponentProps, ForeignKeyComponentEvents, ForeignKeyComponentSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,66 @@
1
+ <script lang="ts">
2
+ import type { ExtensionProps } from "@lobb-js/studio";
3
+
4
+ import { Sidebar, SidebarTrigger, Icons } from "@lobb-js/studio";
5
+ import FileExplorer, { type Entry } from "../fileExplorer.svelte";
6
+ import path from "path-browserify"
7
+ import { onMount } from "svelte";
8
+
9
+ const props: ExtensionProps = $props();
10
+ let { utils } = props;
11
+ const { location: routerLocation } = utils;
12
+ let sidebarData: any | null = $state(null);
13
+ let location: string = $state("/");
14
+
15
+ onMount(() => {
16
+ getSidebarData();
17
+ updateExplorerLocationFromRouter(routerLocation);
18
+ })
19
+
20
+ $effect(() => {
21
+ updateRouterLocationFromExplorer(location);
22
+ })
23
+
24
+ async function updateExplorerLocationFromRouter(localLocation: typeof routerLocation) {
25
+ const fileExplorerPath = localLocation.url.pathname.replace('/studio/extensions/storage/file_manager', '');
26
+ location = fileExplorerPath ? fileExplorerPath : "/";
27
+ }
28
+
29
+ async function updateRouterLocationFromExplorer(localLocation: string) {
30
+ const newPath = `/studio/extensions/storage/file_manager${localLocation}`;
31
+ if (routerLocation.url.pathname !== newPath) {
32
+ routerLocation.navigate(newPath);
33
+ }
34
+ }
35
+
36
+ async function getSidebarData() {
37
+ const response = await utils.lobb.findAll("storage_fs", {
38
+ filter: {
39
+ type: "directory",
40
+ is_pinned_sidebar: {
41
+ $eq: true,
42
+ },
43
+ },
44
+ });
45
+ const result = await response.json();
46
+ const entries = result.data;
47
+
48
+ sidebarData = entries.map((el: Entry): any => {
49
+ return {
50
+ name: el.name,
51
+ icon: Icons.Folder,
52
+ onclick: () => {
53
+ location = path.join(el.path, el.name);
54
+ }
55
+ };
56
+ });
57
+ }
58
+ </script>
59
+
60
+ <Sidebar title="Storage" data={sidebarData}>
61
+ <FileExplorer bind:location={location} {...props}>
62
+ {#snippet topLeftHeader()}
63
+ <SidebarTrigger />
64
+ {/snippet}
65
+ </FileExplorer>
66
+ </Sidebar>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type FileExplorerPageProps = typeof __propDef.props;
10
+ export type FileExplorerPageEvents = typeof __propDef.events;
11
+ export type FileExplorerPageSlots = typeof __propDef.slots;
12
+ export default class FileExplorerPage extends SvelteComponentTyped<FileExplorerPageProps, FileExplorerPageEvents, FileExplorerPageSlots> {
13
+ }
14
+ export {};
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ // place files you want to import through the `$lib` alias in this folder.
@@ -0,0 +1,12 @@
1
+ import { type ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ export type WithoutChild<T> = T extends {
4
+ child?: any;
5
+ } ? Omit<T, "child"> : T;
6
+ export type WithoutChildren<T> = T extends {
7
+ children?: any;
8
+ } ? Omit<T, "children"> : T;
9
+ export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
10
+ export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
11
+ ref?: U | null;
12
+ };
@@ -0,0 +1,5 @@
1
+ import { clsx } from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ export function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import { test, expect } from "@playwright/test";
2
+ const FILE_MANAGER_URL = "/studio/extensions/storage/file_manager";
3
+ test.describe("File Manager page", () => {
4
+ test.beforeEach(async ({ page }) => {
5
+ await page.goto(FILE_MANAGER_URL);
6
+ });
7
+ test("loads the file manager page", async ({ page }) => {
8
+ await expect(page).toHaveURL(new RegExp(FILE_MANAGER_URL));
9
+ });
10
+ test("shows the file manager nav link in the sidebar", async ({ page }) => {
11
+ await expect(page.locator(`a[href="${FILE_MANAGER_URL}"]`)).toBeVisible();
12
+ });
13
+ test("file manager page is accessible from the nav", async ({ page }) => {
14
+ await page.goto("/studio");
15
+ await page.locator(`a[href="${FILE_MANAGER_URL}"]`).click();
16
+ await expect(page).toHaveURL(new RegExp(FILE_MANAGER_URL));
17
+ });
18
+ });
@@ -0,0 +1 @@
1
+ {"type": "commonjs"}
@@ -0,0 +1,27 @@
1
+ const { defineConfig, devices } = require("@playwright/test");
2
+
3
+ module.exports = defineConfig({
4
+ testDir: __dirname,
5
+ testMatch: "**/*.spec.ts",
6
+ fullyParallel: true,
7
+ retries: 0,
8
+ expect: { timeout: 15000 },
9
+ use: {
10
+ baseURL: "http://localhost:3000",
11
+ trace: "on-first-retry",
12
+ headless: true,
13
+ },
14
+ projects: [
15
+ {
16
+ name: "chromium",
17
+ use: { ...devices["Desktop Chrome"] },
18
+ },
19
+ ],
20
+ // Automatically start the dev server before running tests
21
+ webServer: {
22
+ command: "bun run dev",
23
+ url: "http://localhost:3000/studio",
24
+ reuseExistingServer: true,
25
+ cwd: "../../../../", // packages/storage-ext root
26
+ },
27
+ });
@@ -0,0 +1,2 @@
1
+ declare const _exports: import("@playwright/test").Config<import("@playwright/test").PlaywrightTestOptions & {}, import("@playwright/test").PlaywrightWorkerOptions & {}>;
2
+ export = _exports;
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@lobb-js/lobb-ext-storage",
3
- "version": "0.8.3",
3
+ "version": "0.9.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
+ "files": [
10
+ "extensions",
11
+ "dist"
12
+ ],
9
13
  "exports": {
10
14
  ".": "./extensions/storage/index.ts",
11
15
  "./studio": {
@@ -18,7 +22,7 @@
18
22
  "test:lobb": "bun test extensions/storage/tests",
19
23
  "test:studio": "bun --bun playwright test --config extensions/storage/studio/tests/playwright.config.cjs",
20
24
  "dev": "bun run lobb.ts",
21
- "start": "LOBB_MODE=prod bun run lobb.ts",
25
+ "start": "bun run lobb.ts",
22
26
  "prepare": "svelte-kit sync || echo ''",
23
27
  "preview": "vite preview",
24
28
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
@@ -30,14 +34,14 @@
30
34
  "build:studio": "vite build"
31
35
  },
32
36
  "dependencies": {
33
- "@lobb-js/core": "^0.13.3",
37
+ "@lobb-js/core": "^0.14.0",
34
38
  "browser-fs-access": "^0.35.0",
35
39
  "hono": "^4.7.0",
36
40
  "openapi-types": "^12.1.3",
37
41
  "path-browserify": "^1.0.1"
38
42
  },
39
43
  "devDependencies": {
40
- "@lobb-js/studio": "^0.7.2",
44
+ "@lobb-js/studio": "^0.8.0",
41
45
  "@lucide/svelte": "^0.563.1",
42
46
  "@playwright/test": "^1.58.2",
43
47
  "@sveltejs/adapter-node": "^5.5.4",
@@ -1,5 +0,0 @@
1
- {
2
- "deno.disablePaths": [
3
- "studio"
4
- ]
5
- }
package/CHANGELOG.md DELETED
@@ -1,216 +0,0 @@
1
- # Changelog
2
- All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
3
-
4
- - - -
5
- ## storage-ext@0.8.3 - 2026-03-28
6
- #### Bug Fixes
7
- - update readme to trigger publish - (cf1e896) - malik ben
8
- - update READMEs to trigger republish of all packages - (2bd145d) - malik ben
9
- #### Miscellaneous Chores
10
- - remove dead storage-ext standalone GitHub Actions workflows - (578f982) - malik ben
11
-
12
- - - -
13
-
14
- ## storage-ext@0.8.2 - 2026-03-28
15
- #### Bug Fixes
16
- - triggering the core package publish - (f0a8b54) - malik ben
17
-
18
- - - -
19
-
20
- ## storage-ext@0.8.1 - 2026-03-28
21
- #### Bug Fixes
22
- - adding readme to all packages - (3a9264a) - malik ben
23
- #### Miscellaneous Chores
24
- - add publishConfig and fix ext packages for npm publishing - (49747e9) - malik ben
25
-
26
- - - -
27
-
28
- ## storage-ext@0.8.0 - 2026-03-28
29
- #### Features
30
- - (**reports-ext,storage-ext**) convert studio from Svelte SPA to SvelteKit - (3cd7f63) - malik ben
31
- - (**storage-ext**) migrate packages/storage-ext from Deno to Bun - (a4e6bc6) - malik ben
32
- - replace hasDashboardExtension with virtual:lobb-studio-extensions module - (437cb2e) - malik ben
33
- #### Bug Fixes
34
- - add /studio subpath exports to ext packages, update studio pages to use them - (c0b9a82) - malik ben
35
- - untrack .svelte-kit from mindhar, fix process leak and $lib imports, update ai sdk versions - (017f784) - malik ben
36
- - chaning $lib to relative path - (c6d9e8f) - malik ben
37
- #### Miscellaneous Chores
38
- - (**storage-ext**) move extension logic and tests to extensions/storage, flatten studio, add Playwright tests - (a27a46d) - malik ben
39
- - (**version**) 0.25.2 - (a62acb9) - Cocogitto Bot
40
- - (**version**) 0.25.1 - (afe7e69) - Cocogitto Bot
41
- - (**version**) 0.25.0 - (77a383c) - Cocogitto Bot
42
- - (**version**) 0.24.0 - (a8cb605) - Cocogitto Bot
43
- - (**version**) 0.23.0 - (60f357e) - Cocogitto Bot
44
- - add dev:studio/build:studio scripts, fix Dockerfiles, remove --build flag - (1595975) - malik ben
45
- - migrate CI/CD from Deno/JSR to Bun/npm - (b4cc3bc) - malik ben
46
- - add prepublish/postpublish scripts to extension packages for standalone compatibility - (4d6108f) - malik ben
47
- - centralize studio app.css in @lobb-js/studio package, remove local copies - (05192dc) - malik ben
48
- - rename @lobb/ scope to @lobb-js/ across all packages and apps - (cce4ce0) - malik ben
49
- - add start/build scripts and gitignore build dir across all projects - (58f539d) - malik ben
50
- - update CLAUDE.md to enforce no-commit-without-explicit-instruction rule - (6d63a42) - malik ben
51
- - remove all deno.json and deno.lock files from the monorepo - (84ca5d4) - malik ben
52
- - replace workspace:* with exact versions in all package.json files - (74fbdb7) - malik ben
53
- - rename __studio to studio and remove unused studio dirs - (77fb932) - malik ben
54
- - rename studio directory to __studio for faker-ext, llm-ext, mail-ext, reports-ext, storage-ext - (47e754a) - malik ben
55
-
56
- - - -
57
-
58
- ## storage-ext@0.7.1 - 2026-03-03
59
- #### Bug Fixes
60
- - (**storage-ext**) use ctx.lobb instead of Lobb.instance, add extra form data test - (27101f7) - malik ben
61
- - (**storage-ext**) fix tests to work from project root and fix foreignKeyObject persistence on file upload - (4b5bdd8) - malik ben
62
- #### Miscellaneous Chores
63
- - (**version**) 0.20.0 - (06cc303) - Cocogitto Bot
64
-
65
- - - -
66
-
67
- ## storage-ext@0.7.0 - 2026-03-01
68
- #### Features
69
- - (**mindhar**) add storage extension integration - (bca6368) - malik ben
70
- #### Miscellaneous Chores
71
- - (**version**) 0.18.0 - (efc553f) - Cocogitto Bot
72
- - (**version**) 0.17.0 - (4174f0c) - Cocogitto Bot
73
- - (**version**) 0.16.0 - (9508655) - Cocogitto Bot
74
- - (**version**) 0.14.11 - (ad92b61) - Cocogitto Bot
75
-
76
- - - -
77
-
78
- ## storage-ext@0.6.8 - 2026-02-25
79
- #### Bug Fixes
80
- - publishing the storage extension - (033ab43) - Malik Najjar
81
- #### Miscellaneous Chores
82
- - filling some logic in the chat compoenent and adding the force feature - (5cd0dc8) - Malik Najjar
83
- - fixing the deleteOne and deleteMany tests - (0e42622) - Malik Najjar
84
- - making the directories test pass - (4229229) - Malik Najjar
85
- - making the files tests pass - (f312a3a) - Malik Najjar
86
- - passing more tests - (93ee276) - Malik Najjar
87
- - adding a todo for the storage extension - (cb68710) - malik ben
88
- - implementing the store using the new nice way - (106b320) - Malik Najjar
89
-
90
- - - -
91
-
92
- ## storage-ext@0.6.7 - 2026-02-23
93
- #### Bug Fixes
94
- - the core broke because of the override events - (f650f4c) - Malik Najjar
95
- #### Miscellaneous Chores
96
- - adding the ability to specify input and output types for the collectionServices methods - (72045f1) - Malik Najjar
97
- - adding neccessary override events and workflows for the storage extension - (f09698f) - Malik Najjar
98
-
99
- - - -
100
-
101
- ## storage-ext@0.6.6 - 2026-02-23
102
- #### Bug Fixes
103
- - lobb crashing on missing event fix - (e0a9a75) - Malik Najjar
104
-
105
- - - -
106
-
107
- ## storage-ext@0.6.5 - 2026-02-23
108
- #### Bug Fixes
109
- - lobb crashed because of this non existing event - (0aa47c9) - Malik Najjar
110
-
111
- - - -
112
-
113
- ## storage-ext@0.6.4 - 2026-02-22
114
- #### Bug Fixes
115
- - coggito publishing packages order fix - (573c75e) - malik ben
116
-
117
- - - -
118
-
119
- ## storage-ext@0.6.3 - 2026-02-22
120
- #### Bug Fixes
121
- - adjusted the names of the events - (6543d8c) - malik ben
122
-
123
- - - -
124
-
125
- ## storage-ext@0.6.2 - 2026-02-22
126
- #### Bug Fixes
127
- - made the collectionService become an property in the main lobb object - (146e4cb) - malik ben
128
-
129
- - - -
130
-
131
- ## storage-ext@0.6.1 - 2026-02-21
132
- #### Bug Fixes
133
- - using default export instead of named export for extensions - (37dd485) - malik ben
134
- #### Miscellaneous Chores
135
- - (**version**) 0.13.2 - (39b0145) - Cocogitto Bot
136
- - (**version**) 0.12.3 - (cd06fc0) - Cocogitto Bot
137
- - (**version**) 0.12.2 - (35b2ff3) - Cocogitto Bot
138
- - (**version**) 0.12.1 - (c548105) - Cocogitto Bot
139
- - (**version**) 0.11.1 - (659ebd3) - Cocogitto Bot
140
- - adding a comment - (c5c603b) - Malik Najjar
141
-
142
- - - -
143
-
144
- ## storage-ext@0.6.0 - 2026-02-17
145
- #### Features
146
- - implement event overrides for collection creation and update workflows - (8a05d74) - Malik Najjar
147
-
148
- - - -
149
-
150
- ## storage-ext@0.5.3 - 2026-02-17
151
- #### Bug Fixes
152
- - fixing the publishing issue - (f4d1641) - Malik Najjar
153
-
154
- - - -
155
-
156
- ## storage-ext@0.5.2 - 2026-02-17
157
- #### Bug Fixes
158
- - publishing the storage studio - (d7dd43e) - Malik Najjar
159
- #### Miscellaneous Chores
160
- - (**version**) 0.10.2 - (2c92a7d) - Cocogitto Bot
161
-
162
- - - -
163
-
164
- ## storage-ext@0.5.1 - 2026-02-17
165
- #### Bug Fixes
166
- - fixing the storage publish issue - (b75d8d1) - Malik Najjar
167
-
168
- - - -
169
-
170
- ## storage-ext@0.5.0 - 2026-02-17
171
- #### Features
172
- - implement storage workflows and controllers for file management - (b9efd0f) - Malik Najjar
173
- #### Bug Fixes
174
- - update the auth extension - (5318dda) - Malik Najjar
175
- #### Miscellaneous Chores
176
- - added important todo to the storage extension - (43d0bec) - Malik Najjar
177
- - seperating types from the services file - (8c7bdce) - Malik Najjar
178
-
179
- - - -
180
-
181
- ## storage-ext@0.4.0 - 2026-02-16
182
- #### Features
183
- - adding the ability to upload files in the ui - (1d7b346) - Malik Najjar
184
- - update event name in storage workflow and enhance Instagram webhook file handling - (a0cb186) - Malik Najjar
185
-
186
- - - -
187
-
188
- ## storage-ext@0.3.0 - 2026-02-16
189
- #### Features
190
- - enhance storage services with URL file creation and path validation - (1a33fa6) - Malik Najjar
191
-
192
- - - -
193
-
194
- ## storage-ext@0.2.0 - 2026-02-16
195
- #### Features
196
- - implement storage adapter and services, refactor workflows - (abd9ee5) - Malik Najjar
197
-
198
- - - -
199
-
200
- ## storage-ext@0.1.29 - 2026-02-15
201
- #### Bug Fixes
202
- - fix deno publish issue - (e8dcc4f) - malik ben
203
- - issue fix - (63d66d3) - malik ben
204
- #### Miscellaneous Chores
205
- - (**version**) 0.5.5 - (d4dedeb) - Cocogitto Bot
206
- - (**version**) 0.5.4 - (1ca3970) - Cocogitto Bot
207
- - (**version**) 0.5.3 - (dcdb9cb) - Cocogitto Bot
208
- - (**version**) 0.5.2 - (aa66e29) - Cocogitto Bot
209
- - (**version**) 0.5.1 - (41b7c35) - Cocogitto Bot
210
- - (**version**) 0.5.0 - (af63147) - Cocogitto Bot
211
- - (**version**) 0.4.4 - (eaed3b4) - Cocogitto Bot
212
- - (**version**) 0.4.3 - (ea9ec49) - Cocogitto Bot
213
-
214
- - - -
215
-
216
- Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto).
package/lobb.ts DELETED
@@ -1,54 +0,0 @@
1
- import { Lobb } from "@lobb-js/core";
2
- import { storage } from "./extensions/storage/index.ts";
3
-
4
- Lobb.init({
5
- project: {
6
- name: "Storage Extension Test",
7
- force_sync: true,
8
- },
9
- database: {
10
- host: Bun.env.DATABASE_HOST ?? "localhost",
11
- port: Number(Bun.env.DATABASE_PORT ?? 5432),
12
- username: Bun.env.DATABASE_USER ?? "test",
13
- password: Bun.env.DATABASE_PASSWORD ?? "test",
14
- database: Bun.env.DATABASE_NAME ?? "storage_ext",
15
- },
16
- web_server: {
17
- host: Bun.env.WEB_SERVER_HOST ?? "0.0.0.0",
18
- port: Number(Bun.env.WEB_SERVER_PORT ?? 3000),
19
- cors: {
20
- origin: "*",
21
- },
22
- },
23
- extensions: [
24
- storage({
25
- adapter: "local",
26
- storagePath: "./storage",
27
- }),
28
- ],
29
- collections: {
30
- articles: {
31
- indexes: {},
32
- fields: {
33
- id: {
34
- type: "integer",
35
- },
36
- image: {
37
- type: "string",
38
- length: 255,
39
- },
40
- title: {
41
- type: "string",
42
- length: 255,
43
- validators: {
44
- required: true,
45
- },
46
- },
47
- body: {
48
- type: "string",
49
- length: 255,
50
- },
51
- },
52
- },
53
- },
54
- });
@@ -1,12 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Postpublish script for @lobb-js/lobb-ext-storage
4
- # Reverts package.json exports and cleans dist to avoid uncommitted changes
5
-
6
- echo "๐Ÿ“ Reverting package.json exports to development mode..."
7
- jq '."exports"["./studio"] = "./extensions/storage/studio/index.ts"' package.json > package.json.tmp && mv package.json.tmp package.json
8
-
9
- echo "๐Ÿงน Cleaning dist directory..."
10
- rm -rf dist
11
-
12
- echo "โœ… Postpublish complete"
@@ -1,17 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Prepublish script for @lobb-js/lobb-ext-storage
4
- # Builds the studio package and updates exports for publishing
5
-
6
- echo "๐Ÿ“ฆ Building studio package..."
7
- bun run package
8
-
9
- if [ $? -ne 0 ]; then
10
- echo "โŒ Build failed"
11
- exit 1
12
- fi
13
-
14
- echo "๐Ÿ“ Updating package.json exports for publishing..."
15
- jq '."exports"["./studio"] = {"svelte": "./dist/index.js", "types": "./dist/index.d.ts"}' package.json > package.json.tmp && mv package.json.tmp package.json
16
-
17
- echo "โœ… Prepublish complete"
package/studio/app.html DELETED
@@ -1,12 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%sveltekit.assets%/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- %sveltekit.head%
8
- </head>
9
- <body data-sveltekit-preload-data="hover">
10
- <div style="display: contents">%sveltekit.body%</div>
11
- </body>
12
- </html>
@@ -1,7 +0,0 @@
1
- <script lang="ts">
2
- import "@lobb-js/studio/app.css";
3
-
4
- let { children } = $props();
5
- </script>
6
-
7
- {@render children()}
@@ -1 +0,0 @@
1
- export const ssr = false;
@@ -1,6 +0,0 @@
1
- <script lang="ts">
2
- import { Studio } from "@lobb-js/studio";
3
- import { env } from "$env/dynamic/public";
4
- </script>
5
-
6
- <Studio lobbUrl={env.PUBLIC_LOBB_URL} />
package/svelte.config.js DELETED
@@ -1,24 +0,0 @@
1
- import adapter from '@sveltejs/adapter-node';
2
-
3
- /** @type {import('@sveltejs/kit').Config} */
4
- const config = {
5
- kit: {
6
- adapter: adapter(),
7
- paths: {
8
- base: '/studio'
9
- },
10
- files: {
11
- lib: 'studio/lib',
12
- routes: 'studio/routes',
13
- appTemplate: 'studio/app.html',
14
- assets: 'public',
15
- hooks: {
16
- server: 'studio/hooks.server',
17
- client: 'studio/hooks.client',
18
- },
19
- params: 'studio/params',
20
- }
21
- }
22
- };
23
-
24
- export default config;
package/todo.md DELETED
@@ -1,36 +0,0 @@
1
- # high priority
2
-
3
- - move the validation logic that checks if the directory of uploaded file path exists or not in the service level and not in the controller level.
4
-
5
- - a better way to implement this extension is to update or overright the collectionService. so that you can use the same exsting CollectionService class normally but with the ability to adjust the params of that service funciton. so the storage extension version of the normal collection overright will have different params set. for example it should have a param of type blob or File. so you shouldnt really expose services. in the mod.ts. the services already exists why expose. we shouldnt really have at all the services property
6
- - remove services from this extension and from everywhere
7
- - instead of creating your own service method. you can just overwrite or update the existing method
8
- - for example to upload a file you can just use the collectionService mutated create version instead of creating your own function
9
- - you need to also overwrite the controllers to call the new service function correctly
10
- - this way is much better from exposing a bunch of service functions and more consistant
11
- - you should use workflows to overwrite the controllers and the services
12
- - make sure the tests work correctly
13
- - remove totally the services from this extension and from the extensionSystem totally
14
- - go to the `social_to_courier` and fix the storage update part.
15
-
16
- - remove the unique index of (location, name)
17
- - implement uploading a file by drag and drop
18
- - implement the listview
19
-
20
- # low priority
21
-
22
- - you need to add a refresh button
23
- - when the user tries to upload a file or a directory in a non existing.
24
- directory you have to respond with a 400 Error
25
- - check if a file exists by sending a GET request instead of reading the
26
- directory. because thats a unit test specific to local adapter. but the first
27
- way would work in all kinds of adapters. and it will make the unit tests more
28
- adaptable
29
- - prevent the user from not adding a / at the beggining of the path or adding a
30
- / at the end of the path when inserting or updating a storage record and make
31
- sure the path is not empty
32
- - implement a validation mechanism at the instatiating of the storage extension
33
- that checks of all operations are successfully doable in that specific adapter
34
- without issues. (really important)
35
- - Allow multiple versions of a file to be stored, enabling users to access
36
- previous versions if needed.