dineway 0.1.3
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/LICENSE +9 -0
- package/README.md +89 -0
- package/dist/adapters-BlzWJG82.d.mts +106 -0
- package/dist/apply-CAPvMfoU.mjs +1339 -0
- package/dist/astro/index.d.mts +50 -0
- package/dist/astro/index.mjs +1326 -0
- package/dist/astro/middleware/auth.d.mts +30 -0
- package/dist/astro/middleware/auth.mjs +708 -0
- package/dist/astro/middleware/redirect.d.mts +21 -0
- package/dist/astro/middleware/redirect.mjs +62 -0
- package/dist/astro/middleware/request-context.d.mts +17 -0
- package/dist/astro/middleware/request-context.mjs +1371 -0
- package/dist/astro/middleware/setup.d.mts +19 -0
- package/dist/astro/middleware/setup.mjs +46 -0
- package/dist/astro/middleware.d.mts +12 -0
- package/dist/astro/middleware.mjs +1716 -0
- package/dist/astro/types.d.mts +269 -0
- package/dist/astro/types.mjs +1 -0
- package/dist/base64-F8-DUraK.mjs +58 -0
- package/dist/byline-DeWCMU_i.mjs +234 -0
- package/dist/bylines-DyqBV9EQ.mjs +137 -0
- package/dist/chunk-ClPoSABd.mjs +21 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.mjs +3987 -0
- package/dist/client/external-auth-headers.d.mts +38 -0
- package/dist/client/external-auth-headers.mjs +101 -0
- package/dist/client/index.d.mts +397 -0
- package/dist/client/index.mjs +345 -0
- package/dist/config-Cq8H0SfX.mjs +46 -0
- package/dist/connection-C9pxzuag.mjs +52 -0
- package/dist/content-zSgdNmnt.mjs +836 -0
- package/dist/db/index.d.mts +4 -0
- package/dist/db/index.mjs +62 -0
- package/dist/db/libsql.d.mts +10 -0
- package/dist/db/libsql.mjs +21 -0
- package/dist/db/postgres.d.mts +10 -0
- package/dist/db/postgres.mjs +29 -0
- package/dist/db/sqlite.d.mts +10 -0
- package/dist/db/sqlite.mjs +15 -0
- package/dist/default-WYlzADZL.mjs +80 -0
- package/dist/dialect-helpers-B9uSp2GJ.mjs +89 -0
- package/dist/error-DrxtnGPg.mjs +26 -0
- package/dist/index-C-jx21qs.d.mts +4771 -0
- package/dist/index.d.mts +16 -0
- package/dist/index.mjs +30 -0
- package/dist/load-C6FCD1FU.mjs +27 -0
- package/dist/loader-qKmo0wAY.mjs +446 -0
- package/dist/manifest-schema-CTSEyIJ3.mjs +186 -0
- package/dist/media/index.d.mts +25 -0
- package/dist/media/index.mjs +54 -0
- package/dist/media/local-runtime.d.mts +38 -0
- package/dist/media/local-runtime.mjs +132 -0
- package/dist/media-DMTr80Gv.mjs +199 -0
- package/dist/mode-BlyYtIFO.mjs +22 -0
- package/dist/page/index.d.mts +148 -0
- package/dist/page/index.mjs +419 -0
- package/dist/placeholder-B3knXwNc.mjs +267 -0
- package/dist/placeholder-bOx1xCTY.d.mts +283 -0
- package/dist/plugin-utils.d.mts +57 -0
- package/dist/plugin-utils.mjs +77 -0
- package/dist/plugins/adapt-sandbox-entry.d.mts +21 -0
- package/dist/plugins/adapt-sandbox-entry.mjs +112 -0
- package/dist/query-BiaPl_g2.mjs +459 -0
- package/dist/redirect-JPqLAbxa.mjs +328 -0
- package/dist/registry-DSd1GWB8.mjs +851 -0
- package/dist/request-context.d.mts +49 -0
- package/dist/request-context.mjs +42 -0
- package/dist/runner-B5l1JfOj.d.mts +26 -0
- package/dist/runner-BGUGywgG.mjs +1529 -0
- package/dist/runtime.d.mts +25 -0
- package/dist/runtime.mjs +41 -0
- package/dist/search-BNruJHDL.mjs +11054 -0
- package/dist/seed/index.d.mts +3 -0
- package/dist/seed/index.mjs +15 -0
- package/dist/seo/index.d.mts +69 -0
- package/dist/seo/index.mjs +69 -0
- package/dist/storage/local.d.mts +38 -0
- package/dist/storage/local.mjs +165 -0
- package/dist/storage/s3.d.mts +31 -0
- package/dist/storage/s3.mjs +174 -0
- package/dist/tokens-4vgYuXsZ.mjs +170 -0
- package/dist/transport-C5FYnid7.mjs +417 -0
- package/dist/transport-gIL-e43D.d.mts +41 -0
- package/dist/types-BawVha09.mjs +30 -0
- package/dist/types-BgQeVaPj.d.mts +192 -0
- package/dist/types-CLLdsG3g.d.mts +103 -0
- package/dist/types-D38djUXv.d.mts +1196 -0
- package/dist/types-DShnjzb6.mjs +15 -0
- package/dist/types-DkvMXalq.d.mts +425 -0
- package/dist/types-DuNbGKjF.mjs +74 -0
- package/dist/types-ju-_ORz7.d.mts +182 -0
- package/dist/validate-CXnRKfJK.mjs +327 -0
- package/dist/validate-CqRJb_xU.mjs +96 -0
- package/dist/validate-DVKJJ-M_.d.mts +377 -0
- package/locals.d.ts +47 -0
- package/package.json +313 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/storage/types.ts
|
|
2
|
+
/**
|
|
3
|
+
* Storage error with additional context
|
|
4
|
+
*/
|
|
5
|
+
var DinewayStorageError = class extends Error {
|
|
6
|
+
constructor(message, code, cause) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.cause = cause;
|
|
10
|
+
this.name = "DinewayStorageError";
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { DinewayStorageError as t };
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
import { Generated } from "kysely";
|
|
2
|
+
|
|
3
|
+
//#region src/database/types.d.ts
|
|
4
|
+
interface RevisionTable {
|
|
5
|
+
id: string;
|
|
6
|
+
collection: string;
|
|
7
|
+
entry_id: string;
|
|
8
|
+
data: string;
|
|
9
|
+
author_id: string | null;
|
|
10
|
+
created_at: Generated<string>;
|
|
11
|
+
}
|
|
12
|
+
interface TaxonomyTable {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
slug: string;
|
|
16
|
+
label: string;
|
|
17
|
+
parent_id: string | null;
|
|
18
|
+
data: string | null;
|
|
19
|
+
}
|
|
20
|
+
interface ContentTaxonomyTable {
|
|
21
|
+
collection: string;
|
|
22
|
+
entry_id: string;
|
|
23
|
+
taxonomy_id: string;
|
|
24
|
+
}
|
|
25
|
+
interface TaxonomyDefTable {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
label: string;
|
|
29
|
+
label_singular: string | null;
|
|
30
|
+
hierarchical: number;
|
|
31
|
+
collections: string | null;
|
|
32
|
+
created_at: Generated<string>;
|
|
33
|
+
}
|
|
34
|
+
interface MediaTable {
|
|
35
|
+
id: string;
|
|
36
|
+
filename: string;
|
|
37
|
+
mime_type: string;
|
|
38
|
+
size: number | null;
|
|
39
|
+
width: number | null;
|
|
40
|
+
height: number | null;
|
|
41
|
+
alt: string | null;
|
|
42
|
+
caption: string | null;
|
|
43
|
+
storage_key: string;
|
|
44
|
+
status: string;
|
|
45
|
+
content_hash: string | null;
|
|
46
|
+
blurhash: string | null;
|
|
47
|
+
dominant_color: string | null;
|
|
48
|
+
created_at: Generated<string>;
|
|
49
|
+
author_id: string | null;
|
|
50
|
+
}
|
|
51
|
+
interface UserTable {
|
|
52
|
+
id: string;
|
|
53
|
+
email: string;
|
|
54
|
+
name: string | null;
|
|
55
|
+
avatar_url: string | null;
|
|
56
|
+
role: number;
|
|
57
|
+
email_verified: number;
|
|
58
|
+
data: string | null;
|
|
59
|
+
disabled: Generated<number>;
|
|
60
|
+
created_at: Generated<string>;
|
|
61
|
+
updated_at: Generated<string>;
|
|
62
|
+
}
|
|
63
|
+
interface CredentialTable {
|
|
64
|
+
id: string;
|
|
65
|
+
user_id: string;
|
|
66
|
+
public_key: Uint8Array;
|
|
67
|
+
counter: number;
|
|
68
|
+
device_type: string;
|
|
69
|
+
backed_up: number;
|
|
70
|
+
transports: string | null;
|
|
71
|
+
name: string | null;
|
|
72
|
+
created_at: Generated<string>;
|
|
73
|
+
last_used_at: Generated<string>;
|
|
74
|
+
}
|
|
75
|
+
interface AuthTokenTable {
|
|
76
|
+
hash: string;
|
|
77
|
+
user_id: string | null;
|
|
78
|
+
email: string | null;
|
|
79
|
+
type: string;
|
|
80
|
+
role: number | null;
|
|
81
|
+
invited_by: string | null;
|
|
82
|
+
expires_at: string;
|
|
83
|
+
created_at: Generated<string>;
|
|
84
|
+
}
|
|
85
|
+
interface OAuthAccountTable {
|
|
86
|
+
provider: string;
|
|
87
|
+
provider_account_id: string;
|
|
88
|
+
user_id: string;
|
|
89
|
+
created_at: Generated<string>;
|
|
90
|
+
}
|
|
91
|
+
interface AllowedDomainTable {
|
|
92
|
+
domain: string;
|
|
93
|
+
default_role: number;
|
|
94
|
+
enabled: number;
|
|
95
|
+
created_at: Generated<string>;
|
|
96
|
+
}
|
|
97
|
+
interface AuthChallengeTable {
|
|
98
|
+
challenge: string;
|
|
99
|
+
type: string;
|
|
100
|
+
user_id: string | null;
|
|
101
|
+
data: string | null;
|
|
102
|
+
expires_at: string;
|
|
103
|
+
created_at: Generated<string>;
|
|
104
|
+
}
|
|
105
|
+
interface ApiTokenTable {
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
token_hash: string;
|
|
109
|
+
prefix: string;
|
|
110
|
+
user_id: string;
|
|
111
|
+
scopes: string;
|
|
112
|
+
expires_at: string | null;
|
|
113
|
+
last_used_at: string | null;
|
|
114
|
+
created_at: Generated<string>;
|
|
115
|
+
}
|
|
116
|
+
interface OAuthTokenTable {
|
|
117
|
+
token_hash: string;
|
|
118
|
+
token_type: string;
|
|
119
|
+
user_id: string;
|
|
120
|
+
scopes: string;
|
|
121
|
+
client_type: string;
|
|
122
|
+
expires_at: string;
|
|
123
|
+
refresh_token_hash: string | null;
|
|
124
|
+
client_id: string | null;
|
|
125
|
+
created_at: Generated<string>;
|
|
126
|
+
}
|
|
127
|
+
interface AuthorizationCodeTable {
|
|
128
|
+
code_hash: string;
|
|
129
|
+
client_id: string;
|
|
130
|
+
redirect_uri: string;
|
|
131
|
+
user_id: string;
|
|
132
|
+
scopes: string;
|
|
133
|
+
code_challenge: string;
|
|
134
|
+
code_challenge_method: string;
|
|
135
|
+
resource: string | null;
|
|
136
|
+
expires_at: string;
|
|
137
|
+
created_at: Generated<string>;
|
|
138
|
+
}
|
|
139
|
+
interface OAuthClientTable {
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
redirect_uris: string;
|
|
143
|
+
scopes: string | null;
|
|
144
|
+
created_at: Generated<string>;
|
|
145
|
+
updated_at: Generated<string>;
|
|
146
|
+
}
|
|
147
|
+
interface DeviceCodeTable {
|
|
148
|
+
device_code: string;
|
|
149
|
+
user_code: string;
|
|
150
|
+
scopes: string;
|
|
151
|
+
user_id: string | null;
|
|
152
|
+
status: string;
|
|
153
|
+
expires_at: string;
|
|
154
|
+
interval: number;
|
|
155
|
+
last_polled_at: string | null;
|
|
156
|
+
created_at: Generated<string>;
|
|
157
|
+
}
|
|
158
|
+
interface OptionTable {
|
|
159
|
+
name: string;
|
|
160
|
+
value: string;
|
|
161
|
+
}
|
|
162
|
+
interface AuditLogTable {
|
|
163
|
+
id: string;
|
|
164
|
+
timestamp: Generated<string>;
|
|
165
|
+
actor_id: string | null;
|
|
166
|
+
actor_ip: string | null;
|
|
167
|
+
action: string;
|
|
168
|
+
resource_type: string | null;
|
|
169
|
+
resource_id: string | null;
|
|
170
|
+
details: string | null;
|
|
171
|
+
status: string | null;
|
|
172
|
+
}
|
|
173
|
+
interface MigrationTable {
|
|
174
|
+
name: string;
|
|
175
|
+
timestamp: string;
|
|
176
|
+
}
|
|
177
|
+
interface CollectionTable {
|
|
178
|
+
id: string;
|
|
179
|
+
slug: string;
|
|
180
|
+
label: string;
|
|
181
|
+
label_singular: string | null;
|
|
182
|
+
description: string | null;
|
|
183
|
+
icon: string | null;
|
|
184
|
+
supports: string | null;
|
|
185
|
+
source: string | null;
|
|
186
|
+
search_config: string | null;
|
|
187
|
+
has_seo: number;
|
|
188
|
+
url_pattern: string | null;
|
|
189
|
+
comments_enabled: Generated<number>;
|
|
190
|
+
comments_moderation: Generated<string>;
|
|
191
|
+
comments_closed_after_days: Generated<number>;
|
|
192
|
+
comments_auto_approve_users: Generated<number>;
|
|
193
|
+
created_at: Generated<string>;
|
|
194
|
+
updated_at: Generated<string>;
|
|
195
|
+
}
|
|
196
|
+
interface SeoTable {
|
|
197
|
+
collection: string;
|
|
198
|
+
content_id: string;
|
|
199
|
+
seo_title: string | null;
|
|
200
|
+
seo_description: string | null;
|
|
201
|
+
seo_image: string | null;
|
|
202
|
+
seo_canonical: string | null;
|
|
203
|
+
seo_no_index: number;
|
|
204
|
+
created_at: Generated<string>;
|
|
205
|
+
updated_at: Generated<string>;
|
|
206
|
+
}
|
|
207
|
+
interface FieldTable {
|
|
208
|
+
id: string;
|
|
209
|
+
collection_id: string;
|
|
210
|
+
slug: string;
|
|
211
|
+
label: string;
|
|
212
|
+
type: string;
|
|
213
|
+
column_type: string;
|
|
214
|
+
required: number;
|
|
215
|
+
unique: number;
|
|
216
|
+
default_value: string | null;
|
|
217
|
+
validation: string | null;
|
|
218
|
+
widget: string | null;
|
|
219
|
+
options: string | null;
|
|
220
|
+
sort_order: number;
|
|
221
|
+
searchable: Generated<number>;
|
|
222
|
+
translatable: Generated<number>;
|
|
223
|
+
created_at: Generated<string>;
|
|
224
|
+
}
|
|
225
|
+
interface PluginStorageTable {
|
|
226
|
+
plugin_id: string;
|
|
227
|
+
collection: string;
|
|
228
|
+
id: string;
|
|
229
|
+
data: string;
|
|
230
|
+
created_at: Generated<string>;
|
|
231
|
+
updated_at: Generated<string>;
|
|
232
|
+
}
|
|
233
|
+
interface PluginStateTable {
|
|
234
|
+
plugin_id: string;
|
|
235
|
+
version: string;
|
|
236
|
+
status: string;
|
|
237
|
+
installed_at: Generated<string>;
|
|
238
|
+
activated_at: string | null;
|
|
239
|
+
deactivated_at: string | null;
|
|
240
|
+
data: string | null;
|
|
241
|
+
source: Generated<string>;
|
|
242
|
+
marketplace_version: string | null;
|
|
243
|
+
display_name: string | null;
|
|
244
|
+
description: string | null;
|
|
245
|
+
}
|
|
246
|
+
interface PluginIndexTable {
|
|
247
|
+
plugin_id: string;
|
|
248
|
+
collection: string;
|
|
249
|
+
index_name: string;
|
|
250
|
+
fields: string;
|
|
251
|
+
created_at: Generated<string>;
|
|
252
|
+
}
|
|
253
|
+
interface MenuTable {
|
|
254
|
+
id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
label: string;
|
|
257
|
+
created_at: Generated<string>;
|
|
258
|
+
updated_at: Generated<string>;
|
|
259
|
+
}
|
|
260
|
+
interface MenuItemTable {
|
|
261
|
+
id: string;
|
|
262
|
+
menu_id: string;
|
|
263
|
+
parent_id: string | null;
|
|
264
|
+
sort_order: number;
|
|
265
|
+
type: string;
|
|
266
|
+
reference_collection: string | null;
|
|
267
|
+
reference_id: string | null;
|
|
268
|
+
custom_url: string | null;
|
|
269
|
+
label: string;
|
|
270
|
+
title_attr: string | null;
|
|
271
|
+
target: string | null;
|
|
272
|
+
css_classes: string | null;
|
|
273
|
+
created_at: Generated<string>;
|
|
274
|
+
}
|
|
275
|
+
interface WidgetAreaTable {
|
|
276
|
+
id: string;
|
|
277
|
+
name: string;
|
|
278
|
+
label: string;
|
|
279
|
+
description: string | null;
|
|
280
|
+
created_at: Generated<string>;
|
|
281
|
+
}
|
|
282
|
+
interface WidgetTable {
|
|
283
|
+
id: string;
|
|
284
|
+
area_id: string;
|
|
285
|
+
sort_order: number;
|
|
286
|
+
type: string;
|
|
287
|
+
title: string | null;
|
|
288
|
+
content: string | null;
|
|
289
|
+
menu_name: string | null;
|
|
290
|
+
component_id: string | null;
|
|
291
|
+
component_props: string | null;
|
|
292
|
+
created_at: Generated<string>;
|
|
293
|
+
}
|
|
294
|
+
interface CronTaskTable {
|
|
295
|
+
id: string;
|
|
296
|
+
plugin_id: string;
|
|
297
|
+
task_name: string;
|
|
298
|
+
schedule: string;
|
|
299
|
+
is_oneshot: number;
|
|
300
|
+
data: string | null;
|
|
301
|
+
next_run_at: string;
|
|
302
|
+
last_run_at: string | null;
|
|
303
|
+
status: string;
|
|
304
|
+
locked_at: string | null;
|
|
305
|
+
enabled: number;
|
|
306
|
+
created_at: Generated<string>;
|
|
307
|
+
}
|
|
308
|
+
interface CommentTable {
|
|
309
|
+
id: string;
|
|
310
|
+
collection: string;
|
|
311
|
+
content_id: string;
|
|
312
|
+
parent_id: string | null;
|
|
313
|
+
author_name: string;
|
|
314
|
+
author_email: string;
|
|
315
|
+
author_user_id: string | null;
|
|
316
|
+
body: string;
|
|
317
|
+
status: string;
|
|
318
|
+
ip_hash: string | null;
|
|
319
|
+
user_agent: string | null;
|
|
320
|
+
moderation_metadata: string | null;
|
|
321
|
+
created_at: Generated<string>;
|
|
322
|
+
updated_at: Generated<string>;
|
|
323
|
+
}
|
|
324
|
+
interface SectionTable {
|
|
325
|
+
id: string;
|
|
326
|
+
slug: string;
|
|
327
|
+
title: string;
|
|
328
|
+
description: string | null;
|
|
329
|
+
keywords: string | null;
|
|
330
|
+
content: string;
|
|
331
|
+
preview_media_id: string | null;
|
|
332
|
+
source: string;
|
|
333
|
+
theme_id: string | null;
|
|
334
|
+
created_at: Generated<string>;
|
|
335
|
+
updated_at: Generated<string>;
|
|
336
|
+
}
|
|
337
|
+
interface Database {
|
|
338
|
+
revisions: RevisionTable;
|
|
339
|
+
taxonomies: TaxonomyTable;
|
|
340
|
+
content_taxonomies: ContentTaxonomyTable;
|
|
341
|
+
_dineway_taxonomy_defs: TaxonomyDefTable;
|
|
342
|
+
media: MediaTable;
|
|
343
|
+
users: UserTable;
|
|
344
|
+
credentials: CredentialTable;
|
|
345
|
+
auth_tokens: AuthTokenTable;
|
|
346
|
+
oauth_accounts: OAuthAccountTable;
|
|
347
|
+
allowed_domains: AllowedDomainTable;
|
|
348
|
+
auth_challenges: AuthChallengeTable;
|
|
349
|
+
options: OptionTable;
|
|
350
|
+
audit_logs: AuditLogTable;
|
|
351
|
+
_dineway_migrations: MigrationTable;
|
|
352
|
+
_dineway_collections: CollectionTable;
|
|
353
|
+
_dineway_fields: FieldTable;
|
|
354
|
+
_plugin_storage: PluginStorageTable;
|
|
355
|
+
_plugin_state: PluginStateTable;
|
|
356
|
+
_plugin_indexes: PluginIndexTable;
|
|
357
|
+
_dineway_menus: MenuTable;
|
|
358
|
+
_dineway_menu_items: MenuItemTable;
|
|
359
|
+
_dineway_widget_areas: WidgetAreaTable;
|
|
360
|
+
_dineway_widgets: WidgetTable;
|
|
361
|
+
_dineway_sections: SectionTable;
|
|
362
|
+
_dineway_api_tokens: ApiTokenTable;
|
|
363
|
+
_dineway_oauth_tokens: OAuthTokenTable;
|
|
364
|
+
_dineway_device_codes: DeviceCodeTable;
|
|
365
|
+
_dineway_authorization_codes: AuthorizationCodeTable;
|
|
366
|
+
_dineway_oauth_clients: OAuthClientTable;
|
|
367
|
+
_dineway_seo: SeoTable;
|
|
368
|
+
_dineway_cron_tasks: CronTaskTable;
|
|
369
|
+
_dineway_comments: CommentTable;
|
|
370
|
+
_dineway_redirects: RedirectTable;
|
|
371
|
+
_dineway_404_log: NotFoundLogTable;
|
|
372
|
+
_dineway_bylines: BylineTable;
|
|
373
|
+
_dineway_content_bylines: ContentBylineTable;
|
|
374
|
+
_dineway_rate_limits: RateLimitTable;
|
|
375
|
+
}
|
|
376
|
+
interface RedirectTable {
|
|
377
|
+
id: string;
|
|
378
|
+
source: string;
|
|
379
|
+
destination: string;
|
|
380
|
+
type: number;
|
|
381
|
+
is_pattern: number;
|
|
382
|
+
enabled: number;
|
|
383
|
+
hits: number;
|
|
384
|
+
last_hit_at: string | null;
|
|
385
|
+
group_name: string | null;
|
|
386
|
+
auto: number;
|
|
387
|
+
created_at: string;
|
|
388
|
+
updated_at: string;
|
|
389
|
+
}
|
|
390
|
+
interface NotFoundLogTable {
|
|
391
|
+
id: string;
|
|
392
|
+
path: string;
|
|
393
|
+
referrer: string | null;
|
|
394
|
+
user_agent: string | null;
|
|
395
|
+
ip: string | null;
|
|
396
|
+
created_at: string;
|
|
397
|
+
}
|
|
398
|
+
interface BylineTable {
|
|
399
|
+
id: string;
|
|
400
|
+
slug: string;
|
|
401
|
+
display_name: string;
|
|
402
|
+
bio: string | null;
|
|
403
|
+
avatar_media_id: string | null;
|
|
404
|
+
website_url: string | null;
|
|
405
|
+
user_id: string | null;
|
|
406
|
+
is_guest: number;
|
|
407
|
+
created_at: Generated<string>;
|
|
408
|
+
updated_at: Generated<string>;
|
|
409
|
+
}
|
|
410
|
+
interface ContentBylineTable {
|
|
411
|
+
id: string;
|
|
412
|
+
collection_slug: string;
|
|
413
|
+
content_id: string;
|
|
414
|
+
byline_id: string;
|
|
415
|
+
sort_order: number;
|
|
416
|
+
role_label: string | null;
|
|
417
|
+
created_at: Generated<string>;
|
|
418
|
+
}
|
|
419
|
+
interface RateLimitTable {
|
|
420
|
+
key: string;
|
|
421
|
+
window: string;
|
|
422
|
+
count: number;
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
export { MediaTable as n, UserTable as r, Database as t };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//#region src/schema/types.ts
|
|
2
|
+
/**
|
|
3
|
+
* Array of all field types for validation
|
|
4
|
+
*/
|
|
5
|
+
const FIELD_TYPES = [
|
|
6
|
+
"string",
|
|
7
|
+
"text",
|
|
8
|
+
"number",
|
|
9
|
+
"integer",
|
|
10
|
+
"boolean",
|
|
11
|
+
"datetime",
|
|
12
|
+
"select",
|
|
13
|
+
"multiSelect",
|
|
14
|
+
"portableText",
|
|
15
|
+
"image",
|
|
16
|
+
"file",
|
|
17
|
+
"reference",
|
|
18
|
+
"json",
|
|
19
|
+
"slug",
|
|
20
|
+
"repeater"
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Map field types to their SQLite column types
|
|
24
|
+
*/
|
|
25
|
+
const FIELD_TYPE_TO_COLUMN = {
|
|
26
|
+
string: "TEXT",
|
|
27
|
+
text: "TEXT",
|
|
28
|
+
number: "REAL",
|
|
29
|
+
integer: "INTEGER",
|
|
30
|
+
boolean: "INTEGER",
|
|
31
|
+
datetime: "TEXT",
|
|
32
|
+
select: "TEXT",
|
|
33
|
+
multiSelect: "JSON",
|
|
34
|
+
portableText: "JSON",
|
|
35
|
+
image: "TEXT",
|
|
36
|
+
file: "TEXT",
|
|
37
|
+
reference: "TEXT",
|
|
38
|
+
json: "JSON",
|
|
39
|
+
slug: "TEXT",
|
|
40
|
+
repeater: "JSON"
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Reserved field slugs that cannot be used
|
|
44
|
+
*/
|
|
45
|
+
const RESERVED_FIELD_SLUGS = [
|
|
46
|
+
"id",
|
|
47
|
+
"slug",
|
|
48
|
+
"status",
|
|
49
|
+
"author_id",
|
|
50
|
+
"primary_byline_id",
|
|
51
|
+
"created_at",
|
|
52
|
+
"updated_at",
|
|
53
|
+
"published_at",
|
|
54
|
+
"scheduled_at",
|
|
55
|
+
"deleted_at",
|
|
56
|
+
"version",
|
|
57
|
+
"live_revision_id",
|
|
58
|
+
"draft_revision_id"
|
|
59
|
+
];
|
|
60
|
+
/**
|
|
61
|
+
* Reserved collection slugs that cannot be used
|
|
62
|
+
*/
|
|
63
|
+
const RESERVED_COLLECTION_SLUGS = [
|
|
64
|
+
"content",
|
|
65
|
+
"media",
|
|
66
|
+
"users",
|
|
67
|
+
"revisions",
|
|
68
|
+
"taxonomies",
|
|
69
|
+
"options",
|
|
70
|
+
"audit_logs"
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
export { RESERVED_FIELD_SLUGS as i, FIELD_TYPE_TO_COLUMN as n, RESERVED_COLLECTION_SLUGS as r, FIELD_TYPES as t };
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//#region src/storage/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Storage Layer Types
|
|
4
|
+
*
|
|
5
|
+
* Defines the interface for S3-compatible storage backends.
|
|
6
|
+
* Works with AWS S3, MinIO, and other S3-compatible services.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Storage configuration for S3-compatible backends
|
|
10
|
+
*/
|
|
11
|
+
interface S3StorageConfig {
|
|
12
|
+
/** S3 endpoint URL (e.g., "https://storage.example.com") */
|
|
13
|
+
endpoint: string;
|
|
14
|
+
/** Bucket name */
|
|
15
|
+
bucket: string;
|
|
16
|
+
/** AWS access key ID */
|
|
17
|
+
accessKeyId: string;
|
|
18
|
+
/** AWS secret access key */
|
|
19
|
+
secretAccessKey: string;
|
|
20
|
+
/** Optional region (provider-specific default when omitted) */
|
|
21
|
+
region?: string;
|
|
22
|
+
/** Optional public URL prefix for generated URLs (e.g., CDN URL) */
|
|
23
|
+
publicUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Local filesystem storage for development
|
|
27
|
+
*/
|
|
28
|
+
interface LocalStorageConfig {
|
|
29
|
+
/** Directory path for storing files */
|
|
30
|
+
directory: string;
|
|
31
|
+
/** Base URL for serving files */
|
|
32
|
+
baseUrl: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Storage adapter descriptor (serializable config)
|
|
36
|
+
*/
|
|
37
|
+
interface StorageDescriptor {
|
|
38
|
+
/** Module path exporting createStorage function */
|
|
39
|
+
entrypoint: string;
|
|
40
|
+
/** Serializable config passed to createStorage at runtime */
|
|
41
|
+
config: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Factory function signature for storage adapters
|
|
45
|
+
*
|
|
46
|
+
* Each adapter resolves its own runtime configuration:
|
|
47
|
+
* - S3: uses credentials from config
|
|
48
|
+
* - Local: uses filesystem path from config
|
|
49
|
+
*/
|
|
50
|
+
type CreateStorageFn = (config: Record<string, unknown>) => Storage;
|
|
51
|
+
/**
|
|
52
|
+
* Upload result
|
|
53
|
+
*/
|
|
54
|
+
interface UploadResult {
|
|
55
|
+
/** Storage key (path within bucket) */
|
|
56
|
+
key: string;
|
|
57
|
+
/** Public URL to access the file */
|
|
58
|
+
url: string;
|
|
59
|
+
/** File size in bytes */
|
|
60
|
+
size: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Download result
|
|
64
|
+
*/
|
|
65
|
+
interface DownloadResult {
|
|
66
|
+
/** File content as readable stream */
|
|
67
|
+
body: ReadableStream<Uint8Array>;
|
|
68
|
+
/** MIME type */
|
|
69
|
+
contentType: string;
|
|
70
|
+
/** File size in bytes */
|
|
71
|
+
size: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Signed URL for direct upload
|
|
75
|
+
*/
|
|
76
|
+
interface SignedUploadUrl {
|
|
77
|
+
/** Signed URL for PUT request */
|
|
78
|
+
url: string;
|
|
79
|
+
/** HTTP method (always PUT) */
|
|
80
|
+
method: "PUT";
|
|
81
|
+
/** Headers to include in the upload request */
|
|
82
|
+
headers: Record<string, string>;
|
|
83
|
+
/** URL expiration time (ISO string) */
|
|
84
|
+
expiresAt: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Options for generating signed upload URL
|
|
88
|
+
*/
|
|
89
|
+
interface SignedUploadOptions {
|
|
90
|
+
/** Storage key (path within bucket) */
|
|
91
|
+
key: string;
|
|
92
|
+
/** MIME type of the file */
|
|
93
|
+
contentType: string;
|
|
94
|
+
/** File size in bytes (for content-length validation) */
|
|
95
|
+
size?: number;
|
|
96
|
+
/** URL expiration in seconds (default: 3600) */
|
|
97
|
+
expiresIn?: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* File listing result
|
|
101
|
+
*/
|
|
102
|
+
interface ListResult {
|
|
103
|
+
/** List of files */
|
|
104
|
+
files: FileInfo[];
|
|
105
|
+
/** Cursor for next page (if more results) */
|
|
106
|
+
nextCursor?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* File info from listing
|
|
110
|
+
*/
|
|
111
|
+
interface FileInfo {
|
|
112
|
+
/** Storage key */
|
|
113
|
+
key: string;
|
|
114
|
+
/** File size in bytes */
|
|
115
|
+
size: number;
|
|
116
|
+
/** Last modified date */
|
|
117
|
+
lastModified: Date;
|
|
118
|
+
/** ETag (content hash) */
|
|
119
|
+
etag?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Options for listing files
|
|
123
|
+
*/
|
|
124
|
+
interface ListOptions {
|
|
125
|
+
/** Filter by key prefix */
|
|
126
|
+
prefix?: string;
|
|
127
|
+
/** Maximum results per page */
|
|
128
|
+
limit?: number;
|
|
129
|
+
/** Cursor from previous list call */
|
|
130
|
+
cursor?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Storage interface
|
|
134
|
+
*
|
|
135
|
+
* All storage backends must implement this interface.
|
|
136
|
+
*/
|
|
137
|
+
interface Storage {
|
|
138
|
+
/**
|
|
139
|
+
* Upload a file to storage
|
|
140
|
+
*/
|
|
141
|
+
upload(options: {
|
|
142
|
+
key: string;
|
|
143
|
+
body: Buffer | Uint8Array | ReadableStream<Uint8Array>;
|
|
144
|
+
contentType: string;
|
|
145
|
+
}): Promise<UploadResult>;
|
|
146
|
+
/**
|
|
147
|
+
* Download a file from storage
|
|
148
|
+
*/
|
|
149
|
+
download(key: string): Promise<DownloadResult>;
|
|
150
|
+
/**
|
|
151
|
+
* Delete a file from storage
|
|
152
|
+
* Idempotent - does not throw if file doesn't exist
|
|
153
|
+
*/
|
|
154
|
+
delete(key: string): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Check if a file exists
|
|
157
|
+
*/
|
|
158
|
+
exists(key: string): Promise<boolean>;
|
|
159
|
+
/**
|
|
160
|
+
* List files in storage
|
|
161
|
+
*/
|
|
162
|
+
list(options?: ListOptions): Promise<ListResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Generate a signed URL for direct upload
|
|
165
|
+
* Client uploads directly to storage, bypassing the server
|
|
166
|
+
*/
|
|
167
|
+
getSignedUploadUrl(options: SignedUploadOptions): Promise<SignedUploadUrl>;
|
|
168
|
+
/**
|
|
169
|
+
* Get public URL for a file
|
|
170
|
+
*/
|
|
171
|
+
getPublicUrl(key: string): string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Storage error with additional context
|
|
175
|
+
*/
|
|
176
|
+
declare class DinewayStorageError extends Error {
|
|
177
|
+
code: string;
|
|
178
|
+
cause?: unknown | undefined;
|
|
179
|
+
constructor(message: string, code: string, cause?: unknown | undefined);
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
182
|
+
export { ListOptions as a, S3StorageConfig as c, Storage as d, StorageDescriptor as f, FileInfo as i, SignedUploadOptions as l, DinewayStorageError as n, ListResult as o, UploadResult as p, DownloadResult as r, LocalStorageConfig as s, CreateStorageFn as t, SignedUploadUrl as u };
|