@hintergrund/worker 0.1.6 → 0.1.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/dist/api/cms/handlers/admin-users.handler.d.ts +8 -0
- package/dist/api/cms/handlers/admin-users.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/admin-users.handler.js +121 -0
- package/dist/api/cms/handlers/agent-conversations.handler.d.ts +7 -0
- package/dist/api/cms/handlers/agent-conversations.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/agent-conversations.handler.js +94 -0
- package/dist/api/cms/handlers/auth.handler.d.ts +0 -3
- package/dist/api/cms/handlers/auth.handler.d.ts.map +1 -1
- package/dist/api/cms/handlers/auth.handler.js +74 -153
- package/dist/api/cms/handlers/dashboard.handler.js +1 -1
- package/dist/api/cms/handlers/website-repo.handler.d.ts +8 -0
- package/dist/api/cms/handlers/website-repo.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/website-repo.handler.js +148 -0
- package/dist/api/cms/routes/index.d.ts.map +1 -1
- package/dist/api/cms/routes/index.js +16 -4
- package/dist/api/emails/handlers/campaigns.handler.d.ts +10 -23
- package/dist/api/emails/handlers/campaigns.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/campaigns.handler.js +164 -92
- package/dist/api/emails/handlers/invoice.handler.d.ts +5 -19
- package/dist/api/emails/handlers/invoice.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/invoice.handler.js +58 -340
- package/dist/api/emails/handlers/public.handler.d.ts +6 -29
- package/dist/api/emails/handlers/public.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/public.handler.js +150 -312
- package/dist/api/emails/handlers/send.handler.d.ts +5 -17
- package/dist/api/emails/handlers/send.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/send.handler.js +107 -92
- package/dist/api/emails/handlers/settings.handler.d.ts +28 -33
- package/dist/api/emails/handlers/settings.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/settings.handler.js +96 -287
- package/dist/api/emails/handlers/subscribers.handler.d.ts +13 -0
- package/dist/api/emails/handlers/subscribers.handler.d.ts.map +1 -0
- package/dist/api/emails/handlers/subscribers.handler.js +125 -0
- package/dist/api/emails/handlers/webhook.handler.d.ts +1 -2
- package/dist/api/emails/handlers/webhook.handler.d.ts.map +1 -1
- package/dist/api/emails/handlers/webhook.handler.js +66 -166
- package/dist/api/emails/routes/admin.routes.d.ts +1 -3
- package/dist/api/emails/routes/admin.routes.d.ts.map +1 -1
- package/dist/api/emails/routes/admin.routes.js +19 -49
- package/dist/api/emails/routes/public.routes.d.ts +1 -3
- package/dist/api/emails/routes/public.routes.d.ts.map +1 -1
- package/dist/api/emails/routes/public.routes.js +2 -9
- package/dist/api/shop/handlers/prices.handler.d.ts +2 -15
- package/dist/api/shop/handlers/prices.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/prices.handler.js +2 -83
- package/dist/api/shop/handlers/products.handler.d.ts +29 -20
- package/dist/api/shop/handlers/products.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/products.handler.js +195 -162
- package/dist/api/shop/handlers/public.handler.d.ts +24 -8
- package/dist/api/shop/handlers/public.handler.d.ts.map +1 -1
- package/dist/api/shop/handlers/public.handler.js +525 -78
- package/dist/api/shop/routes.d.ts.map +1 -1
- package/dist/api/shop/routes.js +14 -9
- package/dist/hintergrund-assets.d.ts +3 -2
- package/dist/hintergrund-assets.d.ts.map +1 -1
- package/dist/hintergrund-assets.js +4 -2
- package/dist/index.d.ts +15 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -4
- package/dist/lib/auth/crypto.d.ts +2 -15
- package/dist/lib/auth/crypto.d.ts.map +1 -1
- package/dist/lib/auth/crypto.js +8 -95
- package/dist/lib/auth/jwt.d.ts +0 -4
- package/dist/lib/auth/jwt.d.ts.map +1 -1
- package/dist/lib/auth/jwt.js +0 -6
- package/dist/lib/config.d.ts +8 -10
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +30 -106
- package/dist/lib/email-template.d.ts +15 -0
- package/dist/lib/email-template.d.ts.map +1 -0
- package/dist/lib/email-template.js +58 -0
- package/dist/lib/email.d.ts +18 -8
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js +59 -70
- package/dist/lib/github-app.d.ts +2 -0
- package/dist/lib/github-app.d.ts.map +1 -0
- package/dist/lib/github-app.js +49 -0
- package/dist/lib/github-config.d.ts +19 -0
- package/dist/lib/github-config.d.ts.map +1 -0
- package/dist/lib/github-config.js +23 -0
- package/dist/lib/github.d.ts +16 -3
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +38 -15
- package/dist/lib/project-db.d.ts +24 -0
- package/dist/lib/project-db.d.ts.map +1 -0
- package/dist/lib/project-db.js +172 -0
- package/dist/lib/template.js +4 -4
- package/dist/middleware/auth.d.ts +0 -2
- package/dist/middleware/auth.d.ts.map +1 -1
- package/dist/middleware/auth.js +21 -50
- package/package.json +3 -2
- package/dist/api/builder/handlers/generate.handler.d.ts +0 -12
- package/dist/api/builder/handlers/generate.handler.d.ts.map +0 -1
- package/dist/api/builder/handlers/generate.handler.js +0 -203
- package/dist/api/builder/handlers/template.handler.d.ts +0 -12
- package/dist/api/builder/handlers/template.handler.d.ts.map +0 -1
- package/dist/api/builder/handlers/template.handler.js +0 -208
- package/dist/api/builder/routes.d.ts +0 -7
- package/dist/api/builder/routes.d.ts.map +0 -1
- package/dist/api/builder/routes.js +0 -15
- package/dist/api/cms/handlers/assets.handler.d.ts +0 -31
- package/dist/api/cms/handlers/assets.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/assets.handler.js +0 -200
- package/dist/api/cms/handlers/config.handler.d.ts +0 -7
- package/dist/api/cms/handlers/config.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/config.handler.js +0 -37
- package/dist/api/cms/handlers/content.handler.d.ts +0 -21
- package/dist/api/cms/handlers/content.handler.d.ts.map +0 -1
- package/dist/api/cms/handlers/content.handler.js +0 -117
- package/dist/api/cms/routes/assets.routes.d.ts +0 -4
- package/dist/api/cms/routes/assets.routes.d.ts.map +0 -1
- package/dist/api/cms/routes/assets.routes.js +0 -13
- package/dist/api/cms/routes/content.routes.d.ts +0 -4
- package/dist/api/cms/routes/content.routes.d.ts.map +0 -1
- package/dist/api/cms/routes/content.routes.js +0 -11
- package/dist/api/emails/handlers/branding.handler.d.ts +0 -17
- package/dist/api/emails/handlers/branding.handler.d.ts.map +0 -1
- package/dist/api/emails/handlers/branding.handler.js +0 -120
- package/dist/api/emails/handlers/contacts.handler.d.ts +0 -37
- package/dist/api/emails/handlers/contacts.handler.d.ts.map +0 -1
- package/dist/api/emails/handlers/contacts.handler.js +0 -161
- package/dist/api/emails/handlers/templates.handler.d.ts +0 -32
- package/dist/api/emails/handlers/templates.handler.d.ts.map +0 -1
- package/dist/api/emails/handlers/templates.handler.js +0 -132
- package/dist/api/newsletter/handlers/email.handler.d.ts +0 -7
- package/dist/api/newsletter/handlers/email.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/email.handler.js +0 -102
- package/dist/api/newsletter/handlers/emails.handler.d.ts +0 -31
- package/dist/api/newsletter/handlers/emails.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/emails.handler.js +0 -262
- package/dist/api/newsletter/handlers/invoice.handler.d.ts +0 -22
- package/dist/api/newsletter/handlers/invoice.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/invoice.handler.js +0 -455
- package/dist/api/newsletter/handlers/public.handler.d.ts +0 -22
- package/dist/api/newsletter/handlers/public.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/public.handler.js +0 -300
- package/dist/api/newsletter/handlers/send.handler.d.ts +0 -12
- package/dist/api/newsletter/handlers/send.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/send.handler.js +0 -153
- package/dist/api/newsletter/handlers/subscribers.handler.d.ts +0 -22
- package/dist/api/newsletter/handlers/subscribers.handler.d.ts.map +0 -1
- package/dist/api/newsletter/handlers/subscribers.handler.js +0 -195
- package/dist/api/newsletter/routes/admin.routes.d.ts +0 -4
- package/dist/api/newsletter/routes/admin.routes.d.ts.map +0 -1
- package/dist/api/newsletter/routes/admin.routes.js +0 -28
- package/dist/api/newsletter/routes/index.d.ts +0 -4
- package/dist/api/newsletter/routes/index.d.ts.map +0 -1
- package/dist/api/newsletter/routes/index.js +0 -9
- package/dist/api/newsletter/routes/public.routes.d.ts +0 -4
- package/dist/api/newsletter/routes/public.routes.d.ts.map +0 -1
- package/dist/api/newsletter/routes/public.routes.js +0 -9
- package/dist/api/shop/handlers/assets.handler.d.ts +0 -3
- package/dist/api/shop/handlers/assets.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/assets.handler.js +0 -62
- package/dist/api/shop/handlers/checkout.handler.d.ts +0 -10
- package/dist/api/shop/handlers/checkout.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/checkout.handler.js +0 -50
- package/dist/api/shop/handlers/customers.handler.d.ts +0 -17
- package/dist/api/shop/handlers/customers.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/customers.handler.js +0 -89
- package/dist/api/shop/handlers/orders.handler.d.ts +0 -17
- package/dist/api/shop/handlers/orders.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/orders.handler.js +0 -84
- package/dist/api/shop/handlers/stats.handler.d.ts +0 -10
- package/dist/api/shop/handlers/stats.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/stats.handler.js +0 -71
- package/dist/api/shop/handlers/webhook.handler.d.ts +0 -10
- package/dist/api/shop/handlers/webhook.handler.d.ts.map +0 -1
- package/dist/api/shop/handlers/webhook.handler.js +0 -233
- package/dist/cms-assets.d.ts +0 -4
- package/dist/cms-assets.d.ts.map +0 -1
- package/dist/cms-assets.js +0 -5
- package/dist/cms-bundle.d.ts +0 -3
- package/dist/cms-bundle.d.ts.map +0 -1
- package/dist/cms-bundle.js +0 -4
- package/dist/config-loader.d.ts +0 -26
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -98
- package/dist/jwt.d.ts +0 -26
- package/dist/jwt.d.ts.map +0 -1
- package/dist/jwt.js +0 -102
- package/dist/lib/plunk.d.ts +0 -204
- package/dist/lib/plunk.d.ts.map +0 -1
- package/dist/lib/plunk.js +0 -259
- package/dist/template.d.ts +0 -2
- package/dist/template.d.ts.map +0 -1
- package/dist/template.js +0 -61
- package/dist/utils.d.ts +0 -23
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -110
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { Octokit } from '@octokit/rest';
|
|
2
|
-
import { getBuilderConfig } from '../../../lib/config';
|
|
3
|
-
// Files to include from the template repo
|
|
4
|
-
const INCLUDED_PATHS = [
|
|
5
|
-
'src/',
|
|
6
|
-
'static/',
|
|
7
|
-
'svelte.config.js',
|
|
8
|
-
'vite.config.ts',
|
|
9
|
-
'tsconfig.json',
|
|
10
|
-
'package.json'
|
|
11
|
-
];
|
|
12
|
-
// Files to exclude
|
|
13
|
-
const EXCLUDED_PATHS = [
|
|
14
|
-
'node_modules/',
|
|
15
|
-
'.svelte-kit/',
|
|
16
|
-
'build/',
|
|
17
|
-
'.git/'
|
|
18
|
-
];
|
|
19
|
-
function shouldIncludeFile(path) {
|
|
20
|
-
// Check exclusions first
|
|
21
|
-
for (const excluded of EXCLUDED_PATHS) {
|
|
22
|
-
if (path.startsWith(excluded) || path.includes('/' + excluded)) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
// Check if it matches any included path
|
|
27
|
-
for (const included of INCLUDED_PATHS) {
|
|
28
|
-
if (path.startsWith(included) || path === included.replace('/', '')) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Recursively fetch all files from a GitHub directory
|
|
36
|
-
*/
|
|
37
|
-
async function fetchDirectoryContents(octokit, owner, repo, path, branch) {
|
|
38
|
-
const files = [];
|
|
39
|
-
try {
|
|
40
|
-
const response = await octokit.rest.repos.getContent({
|
|
41
|
-
owner,
|
|
42
|
-
repo,
|
|
43
|
-
path,
|
|
44
|
-
ref: branch
|
|
45
|
-
});
|
|
46
|
-
if (Array.isArray(response.data)) {
|
|
47
|
-
// It's a directory
|
|
48
|
-
for (const item of response.data) {
|
|
49
|
-
if (!shouldIncludeFile(item.path)) {
|
|
50
|
-
continue;
|
|
51
|
-
}
|
|
52
|
-
if (item.type === 'dir') {
|
|
53
|
-
const subFiles = await fetchDirectoryContents(octokit, owner, repo, item.path, branch);
|
|
54
|
-
files.push(...subFiles);
|
|
55
|
-
}
|
|
56
|
-
else if (item.type === 'file') {
|
|
57
|
-
// Fetch file content
|
|
58
|
-
const fileResponse = await octokit.rest.repos.getContent({
|
|
59
|
-
owner,
|
|
60
|
-
repo,
|
|
61
|
-
path: item.path,
|
|
62
|
-
ref: branch
|
|
63
|
-
});
|
|
64
|
-
if (!Array.isArray(fileResponse.data) && 'content' in fileResponse.data) {
|
|
65
|
-
files.push({
|
|
66
|
-
path: item.path,
|
|
67
|
-
content: atob(fileResponse.data.content),
|
|
68
|
-
sha: fileResponse.data.sha
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else if ('content' in response.data) {
|
|
75
|
-
// It's a single file
|
|
76
|
-
files.push({
|
|
77
|
-
path: response.data.path,
|
|
78
|
-
content: atob(response.data.content),
|
|
79
|
-
sha: response.data.sha
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
if (error.status !== 404) {
|
|
85
|
-
throw error;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return files;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* GET /api/builder/admin/template
|
|
92
|
-
* Fetch all template files from the GitHub repository
|
|
93
|
-
*/
|
|
94
|
-
export async function getTemplate(c) {
|
|
95
|
-
try {
|
|
96
|
-
const config = getBuilderConfig(c.env);
|
|
97
|
-
const [owner, repo] = config.templateRepo.split('/');
|
|
98
|
-
const octokit = new Octokit({
|
|
99
|
-
auth: config.gitToken
|
|
100
|
-
});
|
|
101
|
-
// Get current commit SHA
|
|
102
|
-
const ref = await octokit.rest.git.getRef({
|
|
103
|
-
owner,
|
|
104
|
-
repo,
|
|
105
|
-
ref: `heads/${config.gitBranch}`
|
|
106
|
-
});
|
|
107
|
-
const commitSha = ref.data.object.sha;
|
|
108
|
-
// Fetch all files from included paths
|
|
109
|
-
const allFiles = [];
|
|
110
|
-
for (const includePath of INCLUDED_PATHS) {
|
|
111
|
-
const pathToFetch = includePath.endsWith('/') ? includePath.slice(0, -1) : includePath;
|
|
112
|
-
const files = await fetchDirectoryContents(octokit, owner, repo, pathToFetch, config.gitBranch);
|
|
113
|
-
allFiles.push(...files);
|
|
114
|
-
}
|
|
115
|
-
const response = {
|
|
116
|
-
files: allFiles,
|
|
117
|
-
commitSha,
|
|
118
|
-
templateRepo: config.templateRepo
|
|
119
|
-
};
|
|
120
|
-
return c.json(response);
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
console.error('Failed to fetch template:', error);
|
|
124
|
-
return c.json({ success: false, error: error.message || 'Failed to fetch template' }, 500);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* PUT /api/builder/admin/template
|
|
129
|
-
* Save modified files to GitHub (commit)
|
|
130
|
-
*/
|
|
131
|
-
export async function updateTemplate(c) {
|
|
132
|
-
try {
|
|
133
|
-
const request = await c.req.json();
|
|
134
|
-
const config = getBuilderConfig(c.env);
|
|
135
|
-
const [owner, repo] = config.templateRepo.split('/');
|
|
136
|
-
const octokit = new Octokit({
|
|
137
|
-
auth: config.gitToken
|
|
138
|
-
});
|
|
139
|
-
// Get current commit SHA
|
|
140
|
-
const ref = await octokit.rest.git.getRef({
|
|
141
|
-
owner,
|
|
142
|
-
repo,
|
|
143
|
-
ref: `heads/${config.gitBranch}`
|
|
144
|
-
});
|
|
145
|
-
const currentCommitSha = ref.data.object.sha;
|
|
146
|
-
// Check for conflicts
|
|
147
|
-
if (request.commitSha !== currentCommitSha) {
|
|
148
|
-
const conflictResponse = {
|
|
149
|
-
conflict: true,
|
|
150
|
-
currentCommitSha,
|
|
151
|
-
message: 'Template has been modified. Please sync and try again.'
|
|
152
|
-
};
|
|
153
|
-
return c.json(conflictResponse, 409);
|
|
154
|
-
}
|
|
155
|
-
// Get the current commit
|
|
156
|
-
const commit = await octokit.rest.git.getCommit({
|
|
157
|
-
owner,
|
|
158
|
-
repo,
|
|
159
|
-
commit_sha: currentCommitSha
|
|
160
|
-
});
|
|
161
|
-
// Create blobs for each modified file
|
|
162
|
-
const blobs = await Promise.all(Object.entries(request.files).map(async ([path, content]) => {
|
|
163
|
-
const blob = await octokit.rest.git.createBlob({
|
|
164
|
-
owner,
|
|
165
|
-
repo,
|
|
166
|
-
content: content,
|
|
167
|
-
encoding: 'utf-8'
|
|
168
|
-
});
|
|
169
|
-
return {
|
|
170
|
-
path,
|
|
171
|
-
mode: '100644',
|
|
172
|
-
type: 'blob',
|
|
173
|
-
sha: blob.data.sha
|
|
174
|
-
};
|
|
175
|
-
}));
|
|
176
|
-
// Create new tree
|
|
177
|
-
const newTree = await octokit.rest.git.createTree({
|
|
178
|
-
owner,
|
|
179
|
-
repo,
|
|
180
|
-
tree: blobs,
|
|
181
|
-
base_tree: commit.data.tree.sha
|
|
182
|
-
});
|
|
183
|
-
// Create commit
|
|
184
|
-
const newCommit = await octokit.rest.git.createCommit({
|
|
185
|
-
owner,
|
|
186
|
-
repo,
|
|
187
|
-
message: 'Update template via Builder',
|
|
188
|
-
tree: newTree.data.sha,
|
|
189
|
-
parents: [commit.data.sha]
|
|
190
|
-
});
|
|
191
|
-
// Update branch reference
|
|
192
|
-
await octokit.rest.git.updateRef({
|
|
193
|
-
owner,
|
|
194
|
-
repo,
|
|
195
|
-
ref: `heads/${config.gitBranch}`,
|
|
196
|
-
sha: newCommit.data.sha
|
|
197
|
-
});
|
|
198
|
-
const response = {
|
|
199
|
-
success: true,
|
|
200
|
-
newCommitSha: newCommit.data.sha
|
|
201
|
-
};
|
|
202
|
-
return c.json(response);
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
console.error('Failed to update template:', error);
|
|
206
|
-
return c.json({ success: false, error: error.message || 'Failed to update template' }, 500);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/api/builder/routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAO5C,QAAA,MAAM,aAAa;cAAwB,QAAQ;yCAAK,CAAC;AAazD,eAAe,aAAa,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Hono } from 'hono';
|
|
2
|
-
import { authMiddleware } from '../../middleware/auth';
|
|
3
|
-
// Import handlers
|
|
4
|
-
import { getTemplate, updateTemplate } from './handlers/template.handler';
|
|
5
|
-
import { chat, implement } from './handlers/generate.handler';
|
|
6
|
-
const builderRoutes = new Hono();
|
|
7
|
-
// Apply auth middleware to all builder routes
|
|
8
|
-
builderRoutes.use('/admin/*', authMiddleware);
|
|
9
|
-
// Template routes
|
|
10
|
-
builderRoutes.get('/admin/template', getTemplate);
|
|
11
|
-
builderRoutes.put('/admin/template', updateTemplate);
|
|
12
|
-
// AI routes
|
|
13
|
-
builderRoutes.post('/admin/chat', chat);
|
|
14
|
-
builderRoutes.post('/admin/implement', implement);
|
|
15
|
-
export default builderRoutes;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Context } from 'hono';
|
|
2
|
-
/**
|
|
3
|
-
* GET /api/admin/assets
|
|
4
|
-
* List all assets in the asset directory
|
|
5
|
-
*/
|
|
6
|
-
export declare function listAssets(c: Context): Promise<Response>;
|
|
7
|
-
/**
|
|
8
|
-
* POST /api/admin/assets
|
|
9
|
-
* Upload an asset to GitHub
|
|
10
|
-
*/
|
|
11
|
-
export declare function uploadAsset(c: Context): Promise<Response>;
|
|
12
|
-
/**
|
|
13
|
-
* DELETE /api/admin/assets
|
|
14
|
-
* Delete an asset from GitHub
|
|
15
|
-
*/
|
|
16
|
-
export declare function deleteAsset(c: Context): Promise<Response>;
|
|
17
|
-
/**
|
|
18
|
-
* GET /api/admin/assets/:path
|
|
19
|
-
* Get asset content
|
|
20
|
-
*/
|
|
21
|
-
export declare function getAssetByPath(c: Context): Promise<Response>;
|
|
22
|
-
/**
|
|
23
|
-
* GET /api/admin/assets/sync
|
|
24
|
-
* Sync all assets (with content)
|
|
25
|
-
*/
|
|
26
|
-
export declare function syncAssets(c: Context): Promise<Response>;
|
|
27
|
-
/**
|
|
28
|
-
* Mock assets for development
|
|
29
|
-
*/
|
|
30
|
-
export declare function syncAssetsMock(c: Context): Promise<Response>;
|
|
31
|
-
//# sourceMappingURL=assets.handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/cms/handlers/assets.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAuC/B;;;GAGG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA+B9D;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuB/D;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiB/D;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoBlE;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2E9D;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAGlE"}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { getCmsConfig, getGitHubConfig } from '../../../lib/config';
|
|
2
|
-
import { createGitHubClient } from '../../../lib/github';
|
|
3
|
-
const mimeTypes = {
|
|
4
|
-
'.jpg': 'image/jpeg',
|
|
5
|
-
'.png': 'image/png',
|
|
6
|
-
'.gif': 'image/gif',
|
|
7
|
-
'.svg': 'image/svg+xml',
|
|
8
|
-
'.ico': 'image/x-icon',
|
|
9
|
-
'.webp': 'image/webp',
|
|
10
|
-
'.mp4': 'video/mp4',
|
|
11
|
-
'.webm': 'video/webm',
|
|
12
|
-
'.ogg': 'video/ogg',
|
|
13
|
-
'.ogv': 'video/ogg',
|
|
14
|
-
'.mov': 'video/quicktime',
|
|
15
|
-
'.avi': 'video/x-msvideo',
|
|
16
|
-
'.mkv': 'video/x-matroska',
|
|
17
|
-
'.mp3': 'audio/mpeg',
|
|
18
|
-
'.wav': 'audio/wav',
|
|
19
|
-
'.m4a': 'audio/mp4',
|
|
20
|
-
'.aac': 'audio/aac',
|
|
21
|
-
'.oga': 'audio/ogg'
|
|
22
|
-
};
|
|
23
|
-
function getMimeType(path) {
|
|
24
|
-
const extension = path.slice(((path.lastIndexOf('.') - 1) >>> 0) + 2);
|
|
25
|
-
return mimeTypes['.' + extension] || 'text/plain';
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* GET /api/admin/assets
|
|
29
|
-
* List all assets in the asset directory
|
|
30
|
-
*/
|
|
31
|
-
export async function listAssets(c) {
|
|
32
|
-
try {
|
|
33
|
-
const config = getCmsConfig(c.env);
|
|
34
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
35
|
-
const github = createGitHubClient(gitConfig);
|
|
36
|
-
const octokit = github.getOctokit();
|
|
37
|
-
const repoInfo = github.getRepoInfo();
|
|
38
|
-
// List files in asset directory
|
|
39
|
-
const response = await octokit.rest.repos.getContent({
|
|
40
|
-
...repoInfo,
|
|
41
|
-
path: config.assetDir,
|
|
42
|
-
ref: repoInfo.branch
|
|
43
|
-
});
|
|
44
|
-
if (!Array.isArray(response.data)) {
|
|
45
|
-
return c.json({ error: 'Asset directory not found' }, 404);
|
|
46
|
-
}
|
|
47
|
-
const assets = response.data.map((item) => ({
|
|
48
|
-
name: item.name,
|
|
49
|
-
path: item.path,
|
|
50
|
-
download_url: item.download_url
|
|
51
|
-
}));
|
|
52
|
-
return c.json(assets);
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
console.error('List assets error:', error);
|
|
56
|
-
return c.json({ error: error.message || 'Failed to list assets' }, 500);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* POST /api/admin/assets
|
|
61
|
-
* Upload an asset to GitHub
|
|
62
|
-
*/
|
|
63
|
-
export async function uploadAsset(c) {
|
|
64
|
-
try {
|
|
65
|
-
const config = getCmsConfig(c.env);
|
|
66
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
67
|
-
const github = createGitHubClient(gitConfig);
|
|
68
|
-
const { file, content } = await c.req.json();
|
|
69
|
-
await github.writeFile(`${config.assetDir}/${file}`, content, // Note: content is already base64 from frontend
|
|
70
|
-
`Upload asset ${file} [skip ci]`);
|
|
71
|
-
const response = {
|
|
72
|
-
success: true,
|
|
73
|
-
message: `Uploaded ${file} to ${config.assetDir}`
|
|
74
|
-
};
|
|
75
|
-
return c.json(response);
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
console.error('Upload asset error:', error);
|
|
79
|
-
return c.json({ error: error.message || 'Failed to upload asset' }, 500);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* DELETE /api/admin/assets
|
|
84
|
-
* Delete an asset from GitHub
|
|
85
|
-
*/
|
|
86
|
-
export async function deleteAsset(c) {
|
|
87
|
-
try {
|
|
88
|
-
const { file } = await c.req.json();
|
|
89
|
-
const config = getCmsConfig(c.env);
|
|
90
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
91
|
-
const github = createGitHubClient(gitConfig);
|
|
92
|
-
await github.deleteFile(`${config.assetDir}/${file}`, `Delete asset ${file} [skip ci]`);
|
|
93
|
-
return c.json({ message: `Deleted asset ${file}` });
|
|
94
|
-
}
|
|
95
|
-
catch (error) {
|
|
96
|
-
console.error('Delete asset error:', error);
|
|
97
|
-
return c.json({ error: error.message || 'Failed to delete asset' }, 500);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* GET /api/admin/assets/:path
|
|
102
|
-
* Get asset content
|
|
103
|
-
*/
|
|
104
|
-
export async function getAssetByPath(c) {
|
|
105
|
-
try {
|
|
106
|
-
const path = c.req.param('path');
|
|
107
|
-
const config = getCmsConfig(c.env);
|
|
108
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
109
|
-
const github = createGitHubClient(gitConfig);
|
|
110
|
-
const result = await github.readFile(`${config.assetDir}/${path}`);
|
|
111
|
-
if (!result) {
|
|
112
|
-
return c.json({ error: 'Asset not found' }, 404);
|
|
113
|
-
}
|
|
114
|
-
const mimeType = getMimeType(path);
|
|
115
|
-
const response = { image: result.content, mimeType };
|
|
116
|
-
return c.json(response);
|
|
117
|
-
}
|
|
118
|
-
catch (error) {
|
|
119
|
-
console.error('Get asset error:', error);
|
|
120
|
-
return c.json({ error: error.message || 'Failed to get asset' }, 500);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* GET /api/admin/assets/sync
|
|
125
|
-
* Sync all assets (with content)
|
|
126
|
-
*/
|
|
127
|
-
export async function syncAssets(c) {
|
|
128
|
-
try {
|
|
129
|
-
const config = getCmsConfig(c.env);
|
|
130
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
131
|
-
const github = createGitHubClient(gitConfig);
|
|
132
|
-
const commitSha = await github.getCommitSha();
|
|
133
|
-
const octokit = github.getOctokit();
|
|
134
|
-
const repoInfo = github.getRepoInfo();
|
|
135
|
-
// Get directory listing
|
|
136
|
-
const dirResponse = await octokit.rest.repos.getContent({
|
|
137
|
-
...repoInfo,
|
|
138
|
-
path: config.assetDir,
|
|
139
|
-
ref: repoInfo.branch
|
|
140
|
-
});
|
|
141
|
-
if (!Array.isArray(dirResponse.data)) {
|
|
142
|
-
return c.json({ assets: [], commitSha });
|
|
143
|
-
}
|
|
144
|
-
// Fetch content for each file
|
|
145
|
-
const filesWithContent = await Promise.all(dirResponse.data.map(async (item) => {
|
|
146
|
-
try {
|
|
147
|
-
// Use readFileBinary for assets to avoid UTF-8 decoding corruption
|
|
148
|
-
const fileResult = await github.readFileBinary(item.path);
|
|
149
|
-
if (!fileResult)
|
|
150
|
-
return null;
|
|
151
|
-
let content = fileResult.content;
|
|
152
|
-
// For large files, GitHub might not return content in the first call
|
|
153
|
-
// But our GitHubClient.readFile handles the basic case.
|
|
154
|
-
// If content is empty but it's a file, we might need to fetch download_url
|
|
155
|
-
if (!content && item.download_url) {
|
|
156
|
-
const dlResponse = await fetch(item.download_url);
|
|
157
|
-
if (dlResponse.ok) {
|
|
158
|
-
const arrayBuffer = await dlResponse.arrayBuffer();
|
|
159
|
-
const uint8Array = new Uint8Array(arrayBuffer);
|
|
160
|
-
const chunkSize = 8192;
|
|
161
|
-
let binary = '';
|
|
162
|
-
for (let i = 0; i < uint8Array.length; i += chunkSize) {
|
|
163
|
-
const chunk = uint8Array.subarray(i, Math.min(i + chunkSize, uint8Array.length));
|
|
164
|
-
binary += String.fromCharCode.apply(null, Array.from(chunk));
|
|
165
|
-
}
|
|
166
|
-
content = btoa(binary);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
name: item.name,
|
|
171
|
-
path: item.path,
|
|
172
|
-
content,
|
|
173
|
-
mimeType: getMimeType(item.name),
|
|
174
|
-
lastModified: Date.now()
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
console.error(`Failed to fetch ${item.name}:`, e);
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
}));
|
|
182
|
-
const validFiles = filesWithContent.filter((f) => f !== null);
|
|
183
|
-
const response = {
|
|
184
|
-
assets: validFiles,
|
|
185
|
-
commitSha
|
|
186
|
-
};
|
|
187
|
-
return c.json(response);
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
console.error('Sync assets error:', error);
|
|
191
|
-
return c.json({ error: error.message || 'Failed to sync assets' }, 500);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Mock assets for development
|
|
196
|
-
*/
|
|
197
|
-
export async function syncAssetsMock(c) {
|
|
198
|
-
// Implementation omitted for brevity, keeping same logic as before if needed
|
|
199
|
-
return c.json({ assets: [], commitSha: '' });
|
|
200
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/cms/handlers/config.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAS/B;;;GAGG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAuChE"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { getCmsConfig, getGitHubConfig } from '../../../lib/config';
|
|
2
|
-
import { createGitHubClient } from '../../../lib/github';
|
|
3
|
-
/**
|
|
4
|
-
* PUT /api/admin/config
|
|
5
|
-
* Update CMS configuration in GitHub
|
|
6
|
-
*/
|
|
7
|
-
export async function updateConfig(c) {
|
|
8
|
-
try {
|
|
9
|
-
const request = await c.req.json();
|
|
10
|
-
const config = getCmsConfig(c.env);
|
|
11
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
12
|
-
const github = createGitHubClient(gitConfig);
|
|
13
|
-
// Get current commit SHA
|
|
14
|
-
const currentCommitSha = await github.getCommitSha();
|
|
15
|
-
// Check for conflicts
|
|
16
|
-
if (request.commitSha !== currentCommitSha) {
|
|
17
|
-
// Fetch current config for conflict resolution
|
|
18
|
-
const configResult = await github.readJsonFile(`${config.contentDir}/config.json`);
|
|
19
|
-
const serverConfig = configResult?.data || {};
|
|
20
|
-
const conflictResponse = {
|
|
21
|
-
conflict: true,
|
|
22
|
-
currentCommitSha,
|
|
23
|
-
serverConfig,
|
|
24
|
-
message: 'Configuration has been modified by another user. Please resolve conflicts.'
|
|
25
|
-
};
|
|
26
|
-
return c.json(conflictResponse, 409);
|
|
27
|
-
}
|
|
28
|
-
// Write updated config file
|
|
29
|
-
await github.writeJsonFile(`${config.contentDir}/config.json`, request.config, 'Update configuration [skip ci]');
|
|
30
|
-
const response = { success: true };
|
|
31
|
-
return c.json(response);
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
console.error('Update config error:', error);
|
|
35
|
-
return c.json({ error: error.message || 'Failed to update config' }, 500);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Context } from 'hono';
|
|
2
|
-
/**
|
|
3
|
-
* GET /api/admin/contents
|
|
4
|
-
* Fetch all content collections from GitHub
|
|
5
|
-
*/
|
|
6
|
-
export declare function getContents(c: Context): Promise<Response>;
|
|
7
|
-
/**
|
|
8
|
-
* Sync contents from GitHub - optimized for conditional fetching
|
|
9
|
-
*/
|
|
10
|
-
export declare function syncContents(c: Context): Promise<Response>;
|
|
11
|
-
/**
|
|
12
|
-
* PUT /api/admin/contents
|
|
13
|
-
* Update content collections in GitHub atomically
|
|
14
|
-
*/
|
|
15
|
-
export declare function updateContents(c: Context): Promise<Response>;
|
|
16
|
-
/**
|
|
17
|
-
* DELETE /api/admin/contents
|
|
18
|
-
* Actually this seems to be an update operation in disguise (updating a file with filtered records)
|
|
19
|
-
*/
|
|
20
|
-
export declare function deleteContent(c: Context): Promise<Response>;
|
|
21
|
-
//# sourceMappingURL=content.handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"content.handler.d.ts","sourceRoot":"","sources":["../../../../src/api/cms/handlers/content.handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAU/B;;;GAGG;AACH,wBAAsB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA2C/D;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAGhE;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoDlE;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoBjE"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { getCmsConfig, getGitHubConfig } from '../../../lib/config';
|
|
2
|
-
import { createGitHubClient } from '../../../lib/github';
|
|
3
|
-
/**
|
|
4
|
-
* GET /api/admin/contents
|
|
5
|
-
* Fetch all content collections from GitHub
|
|
6
|
-
*/
|
|
7
|
-
export async function getContents(c) {
|
|
8
|
-
try {
|
|
9
|
-
const config = getCmsConfig(c.env);
|
|
10
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
11
|
-
const github = createGitHubClient(gitConfig);
|
|
12
|
-
// Get current commit SHA from branch
|
|
13
|
-
const commitSha = await github.getCommitSha();
|
|
14
|
-
// Read content config
|
|
15
|
-
const configResult = await github.readJsonFile(`${config.contentDir}/config.json`);
|
|
16
|
-
if (!configResult) {
|
|
17
|
-
throw new Error('Config file not found');
|
|
18
|
-
}
|
|
19
|
-
const contentConfig = configResult.data;
|
|
20
|
-
// Fetch all content files in parallel
|
|
21
|
-
const collectionKeys = Object.keys(contentConfig);
|
|
22
|
-
const collections = await Promise.all(collectionKeys.map(async (content) => {
|
|
23
|
-
const result = await github.readJsonFile(`${config.contentDir}/${content}.json`);
|
|
24
|
-
return {
|
|
25
|
-
[content]: result?.data || {}
|
|
26
|
-
};
|
|
27
|
-
}));
|
|
28
|
-
const collectionsObject = collections.reduce((acc, cur) => ({ ...acc, ...cur }), {});
|
|
29
|
-
const response = {
|
|
30
|
-
config: contentConfig,
|
|
31
|
-
collections: collectionsObject,
|
|
32
|
-
commitSha
|
|
33
|
-
};
|
|
34
|
-
return c.json(response);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
console.error('Error fetching contents:', error);
|
|
38
|
-
return c.json({
|
|
39
|
-
error: error.message || 'Failed to fetch contents',
|
|
40
|
-
details: error.toString()
|
|
41
|
-
}, 500);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Sync contents from GitHub - optimized for conditional fetching
|
|
46
|
-
*/
|
|
47
|
-
export async function syncContents(c) {
|
|
48
|
-
// For now, this is same as getContents, but could be optimized later with If-None-Match
|
|
49
|
-
return getContents(c);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* PUT /api/admin/contents
|
|
53
|
-
* Update content collections in GitHub atomically
|
|
54
|
-
*/
|
|
55
|
-
export async function updateContents(c) {
|
|
56
|
-
try {
|
|
57
|
-
const request = await c.req.json();
|
|
58
|
-
const config = getCmsConfig(c.env);
|
|
59
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
60
|
-
const github = createGitHubClient(gitConfig);
|
|
61
|
-
// Get current commit SHA
|
|
62
|
-
const currentCommitSha = await github.getCommitSha();
|
|
63
|
-
// Check for conflicts
|
|
64
|
-
if (request.commitSha !== currentCommitSha) {
|
|
65
|
-
// Fetch current state for conflict resolution
|
|
66
|
-
const configResult = await github.readJsonFile(`${config.contentDir}/config.json`);
|
|
67
|
-
const contentConfig = configResult?.data || {};
|
|
68
|
-
const collections = await Promise.all(Object.keys(contentConfig).map(async (content) => {
|
|
69
|
-
const result = await github.readJsonFile(`${config.contentDir}/${content}.json`);
|
|
70
|
-
return {
|
|
71
|
-
[content]: result?.data || {}
|
|
72
|
-
};
|
|
73
|
-
}));
|
|
74
|
-
const serverCollections = collections.reduce((acc, cur) => ({ ...acc, ...cur }), {});
|
|
75
|
-
const conflictResponse = {
|
|
76
|
-
conflict: true,
|
|
77
|
-
currentCommitSha,
|
|
78
|
-
serverCollections,
|
|
79
|
-
message: 'Content has been modified by another user. Please resolve conflicts.'
|
|
80
|
-
};
|
|
81
|
-
return c.json(conflictResponse, 409);
|
|
82
|
-
}
|
|
83
|
-
// Prepare files for atomic update
|
|
84
|
-
const files = Object.keys(request.collections).map((content) => ({
|
|
85
|
-
path: `${config.contentDir}/${content}.json`,
|
|
86
|
-
content: JSON.stringify(request.collections[content], null, 4)
|
|
87
|
-
}));
|
|
88
|
-
// Write to GitHub atomically
|
|
89
|
-
await github.writeFilesAtomic(files, 'Update content', currentCommitSha);
|
|
90
|
-
const response = { success: true };
|
|
91
|
-
return c.json(response);
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
console.error('Update contents error:', error);
|
|
95
|
-
return c.json({ error: error.message || 'Failed to update contents' }, 500);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* DELETE /api/admin/contents
|
|
100
|
-
* Actually this seems to be an update operation in disguise (updating a file with filtered records)
|
|
101
|
-
*/
|
|
102
|
-
export async function deleteContent(c) {
|
|
103
|
-
try {
|
|
104
|
-
const deleteData = await c.req.json();
|
|
105
|
-
const contentId = Object.keys(deleteData)[0];
|
|
106
|
-
const config = getCmsConfig(c.env);
|
|
107
|
-
const gitConfig = getGitHubConfig(c.env);
|
|
108
|
-
const github = createGitHubClient(gitConfig);
|
|
109
|
-
// This handler in the old code was just writing the updated file
|
|
110
|
-
await github.writeJsonFile(`${config.contentDir}/${contentId}.json`, deleteData[contentId], `Delete record(s) from ${contentId} [CI SKIP]`);
|
|
111
|
-
return c.json({ message: `Deleted record from ${contentId}` });
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
console.error('Delete content error:', error);
|
|
115
|
-
return c.json({ error: error.message || 'Failed to delete content' }, 500);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assets.routes.d.ts","sourceRoot":"","sources":["../../../../src/api/cms/routes/assets.routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,QAAA,MAAM,YAAY,4EAAa,CAAC;AAYhC,eAAe,YAAY,CAAC"}
|