storage-explorer 0.1.0 → 1.0.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 (41) hide show
  1. package/README.md +14 -0
  2. package/bunfig.toml +2 -0
  3. package/cli.js +98 -0
  4. package/dist/chunk-fa0pf3pw.js +11 -0
  5. package/dist/chunk-fa0pf3pw.js.map +24 -0
  6. package/dist/chunk-veptbhs8.css +1 -0
  7. package/dist/index.html +1 -1
  8. package/package.json +16 -2
  9. package/src/App.tsx +390 -0
  10. package/src/features/buckets/BucketPanel.tsx +93 -0
  11. package/src/features/objects/ObjectExplorer.tsx +129 -0
  12. package/src/features/objects/PathBreadcrumb.tsx +50 -0
  13. package/src/features/profiles/ProfileSidebar.tsx +167 -0
  14. package/src/frontend.tsx +26 -0
  15. package/{dist/chunk-js4y3bna.css → src/index.css} +134 -111
  16. package/src/index.html +13 -0
  17. package/src/index.ts +22 -0
  18. package/src/logo.svg +1 -0
  19. package/src/server/http/response.ts +12 -0
  20. package/src/server/routes/s3Routes.ts +17 -0
  21. package/src/server/s3/client.ts +14 -0
  22. package/src/server/s3/handlers.ts +96 -0
  23. package/src/server/s3/mappers.ts +73 -0
  24. package/src/server/s3/types.ts +15 -0
  25. package/src/server/s3/validate.ts +103 -0
  26. package/src/shared/api/s3Api.ts +56 -0
  27. package/src/shared/hooks/useProfilesStorage.ts +175 -0
  28. package/src/shared/types/s3.ts +42 -0
  29. package/dist/chunk-vtsn1g38.js +0 -1022
  30. package/dist/index-3xfxtfws.js +0 -238
  31. package/dist/index-3xfxtfws.js.map +0 -24
  32. package/dist/index-67w6q0ny.css +0 -1
  33. package/dist/index-9t8tyk25.js +0 -238
  34. package/dist/index-9t8tyk25.js.map +0 -24
  35. package/dist/index-b7b12360.css +0 -1
  36. package/dist/index-bz8f0q85.js +0 -238
  37. package/dist/index-bz8f0q85.js.map +0 -18
  38. package/dist/index-vw9287sb.js +0 -238
  39. package/dist/index-vw9287sb.js.map +0 -18
  40. package/dist/index-xde44bqw.css +0 -1
  41. package/dist/index.js +0 -29485
