@arch-cadre/vercel-blob-module 1.0.26 → 1.0.28

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/dist/index.cjs CHANGED
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _server = require("@arch-cadre/core/server");
8
8
  var _intl = require("@arch-cadre/intl");
9
+ var _global = _interopRequireDefault(require("../locales/en/global.json"));
10
+ var _global2 = _interopRequireDefault(require("../locales/pl/global.json"));
9
11
  var _manifest = _interopRequireDefault(require("../manifest.json"));
10
12
  var _settings = require("./actions/settings.cjs");
11
13
  var _vercel = require("./providers/vercel.cjs");
@@ -13,6 +15,10 @@ var _routes = require("./routes.cjs");
13
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
16
  const vercelBlobModule = {
15
17
  manifest: _manifest.default,
18
+ translations: {
19
+ en: _global.default,
20
+ pl: _global2.default
21
+ },
16
22
  routes: {
17
23
  private: _routes.privateRoutes
18
24
  },
package/dist/index.mjs CHANGED
@@ -1,11 +1,17 @@
1
1
  import { filesystemService } from "@arch-cadre/core/server";
2
2
  import { i18n } from "@arch-cadre/intl";
3
+ import localesEn from "../locales/en/global.json" with { type: "json" };
4
+ import localesPl from "../locales/pl/global.json" with { type: "json" };
3
5
  import manifest from "../manifest.json";
4
6
  import { getBlobConfig } from "./actions/settings.mjs";
5
7
  import { VercelBlobProvider } from "./providers/vercel.mjs";
6
8
  import { privateRoutes } from "./routes.mjs";
7
9
  const vercelBlobModule = {
8
10
  manifest,
11
+ translations: {
12
+ en: localesEn,
13
+ pl: localesPl
14
+ },
9
15
  routes: {
10
16
  private: privateRoutes
11
17
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arch-cadre/vercel-blob-module",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "Activity module for Kryo framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -13,7 +13,6 @@
13
13
  },
14
14
  "files": [
15
15
  "dist",
16
- "src",
17
16
  "locales",
18
17
  "manifest.json"
19
18
  ],
@@ -27,14 +26,14 @@
27
26
  },
28
27
  "dependencies": {
29
28
  "@vercel/blob": "^2.2.0",
30
- "@arch-cadre/ui": "^0.0.68",
31
- "@arch-cadre/modules": "^0.0.96",
29
+ "@arch-cadre/ui": "^0.0.70",
30
+ "@arch-cadre/modules": "^0.0.98",
32
31
  "drizzle-orm": "1.0.0-beta.6-4414a19",
33
32
  "pg": "^8.16.3",
34
33
  "zod": "^3.24.1"
35
34
  },
36
35
  "devDependencies": {
37
- "@arch-cadre/core": "^0.0.70",
36
+ "@arch-cadre/core": "^0.0.72",
38
37
  "@types/react": "^19",
39
38
  "@types/pg": "^8.16.0",
40
39
  "next": "16.1.1",
@@ -43,9 +42,9 @@
43
42
  "unbuild": "^3.6.1"
44
43
  },
45
44
  "peerDependencies": {
46
- "@arch-cadre/core": "^0.0.70",
47
- "@arch-cadre/intl": "^0.0.70",
48
- "@arch-cadre/ui": "^0.0.68",
45
+ "@arch-cadre/core": "^0.0.72",
46
+ "@arch-cadre/intl": "^0.0.72",
47
+ "@arch-cadre/ui": "^0.0.70",
49
48
  "next": ">=13.0.0",
50
49
  "react": "^19.0.0"
51
50
  },
@@ -1,24 +0,0 @@
1
- "use server";
2
-
3
- import {
4
- getKryoPathPrefix,
5
- getModuleConfig,
6
- updateModuleConfig,
7
- } from "@arch-cadre/modules/server";
8
- import { revalidatePath } from "next/cache";
9
-
10
- export interface BlobConfig {
11
- clientId: string;
12
- }
13
-
14
- export async function getBlobConfig() {
15
- const config = await getModuleConfig<BlobConfig>("vercel-blob");
16
- return config || { clientId: "" };
17
- }
18
-
19
- export async function updateBlobConfig(config: BlobConfig) {
20
- await updateModuleConfig("vercel-blob", config);
21
- revalidatePath(`${getKryoPathPrefix()}/vercel-blob/settings`);
22
-
23
- return { success: true };
24
- }
package/src/index.ts DELETED
@@ -1,55 +0,0 @@
1
- import { filesystemService } from "@arch-cadre/core/server";
2
- import { i18n } from "@arch-cadre/intl";
3
- import type { IModule } from "@arch-cadre/modules";
4
- import manifest from "../manifest.json";
5
- import { getBlobConfig } from "./actions/settings";
6
- import { VercelBlobProvider } from "./providers/vercel";
7
- import { privateRoutes } from "./routes";
8
-
9
- const vercelBlobModule: IModule = {
10
- manifest,
11
-
12
- routes: {
13
- private: privateRoutes,
14
- },
15
-
16
- navigation: {
17
- admin: {
18
- [i18n("System")]: [
19
- {
20
- id: "vercel-blob-settings",
21
- title: i18n("Vercel Blob Storage"),
22
- url: "/vercel-blob/settings",
23
- icon: "solar:folder-with-files-bold-duotone",
24
- },
25
- ],
26
- },
27
- },
28
-
29
- onEnable: async () => {
30
- filesystemService.registerProvider(new VercelBlobProvider());
31
-
32
- const config = await getBlobConfig();
33
-
34
- if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
35
- filesystemService.setDefaultProvider("vercel-blob");
36
- }
37
- },
38
-
39
- onDisable: async () => {
40
- filesystemService.setDefaultProvider("local");
41
- filesystemService.unregisterProvider("vercel-blob");
42
- },
43
-
44
- init: async () => {
45
- // This runs on app start. Registry already checks if enabled.
46
- filesystemService.registerProvider(new VercelBlobProvider());
47
- const config = await getBlobConfig();
48
-
49
- if (process.env.BLOB_READ_WRITE_TOKEN || config.clientId) {
50
- filesystemService.setDefaultProvider("vercel-blob");
51
- }
52
- },
53
- };
54
-
55
- export default vercelBlobModule;
@@ -1,88 +0,0 @@
1
- "use client";
2
- import { useTranslation } from "@arch-cadre/intl";
3
- import { toast } from "@arch-cadre/ui";
4
- import { Button } from "@arch-cadre/ui/components/button";
5
- import {
6
- Card,
7
- CardContent,
8
- CardDescription,
9
- CardHeader,
10
- CardTitle,
11
- } from "@arch-cadre/ui/components/card";
12
- import { Input } from "@arch-cadre/ui/components/input";
13
- import { Label } from "@arch-cadre/ui/components/label";
14
- import * as React from "react";
15
- import { useEffect, useState } from "react";
16
- import {
17
- type BlobConfig,
18
- getBlobConfig,
19
- updateBlobConfig,
20
- } from "../actions/settings";
21
-
22
- export default function BlobSettingsPage() {
23
- const { t } = useTranslation();
24
-
25
- const [config, setConfig] = useState<BlobConfig>({
26
- clientId: "",
27
- });
28
- const [loading, setLoading] = useState(true);
29
-
30
- useEffect(() => {
31
- getBlobConfig().then((data) => {
32
- setConfig(data);
33
- setLoading(false);
34
- });
35
- }, []);
36
-
37
- const handleSave = async (e: React.FormEvent) => {
38
- e.preventDefault();
39
- try {
40
- await updateBlobConfig(config);
41
- toast.success(t("Settings saved successfully"));
42
- } catch (_error) {
43
- toast.error(
44
- t(
45
- "Failed to save settings. Please check your configuration and try again.",
46
- ),
47
- );
48
- }
49
- };
50
-
51
- if (loading) return <div>{t("Vercel Blob loading...")}</div>;
52
-
53
- return (
54
- <div className="container mx-auto py-10 max-w-2xl">
55
- <Card>
56
- <CardHeader>
57
- <div>{t("Vercel Blob")}</div>
58
- <div>{t("")}</div>
59
-
60
- <CardTitle>{t("Vercel Blob Settings")}</CardTitle>
61
- <CardDescription>
62
- {t(
63
- "Configure your Vercel Blob credentials. You can find these in the Vercel Dashboard.",
64
- )}
65
- </CardDescription>
66
- </CardHeader>
67
- <CardContent>
68
- <form onSubmit={handleSave} className="space-y-4">
69
- <div className="space-y-2">
70
- <Label htmlFor="clientId">{t("Client ID")}</Label>
71
- <Input
72
- id="clientId"
73
- value={config.clientId}
74
- onChange={(e) =>
75
- setConfig({ ...config, clientId: e.target.value })
76
- }
77
- placeholder="vercel_blob_rw_********************************"
78
- />
79
- </div>
80
- <Button type="submit" className="w-full">
81
- {t("Save Configuration")}
82
- </Button>
83
- </form>
84
- </CardContent>
85
- </Card>
86
- </div>
87
- );
88
- }
@@ -1,36 +0,0 @@
1
- import type { IStorageProvider, StorageResult } from "@arch-cadre/core/server";
2
- import { put } from "@vercel/blob";
3
- import { getBlobConfig } from "../actions/settings";
4
-
5
- export class VercelBlobProvider implements IStorageProvider {
6
- public id = "vercel-blob";
7
- public name = "Vercel Blob";
8
-
9
- public async upload(file: File): Promise<StorageResult> {
10
- const config = await getBlobConfig();
11
-
12
- if (!config.clientId) {
13
- return { error: "Vercel Blob token is not configured" };
14
- }
15
-
16
- try {
17
- const blob = await put(file.name, file, {
18
- access: "public",
19
- addRandomSuffix: true,
20
- token: config.clientId,
21
- });
22
-
23
- return {
24
- name: file.name,
25
- url: blob.url,
26
- type: file.type,
27
- size: file.size,
28
- service: "vercel-blob",
29
- serviceId: blob.pathname,
30
- };
31
- } catch (error: any) {
32
- console.error("[VercelBlob] Upload error:", error);
33
- return { error: error.message || "Failed to upload to Vercel Blob" };
34
- }
35
- }
36
- }
package/src/routes.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { PrivateRouteDefinition } from "@arch-cadre/modules";
2
- import BlobSettingsPage from "./pages/settings-page";
3
-
4
- export const privateRoutes: PrivateRouteDefinition[] = [
5
- {
6
- path: "/vercel-blob/settings", // Będzie widoczne pod /module/vercel-blob/settings
7
- component: BlobSettingsPage,
8
- auth: true,
9
- roles: ["admin"], // Tylko użytkownicy z rolą "admin" mogą uzyskać dostęp
10
- // 'permissions': ['system:vercel-blob-settings'], // Tylko użytkownicy z tą konkretną uprawnieniem mogą uzyskać dostęp
11
- },
12
- ];