@zaaxch/grasp-server 0.0.0-stage → 0.2.0
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/README.md +15 -2
- package/dist/auth.d.ts +41 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +170 -0
- package/dist/auth.js.map +1 -0
- package/dist/billing.d.ts +163 -0
- package/dist/billing.d.ts.map +1 -0
- package/dist/billing.js +518 -0
- package/dist/billing.js.map +1 -0
- package/dist/email.d.ts +33 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +104 -0
- package/dist/email.js.map +1 -0
- package/dist/features.d.ts +241 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +351 -0
- package/dist/features.js.map +1 -0
- package/dist/http.d.ts +37 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +640 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/jobs.d.ts +27 -0
- package/dist/jobs.d.ts.map +1 -0
- package/dist/jobs.js +197 -0
- package/dist/jobs.js.map +1 -0
- package/dist/logging.d.ts +16 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +61 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp.d.ts +34 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +274 -0
- package/dist/mcp.js.map +1 -0
- package/dist/ops.d.ts +31 -0
- package/dist/ops.d.ts.map +1 -0
- package/dist/ops.js +287 -0
- package/dist/ops.js.map +1 -0
- package/dist/redis.d.ts +50 -0
- package/dist/redis.d.ts.map +1 -0
- package/dist/redis.js +211 -0
- package/dist/redis.js.map +1 -0
- package/package.json +86 -3
package/dist/features.js
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { FEATURE_NAME_REGEX, GraspError, } from '@zaaxch/grasp-core';
|
|
2
|
+
import { CronExpressionParser } from 'cron-parser';
|
|
3
|
+
const JOB_NAME_REGEX = /^[a-z][a-zA-Z0-9._-]{1,80}$/;
|
|
4
|
+
const OPS_COMMAND_NAME_REGEX = /^[a-z][a-zA-Z0-9:._-]{1,80}$/;
|
|
5
|
+
const MCP_TOOL_NAME_REGEX = /^[a-z][a-zA-Z0-9_-]{1,63}$/;
|
|
6
|
+
const RESERVED_OPS_COMMANDS = new Set([
|
|
7
|
+
'users:list',
|
|
8
|
+
'users:inspect',
|
|
9
|
+
'billing:grant-plan',
|
|
10
|
+
'billing:revoke-plan',
|
|
11
|
+
'billing:grant-credits',
|
|
12
|
+
'webhooks:quarantined',
|
|
13
|
+
'webhooks:replay',
|
|
14
|
+
'jobs:stats',
|
|
15
|
+
'jobs:retry-failed',
|
|
16
|
+
'dev:mint-user',
|
|
17
|
+
]);
|
|
18
|
+
const httpResponseBuilderImpl = {
|
|
19
|
+
redirect(url, status = 302, headers) {
|
|
20
|
+
return {
|
|
21
|
+
kind: 'redirect',
|
|
22
|
+
url,
|
|
23
|
+
status,
|
|
24
|
+
...(headers !== undefined ? { headers } : {}),
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
json(data, status = 200, headers) {
|
|
28
|
+
return {
|
|
29
|
+
kind: 'json',
|
|
30
|
+
data,
|
|
31
|
+
status,
|
|
32
|
+
...(headers !== undefined ? { headers } : {}),
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
text(body, status = 200, headers) {
|
|
36
|
+
return {
|
|
37
|
+
kind: 'text',
|
|
38
|
+
body,
|
|
39
|
+
status,
|
|
40
|
+
...(headers !== undefined ? { headers } : {}),
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
empty(status = 204, headers) {
|
|
44
|
+
return {
|
|
45
|
+
kind: 'empty',
|
|
46
|
+
status,
|
|
47
|
+
...(headers !== undefined ? { headers } : {}),
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export const graspHttpResponseBuilder = Object.freeze(httpResponseBuilderImpl);
|
|
52
|
+
/** Defines a typed background job consumed by `createGraspWorker`. */
|
|
53
|
+
export function defineJob(config) {
|
|
54
|
+
if (!JOB_NAME_REGEX.test(config.name)) {
|
|
55
|
+
throw GraspError.validation('Invalid job name', [
|
|
56
|
+
{ path: ['name'], message: `Job name "${config.name}" must match ${JOB_NAME_REGEX.source}` },
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
const maxAttempts = config.maxAttempts ?? 5;
|
|
60
|
+
if (!Number.isSafeInteger(maxAttempts) || maxAttempts < 1) {
|
|
61
|
+
throw GraspError.validation('Invalid maxAttempts', [
|
|
62
|
+
{ path: ['maxAttempts'], message: 'maxAttempts must be a positive integer' },
|
|
63
|
+
]);
|
|
64
|
+
}
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
kind: 'job',
|
|
67
|
+
name: config.name,
|
|
68
|
+
input: config.input,
|
|
69
|
+
maxAttempts,
|
|
70
|
+
handler: config.handler,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** Defines a non-overlapping distributed cron schedule validated immediately at startup. */
|
|
74
|
+
export function defineSchedule(config) {
|
|
75
|
+
if (!JOB_NAME_REGEX.test(config.name)) {
|
|
76
|
+
throw GraspError.validation('Invalid schedule name', [
|
|
77
|
+
{
|
|
78
|
+
path: ['name'],
|
|
79
|
+
message: `Schedule name "${config.name}" must match ${JOB_NAME_REGEX.source}`,
|
|
80
|
+
},
|
|
81
|
+
]);
|
|
82
|
+
}
|
|
83
|
+
const timezone = config.timezone?.trim() || undefined;
|
|
84
|
+
try {
|
|
85
|
+
CronExpressionParser.parse(config.cron, ...(timezone !== undefined ? [{ tz: timezone }] : []));
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
throw GraspError.validation('Invalid cron expression or timezone', [
|
|
89
|
+
{
|
|
90
|
+
path: ['cron'],
|
|
91
|
+
message: `Invalid cron expression "${config.cron}"${timezone ? ` (tz=${timezone})` : ''}: ${String(err)}`,
|
|
92
|
+
},
|
|
93
|
+
]);
|
|
94
|
+
}
|
|
95
|
+
const lockTtlMs = config.lockTtlMs ?? 60_000;
|
|
96
|
+
if (!Number.isSafeInteger(lockTtlMs) || lockTtlMs < 500) {
|
|
97
|
+
throw GraspError.validation('Invalid lockTtlMs', [
|
|
98
|
+
{ path: ['lockTtlMs'], message: 'lockTtlMs must be >= 500ms' },
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
return Object.freeze({
|
|
102
|
+
kind: 'schedule',
|
|
103
|
+
name: config.name,
|
|
104
|
+
cron: config.cron,
|
|
105
|
+
...(timezone !== undefined ? { timezone } : {}),
|
|
106
|
+
lockTtlMs,
|
|
107
|
+
handler: config.handler,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/** Defines a feature's transactional account-deletion eraser hook. */
|
|
111
|
+
export function defineAccountEraser(config) {
|
|
112
|
+
if (config.name.trim().length === 0) {
|
|
113
|
+
throw GraspError.validation('Invalid eraser name', [
|
|
114
|
+
{ path: ['name'], message: 'Eraser name cannot be empty' },
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
return Object.freeze({
|
|
118
|
+
kind: 'eraser',
|
|
119
|
+
name: config.name,
|
|
120
|
+
collections: Object.freeze([...config.collections]),
|
|
121
|
+
erase: config.erase,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** Defines a typed raw HTTP route handlers map against a feature contract's `httpRoutes`. */
|
|
125
|
+
export function defineHttpRoutes(contract, routes) {
|
|
126
|
+
for (const key of Object.keys(contract.httpRoutes)) {
|
|
127
|
+
if (typeof routes[key] !== 'function') {
|
|
128
|
+
throw GraspError.validation(`Missing HTTP route handler "${contract.name}.${key}"`, [
|
|
129
|
+
{ path: [contract.name, 'httpRoutes', key], message: 'Handler function is required' },
|
|
130
|
+
]);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return Object.freeze({
|
|
134
|
+
contract,
|
|
135
|
+
routes: Object.freeze({ ...routes }),
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/** Defines a server-side feature operator command registered into `pnpm ops`. */
|
|
139
|
+
export function defineOpsCommand(config) {
|
|
140
|
+
if (!OPS_COMMAND_NAME_REGEX.test(config.name)) {
|
|
141
|
+
throw GraspError.validation('Invalid ops command name', [
|
|
142
|
+
{
|
|
143
|
+
path: ['name'],
|
|
144
|
+
message: `Ops command "${config.name}" must match ${OPS_COMMAND_NAME_REGEX.source}`,
|
|
145
|
+
},
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
if (RESERVED_OPS_COMMANDS.has(config.name)) {
|
|
149
|
+
throw GraspError.validation('Reserved ops command name', [
|
|
150
|
+
{ path: ['name'], message: `Ops command "${config.name}" is reserved by Grasp shell` },
|
|
151
|
+
]);
|
|
152
|
+
}
|
|
153
|
+
return Object.freeze({
|
|
154
|
+
kind: 'ops',
|
|
155
|
+
name: config.name,
|
|
156
|
+
description: config.description,
|
|
157
|
+
valueFlags: Object.freeze([...(config.valueFlags ?? [])]),
|
|
158
|
+
handler: config.handler,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
/** Defines an MCP tool exposed by `createGraspMcpServer` over Streamable HTTP. */
|
|
162
|
+
export function defineMcpTool(config) {
|
|
163
|
+
if (!MCP_TOOL_NAME_REGEX.test(config.name)) {
|
|
164
|
+
throw GraspError.validation('Invalid MCP tool name', [
|
|
165
|
+
{
|
|
166
|
+
path: ['name'],
|
|
167
|
+
message: `MCP tool name "${config.name}" must match ${MCP_TOOL_NAME_REGEX.source}`,
|
|
168
|
+
},
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
return Object.freeze({
|
|
172
|
+
kind: 'mcp-tool',
|
|
173
|
+
name: config.name,
|
|
174
|
+
description: config.description,
|
|
175
|
+
input: config.input,
|
|
176
|
+
handler: config.handler,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/** Binds typed procedure & SSE stream handlers against a shared `@zaaxch/grasp-core` feature contract. */
|
|
180
|
+
export function defineProcedures(contract, procedures, streams) {
|
|
181
|
+
for (const key of Object.keys(contract.procedures)) {
|
|
182
|
+
if (typeof procedures[key] !== 'function') {
|
|
183
|
+
throw GraspError.validation(`Missing procedure handler "${contract.name}.${key}"`, [
|
|
184
|
+
{ path: [contract.name, 'procedures', key], message: 'Handler function is required' },
|
|
185
|
+
]);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (const key of Object.keys(contract.streams)) {
|
|
189
|
+
if (typeof streams?.[key] !== 'function') {
|
|
190
|
+
throw GraspError.validation(`Missing stream handler "${contract.name}.${key}"`, [
|
|
191
|
+
{ path: [contract.name, 'streams', key], message: 'Stream handler function is required' },
|
|
192
|
+
]);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return Object.freeze({
|
|
196
|
+
contract,
|
|
197
|
+
procedures: Object.freeze({ ...procedures }),
|
|
198
|
+
streams: Object.freeze({ ...(streams ?? {}) }),
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export function defineServerFeature(config) {
|
|
202
|
+
const derivedName = config.handlers?.contract.name ?? config.httpRoutes?.contract.name ?? config.name;
|
|
203
|
+
if (!derivedName || !FEATURE_NAME_REGEX.test(derivedName)) {
|
|
204
|
+
throw GraspError.validation('Invalid or missing server feature name', [
|
|
205
|
+
{
|
|
206
|
+
path: ['name'],
|
|
207
|
+
message: 'Server feature must provide handlers, httpRoutes, or a valid camelCase name',
|
|
208
|
+
},
|
|
209
|
+
]);
|
|
210
|
+
}
|
|
211
|
+
if (config.handlers &&
|
|
212
|
+
config.httpRoutes &&
|
|
213
|
+
config.handlers.contract.name !== config.httpRoutes.contract.name) {
|
|
214
|
+
throw GraspError.validation('Mismatched feature contracts across handlers and httpRoutes', [
|
|
215
|
+
{
|
|
216
|
+
path: ['httpRoutes'],
|
|
217
|
+
message: `Expected contract "${config.handlers.contract.name}", got "${config.httpRoutes.contract.name}"`,
|
|
218
|
+
},
|
|
219
|
+
]);
|
|
220
|
+
}
|
|
221
|
+
if (config.name !== undefined && derivedName !== config.name) {
|
|
222
|
+
throw GraspError.validation('Server feature name does not match its contract name', [
|
|
223
|
+
{ path: ['name'], message: `Expected feature name "${derivedName}"` },
|
|
224
|
+
]);
|
|
225
|
+
}
|
|
226
|
+
const contract = config.handlers?.contract ?? config.httpRoutes?.contract;
|
|
227
|
+
return Object.freeze({
|
|
228
|
+
name: derivedName,
|
|
229
|
+
...(contract !== undefined ? { contract } : {}),
|
|
230
|
+
procedures: config.handlers?.procedures ?? Object.freeze({}),
|
|
231
|
+
streams: config.handlers?.streams ?? Object.freeze({}),
|
|
232
|
+
httpRoutes: config.httpRoutes?.routes ?? Object.freeze({}),
|
|
233
|
+
httpContracts: contract?.httpRoutes ?? Object.freeze({}),
|
|
234
|
+
jobs: Object.freeze([...(config.jobs ?? [])]),
|
|
235
|
+
schedules: Object.freeze([...(config.schedules ?? [])]),
|
|
236
|
+
erasers: Object.freeze([...(config.erasers ?? [])]),
|
|
237
|
+
ops: Object.freeze([...(config.ops ?? [])]),
|
|
238
|
+
mcpTools: Object.freeze([...(config.mcpTools ?? [])]),
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/** Validates and indexes all registered server features into an immutable registry. */
|
|
242
|
+
export function defineServerFeatures(features) {
|
|
243
|
+
const registry = {};
|
|
244
|
+
const seenJobs = new Set();
|
|
245
|
+
const seenSchedules = new Set();
|
|
246
|
+
const seenHttpRoutes = new Set();
|
|
247
|
+
const seenOpsCommands = new Set();
|
|
248
|
+
const seenMcpTools = new Set();
|
|
249
|
+
for (const feature of features) {
|
|
250
|
+
if (Object.hasOwn(registry, feature.name)) {
|
|
251
|
+
throw GraspError.validation(`Duplicate server feature registration "${feature.name}"`, [
|
|
252
|
+
{ path: ['features', feature.name], message: 'Feature already registered' },
|
|
253
|
+
]);
|
|
254
|
+
}
|
|
255
|
+
for (const job of feature.jobs) {
|
|
256
|
+
if (seenJobs.has(job.name)) {
|
|
257
|
+
throw GraspError.validation(`Duplicate job name "${job.name}"`, [
|
|
258
|
+
{ path: ['jobs', job.name], message: 'Job names must be globally unique' },
|
|
259
|
+
]);
|
|
260
|
+
}
|
|
261
|
+
seenJobs.add(job.name);
|
|
262
|
+
}
|
|
263
|
+
for (const schedule of feature.schedules) {
|
|
264
|
+
if (seenSchedules.has(schedule.name)) {
|
|
265
|
+
throw GraspError.validation(`Duplicate schedule name "${schedule.name}"`, [
|
|
266
|
+
{ path: ['schedules', schedule.name], message: 'Schedule names must be globally unique' },
|
|
267
|
+
]);
|
|
268
|
+
}
|
|
269
|
+
seenSchedules.add(schedule.name);
|
|
270
|
+
}
|
|
271
|
+
for (const routeDef of Object.values(feature.httpContracts)) {
|
|
272
|
+
const routeKey = `${routeDef.method} ${routeDef.path}`;
|
|
273
|
+
if (seenHttpRoutes.has(routeKey)) {
|
|
274
|
+
throw GraspError.validation(`Duplicate HTTP route "${routeKey}"`, [
|
|
275
|
+
{ path: ['httpRoutes', routeKey], message: 'HTTP method + path must be globally unique' },
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
seenHttpRoutes.add(routeKey);
|
|
279
|
+
}
|
|
280
|
+
for (const op of feature.ops) {
|
|
281
|
+
if (seenOpsCommands.has(op.name)) {
|
|
282
|
+
throw GraspError.validation(`Duplicate ops command "${op.name}"`, [
|
|
283
|
+
{ path: ['ops', op.name], message: 'Ops command names must be globally unique' },
|
|
284
|
+
]);
|
|
285
|
+
}
|
|
286
|
+
seenOpsCommands.add(op.name);
|
|
287
|
+
}
|
|
288
|
+
for (const tool of feature.mcpTools) {
|
|
289
|
+
if (seenMcpTools.has(tool.name)) {
|
|
290
|
+
throw GraspError.validation(`Duplicate MCP tool "${tool.name}"`, [
|
|
291
|
+
{ path: ['mcpTools', tool.name], message: 'MCP tool names must be globally unique' },
|
|
292
|
+
]);
|
|
293
|
+
}
|
|
294
|
+
seenMcpTools.add(tool.name);
|
|
295
|
+
}
|
|
296
|
+
registry[feature.name] = feature;
|
|
297
|
+
}
|
|
298
|
+
return Object.freeze(registry);
|
|
299
|
+
}
|
|
300
|
+
function unavailableRedisCache() {
|
|
301
|
+
const err = () => GraspError.unavailable('Redis cache is unavailable unless Redis is connected in this context');
|
|
302
|
+
return {
|
|
303
|
+
get: async () => {
|
|
304
|
+
throw err();
|
|
305
|
+
},
|
|
306
|
+
set: async () => {
|
|
307
|
+
throw err();
|
|
308
|
+
},
|
|
309
|
+
del: async () => {
|
|
310
|
+
throw err();
|
|
311
|
+
},
|
|
312
|
+
incr: async () => {
|
|
313
|
+
throw err();
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
export function createBaseContext(deps) {
|
|
318
|
+
return {
|
|
319
|
+
db: deps.db,
|
|
320
|
+
store: deps.store,
|
|
321
|
+
withTransaction: (fn) => deps.store.withTransaction(fn),
|
|
322
|
+
quota: deps.store.quota,
|
|
323
|
+
credits: deps.store.credits,
|
|
324
|
+
locks: deps.locks,
|
|
325
|
+
cache: deps.cache ?? unavailableRedisCache(),
|
|
326
|
+
sse: {
|
|
327
|
+
publish: (channel, event) => deps.sseBus.publish(channel, event),
|
|
328
|
+
},
|
|
329
|
+
jobs: {
|
|
330
|
+
async enqueue(job, rawPayload, opts = {}) {
|
|
331
|
+
const parsed = job.input.safeParse(rawPayload);
|
|
332
|
+
if (!parsed.success) {
|
|
333
|
+
throw GraspError.fromZodError(parsed.error, `Invalid payload for job "${job.name}"`);
|
|
334
|
+
}
|
|
335
|
+
const record = await deps.store.outbox.enqueue({
|
|
336
|
+
jobName: job.name,
|
|
337
|
+
payload: parsed.data,
|
|
338
|
+
maxAttempts: job.maxAttempts,
|
|
339
|
+
...(opts.runAfter !== undefined ? { runAfter: opts.runAfter } : {}),
|
|
340
|
+
}, opts.tx);
|
|
341
|
+
if (opts.tx === undefined) {
|
|
342
|
+
await deps.notifyWakeup().catch(() => { });
|
|
343
|
+
}
|
|
344
|
+
return record.id;
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
email: deps.email,
|
|
348
|
+
log: deps.log,
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
//# sourceMappingURL=features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,UAAU,GAeX,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAMlD,MAAM,cAAc,GAAG,6BAA6B,CAAA;AACpD,MAAM,sBAAsB,GAAG,8BAA8B,CAAA;AAC7D,MAAM,mBAAmB,GAAG,4BAA4B,CAAA;AAExD,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC;IACzD,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,qBAAqB;IACrB,uBAAuB;IACvB,sBAAsB;IACtB,iBAAiB;IACjB,YAAY;IACZ,mBAAmB;IACnB,eAAe;CAChB,CAAC,CAAA;AA+JF,MAAM,uBAAuB,GAA6B;IACxD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO;QACjC,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,GAAG;YACH,MAAM;YACN,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAA;IACH,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO;QAC9B,OAAO;YACL,IAAI,EAAE,MAAM;YACZ,IAAI;YACJ,MAAM;YACN,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9C,CAAA;IACH,CAAC;IACD,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,OAAO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QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACpE,EACD,IAAI,CAAC,EAAE,CACR,CAAA;gBACD,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;oBAC1B,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;gBAC3C,CAAC;gBACD,OAAO,MAAM,CAAC,EAAE,CAAA;YAClB,CAAC;SACF;QACD,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAA;AACH,CAAC"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Server } from 'node:http';
|
|
2
|
+
import { type AnyAppContract, type ResolvedGraspConfig } from '@zaaxch/grasp-core';
|
|
3
|
+
import type { GraspShellStore } from '@zaaxch/grasp-core/store';
|
|
4
|
+
import express from 'express';
|
|
5
|
+
import type { AuthVerifier, DevAuthManager } from './auth.js';
|
|
6
|
+
import { type BillingService } from './billing.js';
|
|
7
|
+
import type { EmailAdapter } from './email.js';
|
|
8
|
+
import { type ServerFeatureRegistry } from './features.js';
|
|
9
|
+
import type { GraspLogger } from './logging.js';
|
|
10
|
+
import type { GraspRedis } from './redis.js';
|
|
11
|
+
export interface CreateGraspServerOptions {
|
|
12
|
+
readonly config: ResolvedGraspConfig;
|
|
13
|
+
readonly appContract: AnyAppContract;
|
|
14
|
+
readonly features: ServerFeatureRegistry;
|
|
15
|
+
readonly store: GraspShellStore;
|
|
16
|
+
readonly db?: unknown;
|
|
17
|
+
readonly redis: GraspRedis;
|
|
18
|
+
readonly auth: AuthVerifier;
|
|
19
|
+
readonly devAuth?: DevAuthManager;
|
|
20
|
+
readonly billing: BillingService;
|
|
21
|
+
readonly email: EmailAdapter;
|
|
22
|
+
readonly logger: GraspLogger;
|
|
23
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
24
|
+
readonly publicDir?: string;
|
|
25
|
+
readonly jsonLimit?: string;
|
|
26
|
+
readonly trustProxy?: boolean | number | string;
|
|
27
|
+
}
|
|
28
|
+
export interface GraspHttpServer {
|
|
29
|
+
readonly app: express.Express;
|
|
30
|
+
listen(port?: number, host?: string): Promise<{
|
|
31
|
+
readonly port: number;
|
|
32
|
+
readonly server: Server;
|
|
33
|
+
}>;
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
export declare function createGraspServer(options: CreateGraspServerOptions): GraspHttpServer;
|
|
37
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,EAWL,KAAK,cAAc,EAGnB,KAAK,mBAAmB,EAGzB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,OAA2D,MAAM,SAAS,CAAA;AAEjF,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC7D,OAAO,EAA8B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAML,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;IACpC,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAA;IACpC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAA;I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