@facetlayer/prism-framework 0.4.0 → 0.4.1
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 +176 -8
- package/dist/Errors.d.ts +38 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Metrics.d.ts +5 -0
- package/dist/Metrics.d.ts.map +1 -0
- package/dist/RequestContext.d.ts +17 -0
- package/dist/RequestContext.d.ts.map +1 -0
- package/dist/ServiceDefinition.d.ts +16 -0
- package/dist/ServiceDefinition.d.ts.map +1 -0
- package/dist/app/PrismApp.d.ts +31 -0
- package/dist/app/PrismApp.d.ts.map +1 -0
- package/dist/app/callEndpoint.d.ts +13 -0
- package/dist/app/callEndpoint.d.ts.map +1 -0
- package/dist/app/validateApp.d.ts +20 -0
- package/dist/app/validateApp.d.ts.map +1 -0
- package/dist/authorization/AuthSource.d.ts +8 -0
- package/dist/authorization/AuthSource.d.ts.map +1 -0
- package/dist/authorization/Authorization.d.ts +24 -0
- package/dist/authorization/Authorization.d.ts.map +1 -0
- package/dist/authorization/Resource.d.ts +5 -0
- package/dist/authorization/Resource.d.ts.map +1 -0
- package/dist/authorization/index.d.ts +5 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/databases/DatabaseInitializationOptions.d.ts +9 -0
- package/dist/databases/DatabaseInitializationOptions.d.ts.map +1 -0
- package/dist/databases/DatabaseSetup.d.ts +3 -0
- package/dist/databases/DatabaseSetup.d.ts.map +1 -0
- package/dist/endpoints/createEndpoint.d.ts +4 -0
- package/dist/endpoints/createEndpoint.d.ts.map +1 -0
- package/dist/endpoints/getEffectiveOperationId.d.ts +19 -0
- package/dist/endpoints/getEffectiveOperationId.d.ts.map +1 -0
- package/dist/env/Env.d.ts +2 -0
- package/dist/env/Env.d.ts.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1364 -0
- package/dist/launch/launchConfig.d.ts +18 -0
- package/dist/launch/launchConfig.d.ts.map +1 -0
- package/dist/logging/index.d.ts +9 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/sse/ConnectionManager.d.ts +23 -0
- package/dist/sse/ConnectionManager.d.ts.map +1 -0
- package/dist/stdin/StdinServer.d.ts +38 -0
- package/dist/stdin/StdinServer.d.ts.map +1 -0
- package/dist/web/EndpointListing.d.ts +3 -0
- package/dist/web/EndpointListing.d.ts.map +1 -0
- package/dist/web/ExpressAppSetup.d.ts +18 -0
- package/dist/web/ExpressAppSetup.d.ts.map +1 -0
- package/dist/web/ExpressEndpointSetup.d.ts +31 -0
- package/dist/web/ExpressEndpointSetup.d.ts.map +1 -0
- package/dist/web/SseResponse.d.ts +15 -0
- package/dist/web/SseResponse.d.ts.map +1 -0
- package/dist/web/ViteIntegration.d.ts +19 -0
- package/dist/web/ViteIntegration.d.ts.map +1 -0
- package/dist/web/corsMiddleware.d.ts +14 -0
- package/dist/web/corsMiddleware.d.ts.map +1 -0
- package/dist/web/localhostOnlyMiddleware.d.ts +3 -0
- package/dist/web/localhostOnlyMiddleware.d.ts.map +1 -0
- package/dist/web/openapi/OpenAPI.d.ts +37 -0
- package/dist/web/openapi/OpenAPI.d.ts.map +1 -0
- package/dist/web/openapi/validateServicesForOpenapi.d.ts +32 -0
- package/dist/web/openapi/validateServicesForOpenapi.d.ts.map +1 -0
- package/dist/web/requestContextMiddleware.d.ts +3 -0
- package/dist/web/requestContextMiddleware.d.ts.map +1 -0
- package/docs/authorization.md +281 -0
- package/docs/cors-setup.md +172 -0
- package/docs/creating-services.md +220 -0
- package/docs/database-setup.md +134 -0
- package/docs/endpoint-tools.md +1 -11
- package/docs/env-files.md +12 -1
- package/docs/error-handling.md +70 -0
- package/docs/getting-started.md +22 -12
- package/docs/launch-configuration.md +223 -0
- package/docs/overview.md +62 -0
- package/docs/server-setup.md +144 -0
- package/docs/source-directory-organization.md +115 -0
- package/docs/stdin-protocol.md +176 -0
- package/package.json +42 -9
- package/src/Errors.ts +120 -0
- package/src/Metrics.ts +53 -0
- package/src/RequestContext.ts +36 -0
- package/src/ServiceDefinition.ts +35 -0
- package/src/__tests__/Authorization.test.ts +350 -0
- package/src/__tests__/Errors.test.ts +378 -0
- package/src/__tests__/ListEndpoints.test.ts +98 -0
- package/src/__tests__/PrismApp.test.ts +274 -0
- package/src/__tests__/RequestContext.test.ts +295 -0
- package/src/__tests__/SseResponse.test.ts +189 -0
- package/src/__tests__/StdinServer.test.ts +304 -0
- package/src/__tests__/corsMiddleware.test.ts +293 -0
- package/src/__tests__/createEndpoint.test.ts +412 -0
- package/src/__tests__/validateApp.test.ts +206 -0
- package/src/app/PrismApp.ts +117 -0
- package/src/app/callEndpoint.ts +55 -0
- package/src/app/validateApp.ts +78 -0
- package/src/authorization/AuthSource.ts +14 -0
- package/src/authorization/Authorization.ts +78 -0
- package/src/authorization/Resource.ts +8 -0
- package/src/authorization/index.ts +4 -0
- package/src/databases/DatabaseInitializationOptions.ts +9 -0
- package/src/databases/DatabaseSetup.ts +19 -0
- package/src/endpoints/createEndpoint.ts +39 -0
- package/src/endpoints/getEffectiveOperationId.ts +90 -0
- package/src/env/Env.ts +23 -0
- package/src/index.ts +78 -0
- package/src/launch/launchConfig.ts +59 -0
- package/src/list-endpoints-command.ts +1 -1
- package/src/logging/index.ts +25 -0
- package/src/sse/ConnectionManager.ts +79 -0
- package/src/stdin/StdinServer.ts +129 -0
- package/src/web/EndpointListing.ts +166 -0
- package/src/web/ExpressAppSetup.ts +125 -0
- package/src/web/ExpressEndpointSetup.ts +178 -0
- package/src/web/SseResponse.ts +78 -0
- package/src/web/ViteIntegration.ts +72 -0
- package/src/web/__tests__/OpenAPI.invalidZodSchemas.test.ts +250 -0
- package/src/web/corsMiddleware.ts +63 -0
- package/src/web/localhostOnlyMiddleware.ts +19 -0
- package/src/web/openapi/OpenAPI.ts +248 -0
- package/src/web/openapi/validateServicesForOpenapi.ts +76 -0
- package/src/web/requestContextMiddleware.ts +25 -0
- package/.claude/settings.local.json +0 -20
- package/CHANGELOG +0 -28
- package/CLAUDE.md +0 -44
- package/build.mts +0 -8
- package/test/call-command.test.ts +0 -96
- package/test/generate-api-clients.test.ts +0 -33
- package/test/generate-api-clients.test.ts.disabled +0 -75
- package/tsconfig.json +0 -21
package/README.md
CHANGED
|
@@ -1,11 +1,51 @@
|
|
|
1
1
|
# @facetlayer/prism-framework
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A TypeScript framework for building web-based SaaS applications and desktop Electron apps. Includes a server framework, CLI tools, and development utilities.
|
|
4
|
+
|
|
5
|
+
**Important:** This framework uses **Zod v4** for schema validation. Make sure to install `zod@^4` — Zod v3 is not compatible and will produce confusing type errors.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
|
|
10
|
+
pnpm add @facetlayer/prism-framework zod@^4
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { createEndpoint, App, startServer, ServiceDefinition } from '@facetlayer/prism-framework';
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
|
|
19
|
+
// Define a service with endpoints
|
|
20
|
+
const myService: ServiceDefinition = {
|
|
21
|
+
name: 'hello',
|
|
22
|
+
endpoints: [
|
|
23
|
+
createEndpoint({
|
|
24
|
+
method: 'GET',
|
|
25
|
+
path: '/hello',
|
|
26
|
+
description: 'Say hello',
|
|
27
|
+
requestSchema: z.object({ name: z.string() }),
|
|
28
|
+
responseSchema: z.object({ message: z.string() }),
|
|
29
|
+
handler: async (input) => {
|
|
30
|
+
return { message: `Hello, ${input.name}!` };
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Create app and start server
|
|
37
|
+
async function main() {
|
|
38
|
+
const app = new App({ services: [myService] });
|
|
39
|
+
|
|
40
|
+
await startServer({
|
|
41
|
+
app,
|
|
42
|
+
port: 3000,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
console.log('Server running at http://localhost:3000');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
main().catch(console.error);
|
|
9
49
|
```
|
|
10
50
|
|
|
11
51
|
## CLI Commands
|
|
@@ -25,9 +65,9 @@ npm install @facetlayer/prism-framework
|
|
|
25
65
|
prism list-endpoints
|
|
26
66
|
|
|
27
67
|
# Call endpoints
|
|
28
|
-
prism call /
|
|
29
|
-
prism call POST /
|
|
30
|
-
prism call POST /
|
|
68
|
+
prism call /users # GET request
|
|
69
|
+
prism call POST /users --name "John" # POST with body
|
|
70
|
+
prism call POST /data --config '{"timeout":30}' # JSON arguments
|
|
31
71
|
|
|
32
72
|
# Generate TypeScript types
|
|
33
73
|
prism generate-api-clients --out ./src/api-types.ts
|
|
@@ -39,9 +79,137 @@ prism get-doc getting-started
|
|
|
39
79
|
|
|
40
80
|
## Documentation
|
|
41
81
|
|
|
42
|
-
|
|
82
|
+
This package includes built-in documentation. Use the CLI to explore:
|
|
43
83
|
|
|
44
|
-
|
|
84
|
+
```bash
|
|
85
|
+
prism list-docs
|
|
86
|
+
prism get-doc <doc-name>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Available documentation includes:
|
|
45
90
|
- `getting-started` - Setup guide for Prism Framework projects
|
|
46
|
-
- `
|
|
91
|
+
- `overview` - Framework overview and concepts
|
|
92
|
+
- `creating-services` - How to create services and endpoints
|
|
93
|
+
- `server-setup` - Server configuration options
|
|
94
|
+
- `database-setup` - Database integration
|
|
95
|
+
- `authorization` - Authentication and authorization
|
|
96
|
+
- `launch-configuration` - App configuration options
|
|
97
|
+
- `endpoint-tools` - CLI tools for calling endpoints
|
|
47
98
|
- `env-files` - Environment configuration strategy
|
|
99
|
+
- `stdin-protocol` - Stdin/stdout protocol for subprocess communication
|
|
100
|
+
|
|
101
|
+
## Testing Endpoints
|
|
102
|
+
|
|
103
|
+
Use the `prism` CLI to test your endpoints:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
prism list-endpoints # See all available endpoints
|
|
107
|
+
prism call /hello # Call an endpoint (GET)
|
|
108
|
+
prism call POST /users --name "John" --email "john@example.com" # POST with data
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
This is preferred over using curl directly because the `prism` CLI automatically reads your `.env` file for the API port.
|
|
112
|
+
|
|
113
|
+
## Environment Variables
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Optional
|
|
117
|
+
PORT=3000
|
|
118
|
+
PRISM_API_PORT=3000 # Used by prism CLI tools
|
|
119
|
+
API_BASE_URL=https://api.example.com
|
|
120
|
+
WEB_BASE_URL=https://example.com
|
|
121
|
+
ENABLE_TEST_ENDPOINTS=true
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Key Concepts
|
|
125
|
+
|
|
126
|
+
### App
|
|
127
|
+
|
|
128
|
+
The `App` class wraps your services and provides endpoint routing:
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { App } from '@facetlayer/prism-framework';
|
|
132
|
+
|
|
133
|
+
const app = new App({ services: [service1, service2] });
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### ServiceDefinition
|
|
137
|
+
|
|
138
|
+
A service groups related endpoints together:
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
const userService: ServiceDefinition = {
|
|
142
|
+
name: 'users',
|
|
143
|
+
endpoints: [
|
|
144
|
+
// ... endpoint definitions
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### createEndpoint
|
|
150
|
+
|
|
151
|
+
Define type-safe endpoints with Zod schemas:
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
createEndpoint({
|
|
155
|
+
method: 'POST',
|
|
156
|
+
path: '/users',
|
|
157
|
+
description: 'Create a new user',
|
|
158
|
+
requestSchema: z.object({
|
|
159
|
+
name: z.string(),
|
|
160
|
+
email: z.string().email(),
|
|
161
|
+
}),
|
|
162
|
+
responseSchema: z.object({
|
|
163
|
+
id: z.number(),
|
|
164
|
+
name: z.string(),
|
|
165
|
+
email: z.string(),
|
|
166
|
+
}),
|
|
167
|
+
handler: async (input) => {
|
|
168
|
+
// input is typed based on requestSchema
|
|
169
|
+
return { id: 1, name: input.name, email: input.email };
|
|
170
|
+
},
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Stdin/Stdout Protocol Mode
|
|
175
|
+
|
|
176
|
+
Prism apps can run as subprocesses communicating over stdin/stdout instead of opening an HTTP port. This is useful for composing multiple Prism apps into a single web UI.
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
import { App, startServer, startStdinServer } from '@facetlayer/prism-framework';
|
|
180
|
+
|
|
181
|
+
const app = new App({ services: [myService] });
|
|
182
|
+
|
|
183
|
+
if (process.argv.includes('--stdin')) {
|
|
184
|
+
// Communicate via JSON-over-stdin instead of HTTP
|
|
185
|
+
startStdinServer({ app });
|
|
186
|
+
} else {
|
|
187
|
+
await startServer({ app, port: 3000 });
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
When running in stdin mode, send newline-delimited JSON requests to stdin and receive JSON responses on stdout:
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{"id":"req-1","method":"GET","path":"/items"}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
See `prism get-doc stdin-protocol` for full protocol details.
|
|
198
|
+
|
|
199
|
+
## Zod Version Requirements
|
|
200
|
+
|
|
201
|
+
This framework requires **Zod 4.x** (specifically `zod@^4.0.5` or later). If you see TypeScript errors like:
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
Type 'ZodObject<...>' is missing properties from type 'ZodType<...>': def, type, toJSONSchema, check...
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
This indicates a Zod version mismatch. Ensure your project uses Zod 4.x:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
pnpm add zod@^4.0.5
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT
|
package/dist/Errors.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare class HttpError extends Error {
|
|
2
|
+
statusCode: number;
|
|
3
|
+
details?: any;
|
|
4
|
+
constructor(statusCode: number, message: string, details?: any);
|
|
5
|
+
}
|
|
6
|
+
export declare class BadRequestError extends HttpError {
|
|
7
|
+
constructor(message?: string, details?: any);
|
|
8
|
+
}
|
|
9
|
+
export declare class SchemaValidationError extends HttpError {
|
|
10
|
+
constructor(message?: string, details?: any);
|
|
11
|
+
}
|
|
12
|
+
export declare class ResponseSchemaValidationError extends HttpError {
|
|
13
|
+
constructor(message?: string, details?: any);
|
|
14
|
+
}
|
|
15
|
+
export declare class UnauthorizedError extends HttpError {
|
|
16
|
+
constructor(message?: string, details?: any);
|
|
17
|
+
}
|
|
18
|
+
export declare class ForbiddenError extends HttpError {
|
|
19
|
+
constructor(message?: string, details?: any);
|
|
20
|
+
}
|
|
21
|
+
export declare class NotFoundError extends HttpError {
|
|
22
|
+
constructor(message?: string, details?: any);
|
|
23
|
+
}
|
|
24
|
+
export declare class ConflictError extends HttpError {
|
|
25
|
+
constructor(message?: string, details?: any);
|
|
26
|
+
}
|
|
27
|
+
export declare class ValidationError extends HttpError {
|
|
28
|
+
constructor(message?: string, details?: any);
|
|
29
|
+
}
|
|
30
|
+
export declare class NotImplementedError extends HttpError {
|
|
31
|
+
constructor(message?: string, details?: any);
|
|
32
|
+
}
|
|
33
|
+
export declare class ServiceUnavailableError extends HttpError {
|
|
34
|
+
constructor(message?: string, details?: any);
|
|
35
|
+
}
|
|
36
|
+
export declare function createErrorFromStatus(statusCode: number, message?: string, details?: any): HttpError;
|
|
37
|
+
export declare function isHttpError(error: any): error is HttpError;
|
|
38
|
+
//# sourceMappingURL=Errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../src/Errors.ts"],"names":[],"mappings":"AAMA,qBAAa,SAAU,SAAQ,KAAK;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,GAAG,CAAC;gBAET,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG;CAM/D;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,GAAE,MAAsB,EAAE,OAAO,CAAC,EAAE,GAAG;CAI3D;AAED,qBAAa,qBAAsB,SAAQ,SAAS;gBACtC,OAAO,GAAE,MAAkC,EAAE,OAAO,CAAC,EAAE,GAAG;CAIvE;AAED,qBAAa,6BAA8B,SAAQ,SAAS;gBAC9C,OAAO,GAAE,MAA2C,EAAE,OAAO,CAAC,EAAE,GAAG;CAIhF;AAED,qBAAa,iBAAkB,SAAQ,SAAS;gBAClC,OAAO,GAAE,MAAuB,EAAE,OAAO,CAAC,EAAE,GAAG;CAI5D;AAED,qBAAa,cAAe,SAAQ,SAAS;gBAC/B,OAAO,GAAE,MAAoB,EAAE,OAAO,CAAC,EAAE,GAAG;CAIzD;AAED,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,OAAO,GAAE,MAAoB,EAAE,OAAO,CAAC,EAAE,GAAG;CAIzD;AAED,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,OAAO,GAAE,MAAmB,EAAE,OAAO,CAAC,EAAE,GAAG;CAIxD;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,OAAO,GAAE,MAA2B,EAAE,OAAO,CAAC,EAAE,GAAG;CAIhE;AAED,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,OAAO,GAAE,MAA0B,EAAE,OAAO,CAAC,EAAE,GAAG;CAI/D;AAED,qBAAa,uBAAwB,SAAQ,SAAS;gBACxC,OAAO,GAAE,MAA8B,EAAE,OAAO,CAAC,EAAE,GAAG;CAInE;AAED,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,GAAG,GACZ,SAAS,CAuBX;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAE1D"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function setupMetrics(): void;
|
|
2
|
+
export declare function recordHttpRequest(method: string, endpoint: string): void;
|
|
3
|
+
export declare function recordHttpResponse(method: string, endpoint: string, statusCode: number, duration: number): void;
|
|
4
|
+
export declare function getMetrics(): Promise<string>;
|
|
5
|
+
//# sourceMappingURL=Metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metrics.d.ts","sourceRoot":"","sources":["../src/Metrics.ts"],"names":[],"mappings":"AAMA,wBAAgB,YAAY,IAAI,IAAI,CAkBnC;AAGD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAKxE;AAED,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACf,IAAI,CAKN;AAGD,wBAAgB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAK5C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
2
|
+
import type { Request, Response } from 'express';
|
|
3
|
+
import type { Authorization } from './authorization/Authorization.ts';
|
|
4
|
+
export interface RequestContext {
|
|
5
|
+
requestId: string;
|
|
6
|
+
startTime: number;
|
|
7
|
+
req?: Request;
|
|
8
|
+
res?: Response;
|
|
9
|
+
auth: Authorization;
|
|
10
|
+
}
|
|
11
|
+
export declare const requestContextStorage: AsyncLocalStorage<RequestContext>;
|
|
12
|
+
export declare function withRequestContext<T>(context: RequestContext, fn: () => T): T;
|
|
13
|
+
export declare function getCurrentRequestContext(): RequestContext | undefined;
|
|
14
|
+
export declare const RequestContext: {
|
|
15
|
+
getCurrentRequestContext: typeof getCurrentRequestContext;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=RequestContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestContext.d.ts","sourceRoot":"","sources":["../src/RequestContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAYtE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,eAAO,MAAM,qBAAqB,mCAA0C,CAAC;AAG7E,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE7E;AAED,wBAAgB,wBAAwB,IAAI,cAAc,GAAG,SAAS,CAErE;AAED,eAAO,MAAM,cAAc;;CAE1B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NextFunction, Request, Response } from 'express';
|
|
2
|
+
import type { EndpointDefinition } from './web/ExpressEndpointSetup.ts';
|
|
3
|
+
export interface MiddlewareDefinition {
|
|
4
|
+
path: string;
|
|
5
|
+
handler: (req: Request, res: Response, next: NextFunction) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ServiceDefinition {
|
|
8
|
+
name: string;
|
|
9
|
+
endpoints?: EndpointDefinition[];
|
|
10
|
+
middleware?: MiddlewareDefinition[];
|
|
11
|
+
databases?: Record<string, {
|
|
12
|
+
statements: string[];
|
|
13
|
+
}>;
|
|
14
|
+
startJobs?: () => Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ServiceDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceDefinition.d.ts","sourceRoot":"","sources":["../src/ServiceDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CACpE;AAYD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IAGb,SAAS,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAGjC,UAAU,CAAC,EAAE,oBAAoB,EAAE,CAAC;IAGpC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QACzB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC,CAAC;IAGH,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { EndpointDefinition } from '../web/ExpressEndpointSetup.ts';
|
|
2
|
+
import type { ServiceDefinition } from '../ServiceDefinition.ts';
|
|
3
|
+
import { type CallEndpointOptions } from './callEndpoint.ts';
|
|
4
|
+
export interface PrismAppConfig {
|
|
5
|
+
name?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
services?: ServiceDefinition[];
|
|
8
|
+
}
|
|
9
|
+
export declare function endpointKey(method: string, path: string): string;
|
|
10
|
+
export declare class PrismApp {
|
|
11
|
+
endpointMap: Map<string, EndpointDefinition>;
|
|
12
|
+
services: ServiceDefinition[];
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
constructor(config?: PrismAppConfig);
|
|
16
|
+
/**
|
|
17
|
+
* Add a service to the app. Endpoints from the service will be registered
|
|
18
|
+
* and available for routing.
|
|
19
|
+
*/
|
|
20
|
+
addService(service: ServiceDefinition): void;
|
|
21
|
+
getAllServices(): ServiceDefinition[];
|
|
22
|
+
getEndpoint(method: string, path: string): EndpointDefinition | undefined;
|
|
23
|
+
matchEndpoint(method: string, path: string): {
|
|
24
|
+
endpoint: EndpointDefinition;
|
|
25
|
+
params: Record<string, string>;
|
|
26
|
+
} | undefined;
|
|
27
|
+
private matchPath;
|
|
28
|
+
listAllEndpoints(): EndpointDefinition[];
|
|
29
|
+
callEndpoint(options: CallEndpointOptions): Promise<any>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=PrismApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismApp.d.ts","sourceRoot":"","sources":["../../src/app/PrismApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAChC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,qBAAa,QAAQ;IACnB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC7C,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;gBAER,MAAM,GAAE,cAAmB;IAcvC;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAW5C,cAAc,IAAI,iBAAiB,EAAE;IAIrC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAKzE,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,kBAAkB,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,SAAS;IAyBzH,OAAO,CAAC,SAAS;IA0BjB,gBAAgB,IAAI,kBAAkB,EAAE;IAIxC,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;CAGzD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PrismApp } from './PrismApp.ts';
|
|
2
|
+
export interface CallEndpointOptions {
|
|
3
|
+
method: string;
|
|
4
|
+
path: string;
|
|
5
|
+
input?: any;
|
|
6
|
+
onResponseSchemaFail?: (error: any, result: any) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Call an endpoint programmatically without going through HTTP
|
|
10
|
+
* This is useful for testing or for calling endpoints from scripts/tools
|
|
11
|
+
*/
|
|
12
|
+
export declare function callEndpoint(app: PrismApp, options: CallEndpointOptions): Promise<any>;
|
|
13
|
+
//# sourceMappingURL=callEndpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callEndpoint.d.ts","sourceRoot":"","sources":["../../src/app/callEndpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;CAC1D;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,mBAAmB,gBAuC7E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PrismApp } from './PrismApp.ts';
|
|
2
|
+
export interface ValidationError {
|
|
3
|
+
message: string;
|
|
4
|
+
endpoints?: string[];
|
|
5
|
+
}
|
|
6
|
+
export interface ValidationResult {
|
|
7
|
+
valid: boolean;
|
|
8
|
+
errors: ValidationError[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Validates a PrismApp configuration, checking for issues like duplicate operationIds.
|
|
12
|
+
* This should be run at server startup to catch configuration errors early.
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateApp(app: PrismApp): ValidationResult;
|
|
15
|
+
/**
|
|
16
|
+
* Validates the app and throws an error if validation fails.
|
|
17
|
+
* Use this at server startup to ensure the app is properly configured.
|
|
18
|
+
*/
|
|
19
|
+
export declare function validateAppOrThrow(app: PrismApp): void;
|
|
20
|
+
//# sourceMappingURL=validateApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateApp.d.ts","sourceRoot":"","sources":["../../src/app/validateApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,gBAAgB,CAa3D;AAqCD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAMtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthSource.d.ts","sourceRoot":"","sources":["../../src/authorization/AuthSource.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { CookieAuthSource, AuthSource } from './AuthSource.ts';
|
|
2
|
+
import type { Resource } from './Resource.ts';
|
|
3
|
+
export type Permission = string;
|
|
4
|
+
export interface UserPermissions {
|
|
5
|
+
userId: string;
|
|
6
|
+
permissions: Permission[];
|
|
7
|
+
}
|
|
8
|
+
export declare class Authorization {
|
|
9
|
+
private resources;
|
|
10
|
+
private authSources;
|
|
11
|
+
private userPermissions?;
|
|
12
|
+
constructor(resources?: Resource[], authSources?: AuthSource[]);
|
|
13
|
+
addResource(resource: Resource): void;
|
|
14
|
+
hasResource(type: Resource['type']): boolean;
|
|
15
|
+
getResource(type: Resource['type']): Resource | undefined;
|
|
16
|
+
getAllResources(): Resource[];
|
|
17
|
+
addAuthSource(authSource: AuthSource): void;
|
|
18
|
+
getAuthSources(): AuthSource[];
|
|
19
|
+
getCookieAuthSource(): CookieAuthSource | undefined;
|
|
20
|
+
setUserPermissions(userPermissions: UserPermissions): void;
|
|
21
|
+
getUserPermissions(): UserPermissions | undefined;
|
|
22
|
+
hasPermission(permission: Permission): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Authorization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Authorization.d.ts","sourceRoot":"","sources":["../../src/authorization/Authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAaD,qBAAa,aAAa;IACxB,OAAO,CAAC,SAAS,CAAkC;IACnD,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,eAAe,CAAC,CAAkB;gBAE9B,SAAS,GAAE,QAAQ,EAAO,EAAE,WAAW,GAAE,UAAU,EAAO;IAQtE,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAIrC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,OAAO;IAI5C,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,GAAG,SAAS;IAIzD,eAAe,IAAI,QAAQ,EAAE;IAI7B,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAI3C,cAAc,IAAI,UAAU,EAAE;IAI9B,mBAAmB,IAAI,gBAAgB,GAAG,SAAS;IAInD,kBAAkB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;IAI1D,kBAAkB,IAAI,eAAe,GAAG,SAAS;IAIjD,aAAa,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO;CAM/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resource.d.ts","sourceRoot":"","sources":["../../src/authorization/Resource.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAChD,EAAE,EAAE,MAAM,CAAC;CACZ"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Authorization } from './Authorization.ts';
|
|
2
|
+
export type { Permission, UserPermissions } from './Authorization.ts';
|
|
3
|
+
export type { CookieAuthSource, AuthSource } from './AuthSource.ts';
|
|
4
|
+
export type { Resource } from './Resource.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/authorization/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ServiceDefinition } from '../ServiceDefinition.ts';
|
|
2
|
+
import type { LoadDatabaseFn, MigrationBehavior } from '@facetlayer/sqlite-wrapper';
|
|
3
|
+
export interface DatabaseInitializationOptions {
|
|
4
|
+
migrationBehavior: MigrationBehavior;
|
|
5
|
+
databasePath: string;
|
|
6
|
+
services?: ServiceDefinition[];
|
|
7
|
+
loadDatabase: LoadDatabaseFn;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=DatabaseInitializationOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabaseInitializationOptions.d.ts","sourceRoot":"","sources":["../../src/databases/DatabaseInitializationOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpF,MAAM,WAAW,6BAA6B;IAC5C,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC/B,YAAY,EAAE,cAAc,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabaseSetup.d.ts","sourceRoot":"","sources":["../../src/databases/DatabaseSetup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQjE,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,iBAAiB,EAAE,GAC5B,MAAM,EAAE,CAOV"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EndpointDefinition } from "../web/ExpressEndpointSetup.ts";
|
|
2
|
+
export { getEffectiveOperationId, isValidOperationId, generateOperationIdFromPath } from "./getEffectiveOperationId.ts";
|
|
3
|
+
export declare function createEndpoint(definition: EndpointDefinition): EndpointDefinition;
|
|
4
|
+
//# sourceMappingURL=createEndpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEndpoint.d.ts","sourceRoot":"","sources":["../../src/endpoints/createEndpoint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAExH,wBAAgB,cAAc,CAC1B,UAAU,EAAE,kBAAkB,GAC/B,kBAAkB,CA6BpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { EndpointDefinition } from "../web/ExpressEndpointSetup.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Validates that an operationId is not a known bad value.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isValidOperationId(operationId: string | undefined): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Generates an operationId from the method and path.
|
|
8
|
+
* e.g., "GET /users/:id" -> "getUsers_id"
|
|
9
|
+
* e.g., "GET /users/:id/undo-redo-state" -> "getUsers_idUndoRedoState"
|
|
10
|
+
*/
|
|
11
|
+
export declare function generateOperationIdFromPath(method: string, path: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the effective operationId for an endpoint using the priority:
|
|
14
|
+
* 1. Explicit operationId if defined
|
|
15
|
+
* 2. Handler function name if not a known bad value
|
|
16
|
+
* 3. Auto-generated from method + path
|
|
17
|
+
*/
|
|
18
|
+
export declare function getEffectiveOperationId(definition: EndpointDefinition): string;
|
|
19
|
+
//# sourceMappingURL=getEffectiveOperationId.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getEffectiveOperationId.d.ts","sourceRoot":"","sources":["../../src/endpoints/getEffectiveOperationId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAYzE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAK3E;AAuBD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBhF;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,kBAAkB,GAAG,MAAM,CAc9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Env.d.ts","sourceRoot":"","sources":["../../src/env/Env.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { BadRequestError, ConflictError, ForbiddenError, HttpError, NotFoundError, NotImplementedError, ServiceUnavailableError, UnauthorizedError, ValidationError, createErrorFromStatus, isHttpError, } from './Errors.ts';
|
|
2
|
+
export { createExpressApp, startServer } from './web/ExpressAppSetup.ts';
|
|
3
|
+
export type { ServerSetupConfig, WebConfig } from './web/ExpressAppSetup.ts';
|
|
4
|
+
export { getMetrics, recordHttpRequest, recordHttpResponse } from './Metrics.ts';
|
|
5
|
+
export type { RequestContext } from './RequestContext.ts';
|
|
6
|
+
export { getCurrentRequestContext, withRequestContext } from './RequestContext.ts';
|
|
7
|
+
export { requestContextMiddleware } from './web/requestContextMiddleware.ts';
|
|
8
|
+
export type { MiddlewareDefinition, ServiceDefinition } from './ServiceDefinition.ts';
|
|
9
|
+
export type { CookieAuthSource, AuthSource, Permission, Resource, UserPermissions } from './authorization/index.ts';
|
|
10
|
+
export { Authorization } from './authorization/index.ts';
|
|
11
|
+
export { corsMiddleware } from './web/corsMiddleware.ts';
|
|
12
|
+
export type { CorsConfig } from './web/corsMiddleware.ts';
|
|
13
|
+
export type { EndpointDefinition } from './web/ExpressEndpointSetup.ts';
|
|
14
|
+
export { getRequestDataFromReq, mountMiddleware, mountMiddlewares, mountPrismApp, } from './web/ExpressEndpointSetup.ts';
|
|
15
|
+
export { localhostOnlyMiddleware } from './web/localhostOnlyMiddleware.ts';
|
|
16
|
+
export { SseResponse } from './web/SseResponse.ts';
|
|
17
|
+
export { createEndpoint } from './endpoints/createEndpoint.ts';
|
|
18
|
+
export type { OpenAPIDocumentInfo, ParseExpressPathForOpenAPIResult } from './web/openapi/OpenAPI.ts';
|
|
19
|
+
export { generateOpenAPISchema, parseExpressPathForOpenAPI } from './web/openapi/OpenAPI.ts';
|
|
20
|
+
export { createListingEndpoints } from './web/EndpointListing.ts';
|
|
21
|
+
export { ConnectionManager } from './sse/ConnectionManager.ts';
|
|
22
|
+
export { PrismApp as App } from './app/PrismApp.ts';
|
|
23
|
+
export type { PrismAppConfig as AppConfig } from './app/PrismApp.ts';
|
|
24
|
+
export type { LoggingSettings, LaunchConfig } from './launch/launchConfig.ts';
|
|
25
|
+
export { getDatabaseConfig, getLaunchConfig, getLoggingConfig, setLaunchConfig } from './launch/launchConfig.ts';
|
|
26
|
+
export type { DatabaseInitializationOptions } from './databases/DatabaseInitializationOptions.ts';
|
|
27
|
+
export type { MigrationBehavior } from '@facetlayer/sqlite-wrapper';
|
|
28
|
+
export { getStatementsForDatabase } from './databases/DatabaseSetup.ts';
|
|
29
|
+
export type { CallEndpointOptions } from './app/callEndpoint.ts';
|
|
30
|
+
export { callEndpoint } from './app/callEndpoint.ts';
|
|
31
|
+
export type { StdinRequest, StdinResponse, StdinServerConfig } from './stdin/StdinServer.ts';
|
|
32
|
+
export { startStdinServer } from './stdin/StdinServer.ts';
|
|
33
|
+
export { setLogStderr } from './logging/index.ts';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACzE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE7E,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEjF,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGtF,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACpH,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,aAAa,GACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAG/D,YAAY,EAAE,mBAAmB,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AACtG,OAAO,EAAE,qBAAqB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAG7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,cAAc,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGrE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGjH,YAAY,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAClG,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,YAAY,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|