@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.
- package/functions/api/auth/callback.js +122 -0
- package/functions/api/storage/_middleware.js +1012 -0
- package/functions/api/storage/files/[uuid].js +19 -0
- package/functions/api/storage/list.js +8 -0
- package/functions/api/storage/rebuild/[year].js +14 -0
- package/functions/api/storage/upload-set.js +7 -0
- package/functions/api/storage/upload.js +7 -0
- package/functions/api/storage/years.js +7 -0
- package/package.json +7 -3
- package/workers/file-upload/package-lock.json +1606 -0
- package/workers/file-upload/package.json +14 -0
- package/workers/file-upload/src/controller/DIContainer.ts +103 -0
- package/workers/file-upload/src/controller/FileController.ts +248 -0
- package/workers/file-upload/src/domain/AuthEntity.ts +17 -0
- package/workers/file-upload/src/domain/FileEntity.ts +113 -0
- package/workers/file-upload/src/index.ts +134 -0
- package/workers/file-upload/src/infra/LoggerSingleton.ts +162 -0
- package/workers/file-upload/src/presenter/HttpPresenterImpl.ts +86 -0
- package/workers/file-upload/src/repository/AuthRepositoryPort.ts +11 -0
- package/workers/file-upload/src/repository/GitHubAuthRepositoryImpl.ts +58 -0
- package/workers/file-upload/src/repository/R2RepositoryImpl.ts +145 -0
- package/workers/file-upload/src/repository/R2RepositoryPort.ts +86 -0
- package/workers/file-upload/src/usecase/DeleteFileUseCase.ts +97 -0
- package/workers/file-upload/src/usecase/GetFileUseCase.ts +50 -0
- package/workers/file-upload/src/usecase/ListFilesUseCase.ts +52 -0
- package/workers/file-upload/src/usecase/RebuildIndexUseCase.ts +182 -0
- package/workers/file-upload/src/usecase/UpdateFileMetadataUseCase.ts +43 -0
- package/workers/file-upload/src/usecase/UploadFileUseCase.ts +62 -0
- package/workers/file-upload/src/usecase/UploadImageSetUseCase.ts +95 -0
- package/workers/file-upload/src/usecase/ValidateAuthUseCase.ts +26 -0
- package/workers/file-upload/tsconfig.json +13 -0
- 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,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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c-time/frelio-cms",
|
|
3
|
-
"version": "1.3.
|
|
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
|
-
"
|
|
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",
|