@c-time/frelio-cms 1.3.6 → 1.3.8

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 (32) hide show
  1. package/functions/api/auth/callback.js +122 -0
  2. package/functions/api/storage/_middleware.js +1012 -0
  3. package/functions/api/storage/files/[uuid].js +19 -0
  4. package/functions/api/storage/list.js +8 -0
  5. package/functions/api/storage/rebuild/[year].js +14 -0
  6. package/functions/api/storage/upload-set.js +7 -0
  7. package/functions/api/storage/upload.js +7 -0
  8. package/functions/api/storage/years.js +7 -0
  9. package/package.json +7 -3
  10. package/workers/file-upload/package-lock.json +1606 -0
  11. package/workers/file-upload/package.json +14 -0
  12. package/workers/file-upload/src/controller/DIContainer.ts +103 -0
  13. package/workers/file-upload/src/controller/FileController.ts +248 -0
  14. package/workers/file-upload/src/domain/AuthEntity.ts +17 -0
  15. package/workers/file-upload/src/domain/FileEntity.ts +113 -0
  16. package/workers/file-upload/src/index.ts +134 -0
  17. package/workers/file-upload/src/infra/LoggerSingleton.ts +162 -0
  18. package/workers/file-upload/src/presenter/HttpPresenterImpl.ts +86 -0
  19. package/workers/file-upload/src/repository/AuthRepositoryPort.ts +11 -0
  20. package/workers/file-upload/src/repository/GitHubAuthRepositoryImpl.ts +58 -0
  21. package/workers/file-upload/src/repository/R2RepositoryImpl.ts +145 -0
  22. package/workers/file-upload/src/repository/R2RepositoryPort.ts +86 -0
  23. package/workers/file-upload/src/usecase/DeleteFileUseCase.ts +97 -0
  24. package/workers/file-upload/src/usecase/GetFileUseCase.ts +50 -0
  25. package/workers/file-upload/src/usecase/ListFilesUseCase.ts +52 -0
  26. package/workers/file-upload/src/usecase/RebuildIndexUseCase.ts +182 -0
  27. package/workers/file-upload/src/usecase/UpdateFileMetadataUseCase.ts +43 -0
  28. package/workers/file-upload/src/usecase/UploadFileUseCase.ts +62 -0
  29. package/workers/file-upload/src/usecase/UploadImageSetUseCase.ts +95 -0
  30. package/workers/file-upload/src/usecase/ValidateAuthUseCase.ts +26 -0
  31. package/workers/file-upload/tsconfig.json +13 -0
  32. package/workers/file-upload/wrangler.toml.example +11 -0
@@ -0,0 +1,19 @@
1
+ // functions/api/storage/files/[uuid].ts
2
+ var onRequestGet = async (context) => {
3
+ const uuid = context.params.uuid;
4
+ return context.data.controller.handleGetFile(uuid);
5
+ };
6
+ var onRequestPatch = async (context) => {
7
+ const uuid = context.params.uuid;
8
+ return context.data.controller.handleUpdateFileMetadata(uuid, context.request);
9
+ };
10
+ var onRequestDelete = async (context) => {
11
+ const uuid = context.params.uuid;
12
+ const url = new URL(context.request.url);
13
+ return context.data.controller.handleDeleteFile(uuid, url);
14
+ };
15
+ export {
16
+ onRequestDelete,
17
+ onRequestGet,
18
+ onRequestPatch
19
+ };
@@ -0,0 +1,8 @@
1
+ // functions/api/storage/list.ts
2
+ var onRequestGet = async (context) => {
3
+ const url = new URL(context.request.url);
4
+ return context.data.controller.handleListFiles(url);
5
+ };
6
+ export {
7
+ onRequestGet
8
+ };
@@ -0,0 +1,14 @@
1
+ // functions/api/storage/rebuild/[year].ts
2
+ var onRequestPost = async (context) => {
3
+ const year = parseInt(context.params.year);
4
+ if (isNaN(year)) {
5
+ return new Response(JSON.stringify({ error: "Invalid year" }), {
6
+ status: 400,
7
+ headers: { "Content-Type": "application/json" }
8
+ });
9
+ }
10
+ return context.data.controller.handleRebuildIndex(year);
11
+ };
12
+ export {
13
+ onRequestPost
14
+ };
@@ -0,0 +1,7 @@
1
+ // functions/api/storage/upload-set.ts
2
+ var onRequestPost = async (context) => {
3
+ return context.data.controller.handleUploadSet(context.request, context);
4
+ };
5
+ export {
6
+ onRequestPost
7
+ };
@@ -0,0 +1,7 @@
1
+ // functions/api/storage/upload.ts
2
+ var onRequestPost = async (context) => {
3
+ return context.data.controller.handleUpload(context.request);
4
+ };
5
+ export {
6
+ onRequestPost
7
+ };
@@ -0,0 +1,7 @@
1
+ // functions/api/storage/years.ts
2
+ var onRequestGet = async (context) => {
3
+ return context.data.controller.handleGetYears();
4
+ };
5
+ export {
6
+ onRequestGet
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c-time/frelio-cms",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "description": "Frelio CMS Admin - pre-built static bundle for 1-repo setup",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -12,14 +12,18 @@
12
12
  "access": "public"
13
13
  },
14
14
  "files": [
15
- "dist"
15
+ "dist",
16
+ "functions",
17
+ "workers"
16
18
  ],
17
19
  "type": "module",
18
20
  "scripts": {
19
21
  "dev": "vite",
20
22
  "dev:full": "wrangler pages dev --compatibility-date=2024-01-01 -- vite",
21
23
  "build": "vite build",
22
- "prepublishOnly": "vite build",
24
+ "build:functions": "node scripts/bundle-functions.mjs",
25
+ "prepublishOnly": "vite build && npm run build:functions && cp -r functions functions-src && rm -rf functions && cp -r _dist_functions functions && cp -r ../../workers ./workers",
26
+ "postpublish": "rm -rf functions workers _dist_functions && cp -r functions-src functions && rm -rf functions-src",
23
27
  "preview": "vite preview",
24
28
  "typecheck": "tsc --noEmit",
25
29
  "test": "vitest",