@owlmeans/api-config-server 0.1.2 → 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/README.md +17 -349
- package/build/actions/config.d.ts +2 -2
- package/build/actions/config.d.ts.map +1 -1
- package/build/actions/config.js.map +1 -1
- package/build/modules.d.ts +2 -2
- package/build/modules.d.ts.map +1 -1
- package/build/modules.js +1 -1
- package/build/modules.js.map +1 -1
- package/package.json +7 -6
- package/src/actions/config.ts +2 -2
- package/src/modules.ts +4 -4
- package/tsconfig.json +5 -4
package/README.md
CHANGED
|
@@ -1,367 +1,35 @@
|
|
|
1
1
|
# @owlmeans/api-config-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Server-side module that serves safe configuration values at `GET /assets/config.json`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- Registers the `API_CONFIG` handler that returns non-sensitive config fields to clients
|
|
8
|
+
- Used alongside `@owlmeans/api-config-client` to push runtime config from server to browser
|
|
9
|
+
- Include `modules` in your server module registration
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
- **Filters sensitive information** before sending configuration to clients
|
|
11
|
-
- **Supports multi-service architecture** by exposing service endpoint information
|
|
12
|
-
- **Integrates with server modules** for seamless API endpoint creation
|
|
13
|
-
- **Provides secure configuration sharing** with proper filtering of secrets and internal data
|
|
11
|
+
## Installation
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Configuration Advertisement
|
|
18
|
-
The server advertises its configuration to clients through a REST API endpoint, allowing clients to discover available services, their endpoints, and relevant configuration data.
|
|
19
|
-
|
|
20
|
-
### Information Filtering
|
|
21
|
-
The package carefully filters configuration data to ensure sensitive information (like secrets, API keys, and internal configurations) is not exposed to clients.
|
|
22
|
-
|
|
23
|
-
### Service Discovery
|
|
24
|
-
Clients can discover all available services, their hosts, ports, and base paths through the configuration API, enabling dynamic service discovery.
|
|
25
|
-
|
|
26
|
-
### Plugin and Record Sharing
|
|
27
|
-
The server can share frontend-compatible plugins and allowed configuration records with clients.
|
|
28
|
-
|
|
29
|
-
## API Reference
|
|
30
|
-
|
|
31
|
-
### Modules
|
|
32
|
-
|
|
33
|
-
#### `modules`
|
|
34
|
-
|
|
35
|
-
Exported server modules array containing the elevated API config module with server-side handler.
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
import { modules } from '@owlmeans/api-config-server'
|
|
39
|
-
|
|
40
|
-
// Register all server API config modules
|
|
41
|
-
context.registerModules(modules)
|
|
13
|
+
```bash
|
|
14
|
+
bun add @owlmeans/api-config-server
|
|
42
15
|
```
|
|
43
16
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
#### `advertise`
|
|
47
|
-
|
|
48
|
-
The main action handler that processes API configuration requests and returns filtered configuration.
|
|
17
|
+
## Usage
|
|
49
18
|
|
|
50
19
|
```typescript
|
|
51
|
-
import {
|
|
20
|
+
import { modules as apiConfigModules } from '@owlmeans/api-config-server'
|
|
52
21
|
|
|
53
|
-
//
|
|
54
|
-
|
|
22
|
+
// In your server context setup
|
|
23
|
+
context.registerModules([...appModules, ...apiConfigModules])
|
|
55
24
|
```
|
|
56
25
|
|
|
57
|
-
|
|
58
|
-
- `debug`: Debug configuration (filtered)
|
|
59
|
-
- `brand`: Branding information
|
|
60
|
-
- `services`: Service endpoint information (host, port, base, service name, type)
|
|
61
|
-
- `plugins`: Frontend-compatible plugins
|
|
62
|
-
- `[CONFIG_RECORD]`: Allowed configuration records
|
|
63
|
-
- `oidc`: OIDC configuration (filtered, no secrets)
|
|
64
|
-
- Additional safe configuration fields
|
|
65
|
-
|
|
66
|
-
**Filtering Behavior:**
|
|
67
|
-
- Removes sensitive keys defined in `notAdvertizedConfigKeys`
|
|
68
|
-
- Filters service configurations to include only public information
|
|
69
|
-
- Removes secrets from OIDC configuration
|
|
70
|
-
- Only includes frontend-compatible plugins
|
|
71
|
-
- Only includes allowed configuration record types
|
|
72
|
-
|
|
73
|
-
## Configuration Filtering
|
|
74
|
-
|
|
75
|
-
The package implements strict filtering to protect sensitive information:
|
|
76
|
-
|
|
77
|
-
### Service Information
|
|
78
|
-
From each service configuration, only these fields are shared:
|
|
79
|
-
- `service`: Service name
|
|
80
|
-
- `type`: Service type (Frontend/Backend)
|
|
81
|
-
- `host`: Service host
|
|
82
|
-
- `port`: Service port
|
|
83
|
-
- `base`: Base path
|
|
84
|
-
|
|
85
|
-
### OIDC Configuration
|
|
86
|
-
For OIDC configuration, sensitive fields are filtered out:
|
|
87
|
-
- **Removed**: `secret`, `apiClientId`
|
|
88
|
-
- **Kept**: `clientCookie`, public provider information
|
|
89
|
-
- **Internal providers**: Completely filtered out (where `internal: true`)
|
|
90
|
-
|
|
91
|
-
### Plugin Filtering
|
|
92
|
-
Only plugins marked as `AppType.Frontend` are included in the advertised configuration.
|
|
26
|
+
## API
|
|
93
27
|
|
|
94
|
-
###
|
|
95
|
-
Only configuration records with types listed in `allowedConfigRecords` are shared with clients.
|
|
28
|
+
### `modules`
|
|
96
29
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### Basic Server Setup
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
import { makeServerContext, makeServerConfig } from '@owlmeans/server-context'
|
|
103
|
-
import { modules } from '@owlmeans/api-config-server'
|
|
104
|
-
import { AppType } from '@owlmeans/context'
|
|
105
|
-
|
|
106
|
-
// Create server configuration
|
|
107
|
-
const config = makeServerConfig(AppType.Backend, 'config-server', {
|
|
108
|
-
host: 'localhost',
|
|
109
|
-
port: 3000,
|
|
110
|
-
services: {
|
|
111
|
-
'user-service': {
|
|
112
|
-
service: 'user-service',
|
|
113
|
-
type: AppType.Backend,
|
|
114
|
-
host: 'users.api.com',
|
|
115
|
-
port: 8080,
|
|
116
|
-
base: '/api/v1'
|
|
117
|
-
},
|
|
118
|
-
'auth-service': {
|
|
119
|
-
service: 'auth-service',
|
|
120
|
-
type: AppType.Backend,
|
|
121
|
-
host: 'auth.api.com',
|
|
122
|
-
port: 8081,
|
|
123
|
-
secret: 'very-secret-key' // This will be filtered out
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
debug: { all: true }
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
// Create and configure context
|
|
130
|
-
const context = makeServerContext(config)
|
|
131
|
-
|
|
132
|
-
// Register API config modules
|
|
133
|
-
context.registerModules(modules)
|
|
134
|
-
|
|
135
|
-
// Configure and initialize
|
|
136
|
-
context.configure()
|
|
137
|
-
await context.init()
|
|
138
|
-
|
|
139
|
-
// API config endpoint is now available at the configured route
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### Integration with Express
|
|
143
|
-
|
|
144
|
-
```typescript
|
|
145
|
-
import express from 'express'
|
|
146
|
-
import { modules } from '@owlmeans/api-config-server'
|
|
147
|
-
import { API_CONFIG } from '@owlmeans/api-config'
|
|
148
|
-
|
|
149
|
-
const app = express()
|
|
150
|
-
|
|
151
|
-
// After context initialization
|
|
152
|
-
const configModule = context.module(API_CONFIG)
|
|
153
|
-
|
|
154
|
-
// The module has a handler that returns filtered configuration
|
|
155
|
-
app.get('/api/config', async (req, res) => {
|
|
156
|
-
try {
|
|
157
|
-
// The advertise handler is automatically attached
|
|
158
|
-
const request = adaptExpressRequest(req)
|
|
159
|
-
const response = provideResponse()
|
|
160
|
-
|
|
161
|
-
await configModule.handle(request, response)
|
|
162
|
-
|
|
163
|
-
if (response.error) {
|
|
164
|
-
res.status(500).json({ error: response.error.message })
|
|
165
|
-
} else {
|
|
166
|
-
res.json(response.value)
|
|
167
|
-
}
|
|
168
|
-
} catch (error) {
|
|
169
|
-
res.status(500).json({ error: 'Configuration unavailable' })
|
|
170
|
-
}
|
|
171
|
-
})
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Custom Configuration Filtering
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
import { makeServerConfig } from '@owlmeans/server-context'
|
|
178
|
-
import { modules } from '@owlmeans/api-config-server'
|
|
179
|
-
|
|
180
|
-
const config = makeServerConfig(AppType.Backend, 'api-server', {
|
|
181
|
-
// Public configuration (will be shared)
|
|
182
|
-
brand: {
|
|
183
|
-
name: 'My Application',
|
|
184
|
-
version: '1.0.0'
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
// Service configuration (filtered)
|
|
188
|
-
services: {
|
|
189
|
-
'payment-service': {
|
|
190
|
-
service: 'payment-service',
|
|
191
|
-
type: AppType.Backend,
|
|
192
|
-
host: 'payments.api.com',
|
|
193
|
-
port: 443,
|
|
194
|
-
apiKey: 'secret-api-key', // Will be filtered out
|
|
195
|
-
publicEndpoint: '/api/v1' // Will be included as 'base'
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
// OIDC configuration (partially filtered)
|
|
200
|
-
oidc: {
|
|
201
|
-
clientCookie: 'session-cookie', // Will be shared
|
|
202
|
-
providers: [
|
|
203
|
-
{
|
|
204
|
-
name: 'google',
|
|
205
|
-
clientId: 'public-client-id', // Will be shared
|
|
206
|
-
secret: 'client-secret', // Will be filtered out
|
|
207
|
-
issuer: 'https://accounts.google.com'
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
name: 'internal-auth',
|
|
211
|
-
internal: true, // Entire provider will be filtered out
|
|
212
|
-
clientId: 'internal-client',
|
|
213
|
-
secret: 'internal-secret'
|
|
214
|
-
}
|
|
215
|
-
]
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
// Plugins (only frontend plugins shared)
|
|
219
|
-
plugins: [
|
|
220
|
-
{
|
|
221
|
-
name: 'frontend-plugin',
|
|
222
|
-
type: AppType.Frontend,
|
|
223
|
-
config: { theme: 'dark' }
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
name: 'backend-plugin',
|
|
227
|
-
type: AppType.Backend,
|
|
228
|
-
config: { database: 'secret-connection' } // Will be filtered out
|
|
229
|
-
}
|
|
230
|
-
]
|
|
231
|
-
})
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Multi-Service Architecture
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
const config = makeServerConfig(AppType.Backend, 'gateway-server', {
|
|
238
|
-
services: {
|
|
239
|
-
'user-service': {
|
|
240
|
-
service: 'user-service',
|
|
241
|
-
type: AppType.Backend,
|
|
242
|
-
host: 'users.internal.com',
|
|
243
|
-
port: 8080,
|
|
244
|
-
base: '/users'
|
|
245
|
-
},
|
|
246
|
-
'order-service': {
|
|
247
|
-
service: 'order-service',
|
|
248
|
-
type: AppType.Backend,
|
|
249
|
-
host: 'orders.internal.com',
|
|
250
|
-
port: 8081,
|
|
251
|
-
base: '/orders'
|
|
252
|
-
},
|
|
253
|
-
'notification-service': {
|
|
254
|
-
service: 'notification-service',
|
|
255
|
-
type: AppType.Backend,
|
|
256
|
-
host: 'notifications.internal.com',
|
|
257
|
-
port: 8082,
|
|
258
|
-
base: '/notifications'
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
const context = makeServerContext(config)
|
|
264
|
-
context.registerModules(modules)
|
|
265
|
-
await context.configure().init()
|
|
266
|
-
|
|
267
|
-
// Clients can now discover all services through the config API
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
## Security Considerations
|
|
271
|
-
|
|
272
|
-
### Information Filtering
|
|
273
|
-
The package implements multiple layers of security:
|
|
274
|
-
|
|
275
|
-
1. **Automatic Secret Filtering** - Known secret fields are automatically removed
|
|
276
|
-
2. **Service Information Limiting** - Only essential service discovery information is shared
|
|
277
|
-
3. **OIDC Security** - Client secrets and internal configurations are filtered
|
|
278
|
-
4. **Plugin Type Filtering** - Only frontend-compatible plugins are shared
|
|
279
|
-
5. **Configuration Record Filtering** - Only explicitly allowed record types are shared
|
|
280
|
-
|
|
281
|
-
### Best Practices
|
|
282
|
-
|
|
283
|
-
1. **Minimize exposed information** - Only include necessary configuration in server config
|
|
284
|
-
2. **Use environment variables** - Store secrets in environment variables, not configuration
|
|
285
|
-
3. **Implement authentication** - Protect the config endpoint with appropriate authentication
|
|
286
|
-
4. **Monitor access** - Log and monitor who accesses configuration endpoints
|
|
287
|
-
5. **Regular security audits** - Review what information is being exposed
|
|
288
|
-
|
|
289
|
-
### Example Security Setup
|
|
290
|
-
|
|
291
|
-
```typescript
|
|
292
|
-
import { modules } from '@owlmeans/api-config-server'
|
|
293
|
-
import { authenticatedGuard } from '@owlmeans/server-auth'
|
|
294
|
-
|
|
295
|
-
// Protect configuration endpoint with authentication
|
|
296
|
-
const configModule = context.module(API_CONFIG)
|
|
297
|
-
configModule.guards = ['authenticated']
|
|
298
|
-
|
|
299
|
-
// Or use custom middleware for additional security
|
|
300
|
-
app.get('/api/config', authenticateRequest, async (req, res) => {
|
|
301
|
-
// Only authenticated clients can access configuration
|
|
302
|
-
})
|
|
303
|
-
```
|
|
304
|
-
|
|
305
|
-
## Integration Patterns
|
|
306
|
-
|
|
307
|
-
### Microservices Gateway
|
|
308
|
-
|
|
309
|
-
```typescript
|
|
310
|
-
// Gateway server that advertises all microservice endpoints
|
|
311
|
-
const gatewayConfig = makeServerConfig(AppType.Backend, 'api-gateway', {
|
|
312
|
-
services: {
|
|
313
|
-
...userServiceConfig,
|
|
314
|
-
...orderServiceConfig,
|
|
315
|
-
...paymentServiceConfig,
|
|
316
|
-
...notificationServiceConfig
|
|
317
|
-
}
|
|
318
|
-
})
|
|
319
|
-
|
|
320
|
-
// Clients connect to gateway and get all service information
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Development vs Production
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
const isDevelopment = process.env.NODE_ENV === 'development'
|
|
327
|
-
|
|
328
|
-
const config = makeServerConfig(AppType.Backend, 'api-server', {
|
|
329
|
-
debug: isDevelopment ? { all: true } : {},
|
|
330
|
-
services: {
|
|
331
|
-
'user-service': {
|
|
332
|
-
service: 'user-service',
|
|
333
|
-
type: AppType.Backend,
|
|
334
|
-
host: isDevelopment ? 'localhost' : 'users.prod.com',
|
|
335
|
-
port: isDevelopment ? 3001 : 443,
|
|
336
|
-
base: '/api/v1'
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
})
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
## Error Handling
|
|
343
|
-
|
|
344
|
-
The package handles configuration errors gracefully:
|
|
345
|
-
|
|
346
|
-
- **Missing configuration** - Returns empty or default values
|
|
347
|
-
- **Invalid service configs** - Filters out malformed service entries
|
|
348
|
-
- **Plugin errors** - Continues processing even if plugin filtering fails
|
|
349
|
-
- **OIDC parsing errors** - Falls back to basic configuration
|
|
30
|
+
Array of server-side route handlers for the config advertisement endpoint (`GET /assets/config.json`).
|
|
350
31
|
|
|
351
32
|
## Related Packages
|
|
352
33
|
|
|
353
|
-
- [`@owlmeans/api-config`](../api-config)
|
|
354
|
-
- [`@owlmeans/api-config-client`](../api-config-client)
|
|
355
|
-
- [`@owlmeans/server-context`](../server-context) - Server-side context management
|
|
356
|
-
- [`@owlmeans/server-module`](../server-module) - Server-side module system
|
|
357
|
-
- [`@owlmeans/config`](../config) - Configuration management utilities
|
|
358
|
-
|
|
359
|
-
## Dependencies
|
|
360
|
-
|
|
361
|
-
This package depends on:
|
|
362
|
-
- `@owlmeans/api-config` - Common API config definitions and constants
|
|
363
|
-
- `@owlmeans/server-module` - Server-side module elevation and handling
|
|
364
|
-
- `@owlmeans/server-context` - Server context types and configuration
|
|
365
|
-
- `@owlmeans/server-api` - Request handling utilities
|
|
366
|
-
- `@owlmeans/config` - Configuration management and plugin types
|
|
367
|
-
- `@owlmeans/context` - Core context functionality and types
|
|
34
|
+
- [`@owlmeans/api-config`](../api-config) — shared types and module alias
|
|
35
|
+
- [`@owlmeans/api-config-client`](../api-config-client) — client that fetches this endpoint
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint';
|
|
2
2
|
import type { ApiConfig } from '@owlmeans/api-config';
|
|
3
|
-
export declare const advertise:
|
|
3
|
+
export declare const advertise: RefedEntrypointHandler<ApiConfig>;
|
|
4
4
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/actions/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/actions/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AASrD,eAAO,MAAM,SAAS,EAAE,sBAAsB,CAAC,SAAS,CAuCtD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/actions/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAG1D,MAAM,CAAC,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/actions/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAG1D,MAAM,CAAC,MAAM,SAAS,GAAsC,aAAa,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE;IACzF,MAAM,SAAS,GAAc;QAC3B,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;QAC1B,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC,WAAW,CAC1B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;YAChF,OAAO,EAAE;gBACP,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB;SACF,CAAC,CACH;QACD,OAAO,EAAE,CAAE,GAAG,CAAC,GAAiD,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;aAC7E,MAAM,CAAC,CAAC,MAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC,QAAQ,CAAC;QACrE,CAAC,aAAa,CAAC,EAAE,CAAE,GAAG,CAAC,GAAiD,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CACnG,CAAC,MAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CACxG;QACD,GAAG,CACD,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YACzC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,uBAAuB;SACzD,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CACjB,CACF;QACD,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACtB,IAAI,EAAE;gBACJ,YAAY,EAAG,GAAG,CAAC,GAAG,CAAC,IAAkC,CAAC,YAAY;gBACtE,SAAS,EAAG,GAAG,CAAC,GAAG,CAAC,IAAgC,CAAC,SAAS,EAAE,GAAG,CACjE,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;qBACpD,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAChE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,KAAK,IAAI,CAAC;aACjD;SACF,CAAC,CAAC,CAAC,EAAE,CAAC;KACR,CAAA;IAED,OAAO,SAAS,CAAA;AAClB,CAAC,CAAC,CAAA"}
|
package/build/modules.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const modules:
|
|
1
|
+
import type { ServerEntrypoint } from '@owlmeans/server-entrypoint';
|
|
2
|
+
export declare const modules: ServerEntrypoint<unknown>[];
|
|
3
3
|
//# sourceMappingURL=modules.d.ts.map
|
package/build/modules.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAOnE,eAAO,MAAM,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAE9C,CAAA"}
|
package/build/modules.js
CHANGED
package/build/modules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAE3C,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;AAE3C,MAAM,CAAC,MAAM,OAAO,GAAgC;IAClD,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EAAuC,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,UAAU,CAAC;CAClG,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/api-config-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -21,15 +21,16 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@owlmeans/api-config": "^0.1.
|
|
25
|
-
"@owlmeans/server-api": "^0.1.
|
|
26
|
-
"@owlmeans/server-context": "^0.1.
|
|
27
|
-
"@owlmeans/server-
|
|
24
|
+
"@owlmeans/api-config": "^0.1.3",
|
|
25
|
+
"@owlmeans/server-api": "^0.1.3",
|
|
26
|
+
"@owlmeans/server-context": "^0.1.3",
|
|
27
|
+
"@owlmeans/server-entrypoint": "^0.1.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
+
"@owlmeans/dep-config": "workspace:*",
|
|
30
31
|
"@types/node": "^24.10.1",
|
|
31
32
|
"nodemon": "^3.1.11",
|
|
32
|
-
"typescript": "^
|
|
33
|
+
"typescript": "^6.0.2"
|
|
33
34
|
},
|
|
34
35
|
"publishConfig": {
|
|
35
36
|
"access": "public"
|
package/src/actions/config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RefedEntrypointHandler } from '@owlmeans/server-entrypoint'
|
|
2
2
|
import type { ApiConfig } from '@owlmeans/api-config'
|
|
3
3
|
import type { ServerConfig } from '@owlmeans/server-context'
|
|
4
4
|
import type { PluginConfig } from '@owlmeans/config'
|
|
@@ -8,7 +8,7 @@ import { PLUGINS } from '@owlmeans/config'
|
|
|
8
8
|
import { AppType, CONFIG_RECORD } from '@owlmeans/context'
|
|
9
9
|
import type { ConfigRecord } from '@owlmeans/context'
|
|
10
10
|
|
|
11
|
-
export const advertise:
|
|
11
|
+
export const advertise: RefedEntrypointHandler<ApiConfig> = handleRequest(async (_, ctx) => {
|
|
12
12
|
const apiConfig: ApiConfig = {
|
|
13
13
|
debug: ctx.cfg.debug ?? {},
|
|
14
14
|
brand: {},
|
package/src/modules.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import type {
|
|
3
|
-
import { elevate } from '@owlmeans/server-
|
|
2
|
+
import type { ServerEntrypoint } from '@owlmeans/server-entrypoint'
|
|
3
|
+
import { elevate } from '@owlmeans/server-entrypoint'
|
|
4
4
|
import { modules as list, API_CONFIG } from '@owlmeans/api-config'
|
|
5
5
|
import { config } from './actions/index.js'
|
|
6
6
|
|
|
7
7
|
elevate(list, API_CONFIG, config.advertise)
|
|
8
8
|
|
|
9
|
-
export const modules:
|
|
10
|
-
...list.filter((module): module is
|
|
9
|
+
export const modules: ServerEntrypoint<unknown>[] = [
|
|
10
|
+
...list.filter((module): module is ServerEntrypoint<unknown> => module.getAlias() === API_CONFIG)
|
|
11
11
|
]
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
|
-
"
|
|
3
|
+
"@owlmeans/dep-config/tsconfig.base.json",
|
|
4
|
+
"@owlmeans/dep-config/tsconfig.node.json"
|
|
4
5
|
],
|
|
5
6
|
"compilerOptions": {
|
|
6
|
-
"rootDir": "./src/",
|
|
7
|
-
"outDir": "./build/"
|
|
7
|
+
"rootDir": "./src/",
|
|
8
|
+
"outDir": "./build/"
|
|
8
9
|
},
|
|
9
10
|
"exclude": [
|
|
10
11
|
"./dist/**/*",
|
|
11
12
|
"./build/**/*",
|
|
12
13
|
"./*.ts"
|
|
13
14
|
]
|
|
14
|
-
}
|
|
15
|
+
}
|