@@ -0,0 +1,50 @@
1
+ type PathBreadcrumbProps = {
2
+ bucket: string;
3
+ prefix: string;
4
+ loading: boolean;
5
+ onNavigatePrefix: (prefix: string) => void;
6
+ };
7
+
8
+ export function PathBreadcrumb(props: PathBreadcrumbProps) {
9
+ const { bucket, prefix, loading, onNavigatePrefix } = props;
10
+
11
+ if (!bucket) {
12
+ return (
13
+ <div className="path-breadcrumb muted">
14
+ <span>Bucket path will appear here.</span>
15
+ </div>
16
+ );
17
+ }
18
+
19
+ const segments = prefix.split("/").filter(Boolean);
20
+
21
+ return (
22
+ <div className="path-breadcrumb">
23
+ <button
24
+ type="button"
25
+ className="breadcrumb-link"
26
+ onClick={() => onNavigatePrefix("")}
27
+ disabled={loading}
28
+ >
29
+ {bucket}
30
+ </button>
31
+
32
+ {segments.map((segment, index) => {
33
+ const targetPrefix = `${segments.slice(0, index + 1).join("/")}/`;
34
+ return (
35
+ <span key={targetPrefix} className="breadcrumb-segment">
36
+ <span className="breadcrumb-separator">/</span>
37
+ <button
38
+ type="button"
39
+ className="breadcrumb-link"
40
+ onClick={() => onNavigatePrefix(targetPrefix)}
41
+ disabled={loading}
42
+ >
43
+ {segment}
44
+ </button>
45
+ </span>
46
+ );
47
+ })}
48
+ </div>
49
+ );
50
+ }
@@ -0,0 +1,167 @@
1
+ import type { FormEvent } from "react";
2
+ import type { EditableProfile, SavedProfile } from "../../shared/types/s3";
3
+
4
+ type ProfileSidebarProps = {
5
+ profiles: SavedProfile[];
6
+ selectedProfileId: string | null;
7
+ isEditingExisting: boolean;
8
+ form: EditableProfile;
9
+ showSecret: boolean;
10
+ statusMessage: string;
11
+ statusError: string;
12
+ testingConnection: boolean;
13
+ onCreateNewProfile: () => void;
14
+ onSelectProfile: (profile: SavedProfile) => void;
15
+ onDeleteProfile: (profileId: string) => void;
16
+ onSaveProfile: (event: FormEvent<HTMLFormElement>) => void;
17
+ onTestConnection: () => void;
18
+ onToggleSecret: () => void;
19
+ onFormChange: <K extends keyof EditableProfile>(field: K, value: EditableProfile[K]) => void;
20
+ };
21
+
22
+ export function ProfileSidebar(props: ProfileSidebarProps) {
23
+ const {
24
+ profiles,
25
+ selectedProfileId,
26
+ isEditingExisting,
27
+ form,
28
+ showSecret,
29
+ statusMessage,
30
+ statusError,
31
+ testingConnection,
32
+ onCreateNewProfile,
33
+ onSelectProfile,
34
+ onDeleteProfile,
35
+ onSaveProfile,
36
+ onTestConnection,
37
+ onToggleSecret,
38
+ onFormChange,
39
+ } = props;
40
+
41
+ return (
42
+ <aside className="panel profile-panel">
43
+ <div className="panel-step">Step 1</div>
44
+ <div className="panel-header">
45
+ <h1>Connection Profile</h1>
46
+ <p>Save and reuse credentials in your browser.</p>
47
+ </div>
48
+
49
+ <div className="profiles-toolbar">
50
+ <strong>Saved Profiles</strong>
51
+ <button type="button" className="ghost-button" onClick={onCreateNewProfile}>
52
+ New
53
+ </button>
54
+ </div>
55
+
56
+ <div className="profiles-list" role="list" aria-label="Saved profiles">
57
+ {profiles.length === 0 && <p className="empty-copy">No saved profiles yet.</p>}
58
+ {profiles.map(profile => (
59
+ <div
60
+ key={profile.id}
61
+ className={`profile-card ${profile.id === selectedProfileId ? "active" : ""}`}
62
+ role="listitem"
63
+ >
64
+ <button type="button" className="profile-select" onClick={() => onSelectProfile(profile)}>
65
+ <span className="profile-name">{profile.name || "Unnamed profile"}</span>
66
+ <span className="profile-endpoint">{profile.endpoint}</span>
67
+ </button>
68
+ <button
69
+ type="button"
70
+ className="delete-button"
71
+ onClick={() => onDeleteProfile(profile.id)}
72
+ aria-label={`Delete ${profile.name || "profile"}`}
73
+ >
74
+ Delete
75
+ </button>
76
+ </div>
77
+ ))}
78
+ </div>
79
+
80
+ <form className="profile-form" onSubmit={onSaveProfile}>
81
+ <label>
82
+ Profile Name
83
+ <input
84
+ type="text"
85
+ value={form.name}
86
+ onChange={event => onFormChange("name", event.target.value)}
87
+ placeholder="MinIO dev, staging S3"
88
+ />
89
+ </label>
90
+
91
+ <label>
92
+ Endpoint URL *
93
+ <input
94
+ type="url"
95
+ value={form.endpoint}
96
+ onChange={event => onFormChange("endpoint", event.target.value)}
97
+ placeholder="https://s3.amazonaws.com"
98
+ required
99
+ />
100
+ </label>
101
+
102
+ <label>
103
+ Region
104
+ <input
105
+ type="text"
106
+ value={form.region}
107
+ onChange={event => onFormChange("region", event.target.value)}
108
+ placeholder="us-east-1"
109
+ />
110
+ </label>
111
+
112
+ <label>
113
+ Access Key ID *
114
+ <input
115
+ type="text"
116
+ value={form.accessKeyId}
117
+ onChange={event => onFormChange("accessKeyId", event.target.value)}
118
+ autoComplete="off"
119
+ required
120
+ />
121
+ </label>
122
+
123
+ <label>
124
+ Secret Access Key *
125
+ <div className="secret-row">
126
+ <input
127
+ type={showSecret ? "text" : "password"}
128
+ value={form.secretAccessKey}
129
+ onChange={event => onFormChange("secretAccessKey", event.target.value)}
130
+ autoComplete="off"
131
+ required
132
+ />
133
+ <button type="button" className="ghost-button" onClick={onToggleSecret}>
134
+ {showSecret ? "Hide" : "Show"}
135
+ </button>
136
+ </div>
137
+ </label>
138
+
139
+ <label className="checkbox-row">
140
+ <input
141
+ type="checkbox"
142
+ checked={form.forcePathStyle}
143
+ onChange={event => onFormChange("forcePathStyle", event.target.checked)}
144
+ />
145
+ Force path style
146
+ </label>
147
+
148
+ <div className="form-actions">
149
+ <button type="submit" className="primary-button">
150
+ {isEditingExisting ? "Update Profile" : "Save Profile"}
151
+ </button>
152
+ <button
153
+ type="button"
154
+ className="secondary-button"
155
+ onClick={onTestConnection}
156
+ disabled={testingConnection}
157
+ >
158
+ {testingConnection ? "Testing..." : "Test Connection"}
159
+ </button>
160
+ </div>
161
+ </form>
162
+
163
+ {statusMessage && <p className="status-ok">{statusMessage}</p>}
164
+ {statusError && <p className="status-error">{statusError}</p>}
165
+ </aside>
166
+ );
167
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * This file is the entry point for the React app, it sets up the root
3
+ * element and renders the App component to the DOM.
4
+ *
5
+ * It is included in `src/index.html`.
6
+ */
7
+
8
+ import { StrictMode } from "react";
9
+ import { createRoot } from "react-dom/client";
10
+ import { App } from "./App";
11
+
12
+ const elem = document.getElementById("root")!;
13
+ const app = (
14
+ <StrictMode>
15
+ <App />
16
+ </StrictMode>
17
+ );
18
+
19
+ if (import.meta.hot) {
20
+ // With hot module reloading, `import.meta.hot.data` is persisted.
21
+ const root = (import.meta.hot.data.root ??= createRoot(elem));
22
+ root.render(app);
23
+ } else {
24
+ // The hot module reloading API is not available in production.
25
+ createRoot(elem).render(app);
26
+ }