-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
225 lines (205 loc) · 5.44 KB
/
Copy pathindex.js
File metadata and controls
225 lines (205 loc) · 5.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/**
* Webspresso - Minimal file-based SSR framework for Node.js
*/
const { createApp } = require('./src/server');
const { resolveClientRuntime } = require('./src/client-runtime/resolve');
const { CLIENT_RUNTIME_BASE } = require('./src/client-runtime/mount');
const {
attachDbMiddleware,
getAppContext,
getDb,
hasDb,
getShutdownManager,
hasShutdownManager,
getServiceRegistry,
hasServiceRegistry,
resetAppContext,
setAppContext,
} = require('./src/app-context');
const {
createServiceRegistry,
defineService,
ServiceRegistry,
} = require('./src/services');
const { ShutdownManager, NodeHttpAdapter } = require('./core/shutdown');
const compression = require('./core/compression');
const errors = require('./core/errors');
const {
mountPages,
filePathToRoute,
extractMethodFromFilename,
scanDirectory,
loadI18n,
createTranslator,
detectLocale,
parseNjkFrontmatter,
frontmatterToPatches,
loadNjkRouteTemplate,
clearNjkFrontmatterCaches,
} = require('./src/file-router');
const {
createHelpers,
utils,
AssetManager,
configureAssets,
getAssetManager
} = require('./src/helpers');
const {
PluginManager,
createPluginManager,
getPluginManager,
resetPluginManager
} = require('./src/plugin-manager');
// ORM exports (lazy loaded)
const orm = require('./core/orm');
/** Application kernel (event bus, plugin shell, view resolver, flows). Use `kernel.createApp`; not the framework SSR `createApp`. */
const kernel = require('./core/kernel');
// Built-in plugins
const {
schemaExplorerPlugin,
adminPanelPlugin,
siteAnalyticsPlugin,
auditLogPlugin,
recaptchaPlugin,
swaggerPlugin,
healthCheckPlugin,
restResourcePlugin,
ormCacheAdminPlugin,
uploadPlugin,
createLocalFileProvider,
dataExchangePlugin,
redirectPlugin,
rateLimitPlugin,
contentPlugin,
csrfPlugin,
corsPlugin,
emailPlugin,
basicAuthPlugin,
realtimePlugin,
realtime,
createRealtime,
websocket,
sse,
socketIo,
} = require('./plugins');
const content = require('./core/content');
module.exports = {
// Main API
createApp,
resolveClientRuntime,
CLIENT_RUNTIME_BASE,
attachDbMiddleware,
getAppContext,
getDb,
hasDb,
getShutdownManager,
hasShutdownManager,
getServiceRegistry,
hasServiceRegistry,
resetAppContext,
setAppContext,
// Services Layer
createServiceRegistry,
defineService,
service: defineService,
ServiceRegistry,
memoize: require('./src/services').memoize,
parseTtlMs: require('./src/services').parseTtlMs,
stableCacheKey: require('./src/services').stableCacheKey,
sanitizeInput: require('./src/services').sanitizeInput,
maskSensitiveData: require('./src/services').maskSensitiveData,
discoverServices: require('./src/services').discoverServices,
filePathToServiceName: require('./src/services').filePathToServiceName,
toCamelCase: require('./src/services').toCamelCase,
validateServiceInput: require('./src/services').validateServiceInput,
executeService: require('./src/services').executeService,
// Shutdown & Lifecycle
ShutdownManager,
NodeHttpAdapter,
// HTTP Response Compression
compression,
createCompressionMiddleware: compression.createCompressionMiddleware,
// Exceptions & Error Handling
errors,
WebspressoError: errors.WebspressoError,
HttpError: errors.HttpError,
BadRequestError: errors.BadRequestError,
UnauthorizedError: errors.UnauthorizedError,
ForbiddenError: errors.ForbiddenError,
NotFoundError: errors.NotFoundError,
MethodNotAllowedError: errors.MethodNotAllowedError,
ConflictError: errors.ConflictError,
PayloadTooLargeError: errors.PayloadTooLargeError,
UnsupportedMediaTypeError: errors.UnsupportedMediaTypeError,
UnprocessableEntityError: errors.UnprocessableEntityError,
TooManyRequestsError: errors.TooManyRequestsError,
ValidationError: errors.ValidationError,
ConfigurationError: errors.ConfigurationError,
PluginError: errors.PluginError,
SecurityError: errors.SecurityError,
RequestError: errors.RequestError,
RequestAbortedError: errors.RequestAbortedError,
RouterError: errors.RouterError,
RouteNotFoundError: errors.RouteNotFoundError,
RouteGenerationError: errors.RouteGenerationError,
normalizeError: errors.normalizeError,
toErrorResponseObject: errors.toErrorResponseObject,
// Router utilities (for advanced use)
mountPages,
filePathToRoute,
extractMethodFromFilename,
scanDirectory,
loadI18n,
createTranslator,
detectLocale,
parseNjkFrontmatter,
frontmatterToPatches,
loadNjkRouteTemplate,
clearNjkFrontmatterCaches,
// Template helpers
createHelpers,
utils,
// Asset management
AssetManager,
configureAssets,
getAssetManager,
// Plugin system
PluginManager,
createPluginManager,
getPluginManager,
resetPluginManager,
// ORM
...orm,
/** Event bus / plugin shell / view resolver / flows (`kernel.createApp` is distinct from SSR `createApp`) */
kernel,
// Direct zdb export (for convenience)
zdb: orm.zdb,
// Plugins
schemaExplorerPlugin,
adminPanelPlugin,
siteAnalyticsPlugin,
auditLogPlugin,
recaptchaPlugin,
swaggerPlugin,
healthCheckPlugin,
restResourcePlugin,
ormCacheAdminPlugin,
uploadPlugin,
createLocalFileProvider,
dataExchangePlugin,
redirectPlugin,
rateLimitPlugin,
contentPlugin,
csrfPlugin,
corsPlugin,
emailPlugin,
basicAuthPlugin,
realtimePlugin,
realtime,
createRealtime,
websocket,
sse,
socketIo,
// Schema-driven CMS core (framework-agnostic)
content,
};