@owlmeans/wled 0.1.1 → 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 +1 -1
- package/README.md +31 -455
- package/build/modules.d.ts +1 -1
- package/build/modules.d.ts.map +1 -1
- package/build/modules.js +2 -2
- package/build/modules.js.map +1 -1
- package/package.json +7 -5
- package/src/modules.ts +2 -2
- package/tsconfig.json +3 -4
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 OwlMeans Common — Fullstack typescript framework
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,489 +1,65 @@
|
|
|
1
1
|
# @owlmeans/wled
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Whitelabel ("wled") core — shared types, models, and module declarations for entity-specific branding/content.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
- **Custom Styling System** - Support for custom colors, fonts, and visual styling
|
|
13
|
-
- **Media Management** - Handle custom brand assets like logos and media
|
|
14
|
-
- **Validation Schemas** - AJV-based schemas for consistent data validation
|
|
15
|
-
- **Route Integration** - Module definitions for whitelabeling API endpoints
|
|
16
|
-
- **Type Safety** - Comprehensive TypeScript interfaces and types
|
|
17
|
-
|
|
18
|
-
## Core Concepts
|
|
19
|
-
|
|
20
|
-
### Whitelabeling Types
|
|
21
|
-
|
|
22
|
-
The package defines several core types for whitelabeling:
|
|
23
|
-
|
|
24
|
-
- **CompanyInfo** - Basic company information including name, slug, and description
|
|
25
|
-
- **CustomStyles** - Visual styling configuration with colors and fonts
|
|
26
|
-
- **CustomMedia** - Brand assets like logos and media files
|
|
27
|
-
- **CustomUrls** - Custom URL configurations for different environments
|
|
28
|
-
|
|
29
|
-
### Provider System
|
|
30
|
-
|
|
31
|
-
The whitelabeling system uses a provider pattern where different types of whitelabeling data (company info, styles, media, DNS) can be requested and provided through a unified interface.
|
|
32
|
-
|
|
33
|
-
### Validation Integration
|
|
34
|
-
|
|
35
|
-
All data structures include corresponding AJV validation schemas, ensuring consistent validation across both frontend and backend implementations in fullstack applications.
|
|
7
|
+
- `WL_PROVIDE` / `WL_PROVIDE_PATH` — module alias and path for the whitelabel provide endpoint
|
|
8
|
+
- `WL_TYPE_COMPANY_INFO`, `WL_TYPE_STYLES`, `WL_TYPE_MEDIA`, `WL_TYPE_DNS` — whitelabel content type discriminators
|
|
9
|
+
- Type definitions: `CompanyInfo`, `CustomStyles`, `CustomColors`, `CustomFont`, `CustomMedia`, `CustomBrand`, `ProvideParams`, `ProvidedWL<T>`
|
|
10
|
+
- `modules` — array containing the `GET /wl/provide/:entity` declaration
|
|
11
|
+
- AJV models under `model/` (e.g., `ProvideParamsSchema`)
|
|
36
12
|
|
|
37
13
|
## Installation
|
|
38
14
|
|
|
39
15
|
```bash
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## API Reference
|
|
44
|
-
|
|
45
|
-
### Types
|
|
46
|
-
|
|
47
|
-
#### CompanyInfo
|
|
48
|
-
Interface for company information in whitelabeling.
|
|
49
|
-
|
|
50
|
-
```typescript
|
|
51
|
-
interface CompanyInfo {
|
|
52
|
-
resource?: string // Optional resource identifier
|
|
53
|
-
entityId: string // Unique entity identifier
|
|
54
|
-
fullName: string // Full company name
|
|
55
|
-
shortName: string // Abbreviated company name
|
|
56
|
-
slug: string // URL-friendly identifier
|
|
57
|
-
description: string // Company description
|
|
58
|
-
}
|
|
16
|
+
bun add @owlmeans/wled
|
|
59
17
|
```
|
|
60
18
|
|
|
61
|
-
|
|
62
|
-
Interface for custom styling configuration.
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
interface CustomStyles {
|
|
66
|
-
resource?: string // Optional resource identifier
|
|
67
|
-
entityId: string // Unique entity identifier
|
|
68
|
-
font: CustomFont // Font configuration
|
|
69
|
-
colors: CustomColors // Color palette
|
|
70
|
-
}
|
|
71
|
-
```
|
|
19
|
+
## Usage
|
|
72
20
|
|
|
73
|
-
|
|
74
|
-
Interface for custom color configuration.
|
|
21
|
+
Use the shared module declarations and types when wiring server- and web-side whitelabel features:
|
|
75
22
|
|
|
76
23
|
```typescript
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
secondaryColor?: string // Secondary brand color
|
|
80
|
-
alertColor?: string // Alert/error color
|
|
81
|
-
successColor?: string // Success color
|
|
82
|
-
primaryBackground?: string // Primary background color
|
|
83
|
-
secondaryBackground?: string // Secondary background color
|
|
84
|
-
alertBackground?: string // Alert background color
|
|
85
|
-
successBackground?: string // Success background color
|
|
86
|
-
}
|
|
24
|
+
import { modules as wlModules } from '@owlmeans/wled'
|
|
25
|
+
import type { ProvidedWL, CompanyInfo, CustomStyles } from '@owlmeans/wled'
|
|
87
26
|
```
|
|
88
27
|
|
|
89
|
-
|
|
90
|
-
Interface for custom font configuration.
|
|
28
|
+
Reference content type discriminators when filtering whitelabel records:
|
|
91
29
|
|
|
92
30
|
```typescript
|
|
93
|
-
|
|
94
|
-
fontFamily: string // Font family name
|
|
95
|
-
basicSize?: number // Base font size (minimum 8)
|
|
96
|
-
}
|
|
97
|
-
```
|
|
31
|
+
import { WL_TYPE_COMPANY_INFO, WL_TYPE_STYLES } from '@owlmeans/wled'
|
|
98
32
|
|
|
99
|
-
|
|
100
|
-
Interface for custom media assets.
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
interface CustomMedia {
|
|
104
|
-
brand: CustomBrand // Brand asset configuration
|
|
105
|
-
}
|
|
33
|
+
const companyInfo = await wlResource.load(`${entityId}:${WL_TYPE_COMPANY_INFO}`)
|
|
106
34
|
```
|
|
107
35
|
|
|
108
|
-
|
|
109
|
-
Interface for brand asset configuration.
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
interface CustomBrand {
|
|
113
|
-
squareLogo?: string // Square logo URL or path
|
|
114
|
-
wideLogo?: string // Wide/horizontal logo URL or path
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### CustomUrls
|
|
119
|
-
Interface for custom URL configuration.
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
interface CustomUrls {
|
|
123
|
-
adminUrl: string // Admin panel URL
|
|
124
|
-
userUrl: string // User interface URL
|
|
125
|
-
}
|
|
126
|
-
```
|
|
36
|
+
The actual server handlers live in `@owlmeans/server-wl`; web UI in `@owlmeans/web-wl` / `@owlmeans/client-wl`.
|
|
127
37
|
|
|
128
|
-
|
|
129
|
-
Interface for provider request parameters.
|
|
130
|
-
|
|
131
|
-
```typescript
|
|
132
|
-
interface ProvideParams {
|
|
133
|
-
entity: string // Entity identifier to provide data for
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
#### ProvidedWL
|
|
138
|
-
Generic interface for provided whitelabeling data.
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
type ProvidedWL<T extends {} = {}> = T & {
|
|
142
|
-
type: string // Type identifier for the provided data
|
|
143
|
-
exists: boolean | null // Whether the data exists
|
|
144
|
-
}
|
|
145
|
-
```
|
|
38
|
+
## API
|
|
146
39
|
|
|
147
40
|
### Constants
|
|
148
41
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
#### Type Constants
|
|
158
|
-
Constants for whitelabeling data types.
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
const WL_TYPE_COMPANY_INFO = 'company-info' // Company information type
|
|
162
|
-
const WL_TYPE_STYLES = 'styles' // Styling configuration type
|
|
163
|
-
const WL_TYPE_MEDIA = 'media' // Media assets type
|
|
164
|
-
const WL_TYPE_DNS = 'dns' // DNS configuration type
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### Validation Schemas
|
|
168
|
-
|
|
169
|
-
The package includes AJV validation schemas for all data structures, ensuring consistent validation across fullstack applications.
|
|
170
|
-
|
|
171
|
-
#### CompanyInfoSchema
|
|
172
|
-
AJV schema for validating CompanyInfo data.
|
|
173
|
-
|
|
174
|
-
```typescript
|
|
175
|
-
const CompanyInfoSchema: JSONSchemaType<CompanyInfo> = {
|
|
176
|
-
type: 'object',
|
|
177
|
-
properties: {
|
|
178
|
-
resource: { type: 'string', minLength: 0, nullable: true },
|
|
179
|
-
entityId: { type: 'string', minLength: 1 },
|
|
180
|
-
fullName: { type: 'string', minLength: 1, maxLength: 128 },
|
|
181
|
-
shortName: { type: 'string', minLength: 0, maxLength: 32 },
|
|
182
|
-
slug: { type: 'string', minLength: 0 },
|
|
183
|
-
description: { type: 'string', minLength: 0, maxLength: 512 }
|
|
184
|
-
},
|
|
185
|
-
required: ['entityId', 'fullName', 'shortName', 'slug', 'description'],
|
|
186
|
-
additionalProperties: false
|
|
187
|
-
}
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
#### CustomStylesSchema
|
|
191
|
-
AJV schema for validating CustomStyles data.
|
|
192
|
-
|
|
193
|
-
```typescript
|
|
194
|
-
const CustomStylesSchema: JSONSchemaType<CustomStyles> = {
|
|
195
|
-
type: 'object',
|
|
196
|
-
properties: {
|
|
197
|
-
resource: { type: 'string', minLength: 0, nullable: true },
|
|
198
|
-
entityId: { type: 'string', minLength: 1 },
|
|
199
|
-
font: CustomFontSchema,
|
|
200
|
-
colors: CustomColorsSchema
|
|
201
|
-
},
|
|
202
|
-
required: ['entityId', 'font', 'colors'],
|
|
203
|
-
additionalProperties: false
|
|
204
|
-
}
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
#### CustomColorsSchema
|
|
208
|
-
AJV schema for validating CustomColors data.
|
|
209
|
-
|
|
210
|
-
```typescript
|
|
211
|
-
const CustomColorsSchema: JSONSchemaType<CustomColors> = {
|
|
212
|
-
type: 'object',
|
|
213
|
-
properties: {
|
|
214
|
-
primaryColor: { type: 'string', pattern: '^#(\\d|[a-fA-F]){3,8}$' },
|
|
215
|
-
secondaryColor: { type: 'string', pattern: '^#(\\d|[a-fA-F]){3,8}$', nullable: true },
|
|
216
|
-
// ... other color properties with hex color validation
|
|
217
|
-
},
|
|
218
|
-
required: ['primaryColor'],
|
|
219
|
-
additionalProperties: false
|
|
220
|
-
}
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
#### CustomFontSchema
|
|
224
|
-
AJV schema for validating CustomFont data.
|
|
42
|
+
- `WL_PROVIDE` — `'wl-provide'`
|
|
43
|
+
- `WL_PROVIDE_PATH` — `'/wl/provide/:entity'`
|
|
44
|
+
- `WL_TYPE_COMPANY_INFO` — `'company-info'`
|
|
45
|
+
- `WL_TYPE_STYLES` — `'styles'`
|
|
46
|
+
- `WL_TYPE_MEDIA` — `'media'`
|
|
47
|
+
- `WL_TYPE_DNS` — `'dns'`
|
|
225
48
|
|
|
226
|
-
|
|
227
|
-
const CustomFontSchema: JSONSchemaType<CustomFont> = {
|
|
228
|
-
type: 'object',
|
|
229
|
-
properties: {
|
|
230
|
-
fontFamily: { type: 'string', minLength: 0, maxLength: 128 },
|
|
231
|
-
basicSize: { type: 'number', minimum: 8, nullable: true }
|
|
232
|
-
},
|
|
233
|
-
required: ['fontFamily'],
|
|
234
|
-
additionalProperties: false
|
|
235
|
-
}
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
#### ProvideParamsSchema
|
|
239
|
-
AJV schema for validating ProvideParams data.
|
|
240
|
-
|
|
241
|
-
```typescript
|
|
242
|
-
const ProvideParamsSchema: JSONSchemaType<ProvideParams> = {
|
|
243
|
-
type: 'object',
|
|
244
|
-
properties: {
|
|
245
|
-
entity: { type: 'string', minLength: 1 }
|
|
246
|
-
},
|
|
247
|
-
required: ['entity'],
|
|
248
|
-
additionalProperties: false
|
|
249
|
-
}
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### Modules
|
|
253
|
-
|
|
254
|
-
#### Whitelabeling Provider Module
|
|
255
|
-
Pre-configured module for handling whitelabeling data provision.
|
|
256
|
-
|
|
257
|
-
```typescript
|
|
258
|
-
import { modules } from '@owlmeans/wled'
|
|
259
|
-
|
|
260
|
-
// The package exports a pre-configured module array
|
|
261
|
-
const modules = [
|
|
262
|
-
module(
|
|
263
|
-
route(WL_PROVIDE, WL_PROVIDE_PATH, backend()),
|
|
264
|
-
filter(params(ProvideParamsSchema))
|
|
265
|
-
)
|
|
266
|
-
]
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
This module provides:
|
|
270
|
-
- Route configuration for `/wl/provide/:entity` endpoint
|
|
271
|
-
- Parameter validation using the ProvideParamsSchema
|
|
272
|
-
- Backend route configuration
|
|
273
|
-
|
|
274
|
-
## Usage Examples
|
|
275
|
-
|
|
276
|
-
### Basic Company Information
|
|
277
|
-
|
|
278
|
-
```typescript
|
|
279
|
-
import { CompanyInfo, WL_TYPE_COMPANY_INFO } from '@owlmeans/wled'
|
|
280
|
-
|
|
281
|
-
// Create company information
|
|
282
|
-
const companyInfo: CompanyInfo = {
|
|
283
|
-
entityId: 'company-123',
|
|
284
|
-
fullName: 'Example Corporation',
|
|
285
|
-
shortName: 'ExampleCorp',
|
|
286
|
-
slug: 'example-corp',
|
|
287
|
-
description: 'A leading technology company'
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// Use with provider system
|
|
291
|
-
const providedCompanyInfo: ProvidedWL<CompanyInfo> = {
|
|
292
|
-
...companyInfo,
|
|
293
|
-
type: WL_TYPE_COMPANY_INFO,
|
|
294
|
-
exists: true
|
|
295
|
-
}
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
### Custom Styling Configuration
|
|
299
|
-
|
|
300
|
-
```typescript
|
|
301
|
-
import { CustomStyles, CustomColors, CustomFont, WL_TYPE_STYLES } from '@owlmeans/wled'
|
|
302
|
-
|
|
303
|
-
// Define custom colors
|
|
304
|
-
const customColors: CustomColors = {
|
|
305
|
-
primaryColor: '#007bff',
|
|
306
|
-
secondaryColor: '#6c757d',
|
|
307
|
-
alertColor: '#dc3545',
|
|
308
|
-
successColor: '#28a745',
|
|
309
|
-
primaryBackground: '#ffffff',
|
|
310
|
-
secondaryBackground: '#f8f9fa'
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// Define custom font
|
|
314
|
-
const customFont: CustomFont = {
|
|
315
|
-
fontFamily: 'Inter, sans-serif',
|
|
316
|
-
basicSize: 14
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// Create custom styles
|
|
320
|
-
const customStyles: CustomStyles = {
|
|
321
|
-
entityId: 'company-123',
|
|
322
|
-
font: customFont,
|
|
323
|
-
colors: customColors
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
// Use with provider system
|
|
327
|
-
const providedStyles: ProvidedWL<CustomStyles> = {
|
|
328
|
-
...customStyles,
|
|
329
|
-
type: WL_TYPE_STYLES,
|
|
330
|
-
exists: true
|
|
331
|
-
}
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### Media Assets Configuration
|
|
335
|
-
|
|
336
|
-
```typescript
|
|
337
|
-
import { CustomMedia, CustomBrand, WL_TYPE_MEDIA } from '@owlmeans/wled'
|
|
338
|
-
|
|
339
|
-
// Define brand assets
|
|
340
|
-
const customBrand: CustomBrand = {
|
|
341
|
-
squareLogo: '/assets/logo-square.png',
|
|
342
|
-
wideLogo: '/assets/logo-wide.png'
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// Create media configuration
|
|
346
|
-
const customMedia: CustomMedia = {
|
|
347
|
-
brand: customBrand
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// Use with provider system
|
|
351
|
-
const providedMedia: ProvidedWL<CustomMedia> = {
|
|
352
|
-
...customMedia,
|
|
353
|
-
type: WL_TYPE_MEDIA,
|
|
354
|
-
exists: true
|
|
355
|
-
}
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
### Module Integration
|
|
359
|
-
|
|
360
|
-
```typescript
|
|
361
|
-
import { modules } from '@owlmeans/wled'
|
|
362
|
-
import { context } from '@owlmeans/context'
|
|
363
|
-
|
|
364
|
-
// Add whitelabeling modules to your application context
|
|
365
|
-
context.modules.push(...modules)
|
|
366
|
-
|
|
367
|
-
// The modules will handle requests to /wl/provide/:entity
|
|
368
|
-
// with proper parameter validation
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
## Integration Patterns
|
|
372
|
-
|
|
373
|
-
### Backend Integration
|
|
374
|
-
|
|
375
|
-
```typescript
|
|
376
|
-
import { modules, ProvideParams, CompanyInfo, WL_TYPE_COMPANY_INFO } from '@owlmeans/wled'
|
|
377
|
-
|
|
378
|
-
// Register the whitelabeling provider module
|
|
379
|
-
app.use(modules)
|
|
380
|
-
|
|
381
|
-
// Implement handler for whitelabeling data provision
|
|
382
|
-
const handleProvideWL = async (params: ProvideParams) => {
|
|
383
|
-
const { entity } = params
|
|
384
|
-
|
|
385
|
-
// Fetch company information for the entity
|
|
386
|
-
const companyInfo = await getCompanyInfo(entity)
|
|
387
|
-
|
|
388
|
-
if (companyInfo) {
|
|
389
|
-
return {
|
|
390
|
-
...companyInfo,
|
|
391
|
-
type: WL_TYPE_COMPANY_INFO,
|
|
392
|
-
exists: true
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
return {
|
|
397
|
-
type: WL_TYPE_COMPANY_INFO,
|
|
398
|
-
exists: false
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### Frontend Integration
|
|
404
|
-
|
|
405
|
-
```typescript
|
|
406
|
-
import { ProvideParams, ProvidedWL, CompanyInfo, WL_TYPE_COMPANY_INFO } from '@owlmeans/wled'
|
|
407
|
-
|
|
408
|
-
// Fetch whitelabeling data from the provider endpoint
|
|
409
|
-
const fetchWhitelabelingData = async (entity: string): Promise<ProvidedWL<CompanyInfo>> => {
|
|
410
|
-
const response = await fetch(`/wl/provide/${entity}`)
|
|
411
|
-
return response.json()
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// Use in React component
|
|
415
|
-
const WhitelabeledHeader = ({ entity }: { entity: string }) => {
|
|
416
|
-
const [companyInfo, setCompanyInfo] = useState<ProvidedWL<CompanyInfo> | null>(null)
|
|
417
|
-
|
|
418
|
-
useEffect(() => {
|
|
419
|
-
fetchWhitelabelingData(entity).then(setCompanyInfo)
|
|
420
|
-
}, [entity])
|
|
421
|
-
|
|
422
|
-
if (!companyInfo?.exists) {
|
|
423
|
-
return <DefaultHeader />
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return (
|
|
427
|
-
<header>
|
|
428
|
-
<h1>{companyInfo.fullName}</h1>
|
|
429
|
-
<p>{companyInfo.description}</p>
|
|
430
|
-
</header>
|
|
431
|
-
)
|
|
432
|
-
}
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
### Multi-Type Provider Implementation
|
|
436
|
-
|
|
437
|
-
```typescript
|
|
438
|
-
import {
|
|
439
|
-
ProvideParams,
|
|
440
|
-
ProvidedWL,
|
|
441
|
-
CompanyInfo,
|
|
442
|
-
CustomStyles,
|
|
443
|
-
CustomMedia,
|
|
444
|
-
WL_TYPE_COMPANY_INFO,
|
|
445
|
-
WL_TYPE_STYLES,
|
|
446
|
-
WL_TYPE_MEDIA
|
|
447
|
-
} from '@owlmeans/wled'
|
|
49
|
+
### Types
|
|
448
50
|
|
|
449
|
-
|
|
450
|
-
const provideWhitelabelingData = async (
|
|
451
|
-
entity: string,
|
|
452
|
-
type: string
|
|
453
|
-
): Promise<ProvidedWL<any>> => {
|
|
454
|
-
switch (type) {
|
|
455
|
-
case WL_TYPE_COMPANY_INFO:
|
|
456
|
-
return await provideCompanyInfo(entity)
|
|
457
|
-
case WL_TYPE_STYLES:
|
|
458
|
-
return await provideCustomStyles(entity)
|
|
459
|
-
case WL_TYPE_MEDIA:
|
|
460
|
-
return await provideCustomMedia(entity)
|
|
461
|
-
default:
|
|
462
|
-
return { type, exists: false }
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
```
|
|
51
|
+
`CompanyInfo`, `CustomStyles`, `CustomColors`, `CustomFont`, `CustomMedia`, `CustomBrand`, `ProvideParams`, `ProvidedWL<T>` — re-exported at the root entry.
|
|
466
52
|
|
|
467
|
-
|
|
53
|
+
### `modules`
|
|
468
54
|
|
|
469
|
-
|
|
470
|
-
2. **Type Safety** - Leverage TypeScript interfaces to ensure type safety throughout your application
|
|
471
|
-
3. **Resource Management** - Use the optional `resource` field to track data sources and manage resources
|
|
472
|
-
4. **Error Handling** - Always check the `exists` property in `ProvidedWL` responses before using the data
|
|
473
|
-
5. **Hex Color Validation** - The color schemas enforce hex color format with proper validation patterns
|
|
474
|
-
6. **Font Size Constraints** - Ensure font sizes meet the minimum requirement (8) when specified
|
|
475
|
-
7. **Entity Identification** - Use consistent entity identifiers across all whitelabeling data types
|
|
55
|
+
Array with one declaration: `GET /wl/provide/:entity` (alias `WL_PROVIDE`), with `params` filter using `ProvideParamsSchema`.
|
|
476
56
|
|
|
477
|
-
|
|
57
|
+
### `model`
|
|
478
58
|
|
|
479
|
-
|
|
480
|
-
- `@owlmeans/auth` - For authentication and entity validation schemas
|
|
481
|
-
- `@owlmeans/module` - For module creation and filtering
|
|
482
|
-
- `@owlmeans/route` - For route configuration
|
|
483
|
-
- `ajv` - For JSON schema validation (peer dependency)
|
|
59
|
+
Submodule exporting AJV schemas (e.g., `ProvideParamsSchema`) and helpers for whitelabel records.
|
|
484
60
|
|
|
485
61
|
## Related Packages
|
|
486
62
|
|
|
487
|
-
- `@owlmeans/
|
|
488
|
-
- `@owlmeans/
|
|
489
|
-
- `@owlmeans/
|
|
63
|
+
- [`@owlmeans/server-wl`](../server-wl) — server-side whitelabel handlers (uses `modules` from here)
|
|
64
|
+
- [`@owlmeans/web-wl`](../web-wl) — web UI components for whitelabel content
|
|
65
|
+
- [`@owlmeans/client-wl`](../client-wl) — client-side whitelabel placeholder
|
package/build/modules.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const modules: import("@owlmeans/
|
|
1
|
+
export declare const modules: import("@owlmeans/entrypoint").CommonEntrypoint[];
|
|
2
2
|
//# 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":"AAKA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,mDAKnB,CAAA"}
|
package/build/modules.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { filter,
|
|
1
|
+
import { filter, entrypoint, params } from '@owlmeans/entrypoint';
|
|
2
2
|
import { route, backend } from '@owlmeans/route';
|
|
3
3
|
import { WL_PROVIDE, WL_PROVIDE_PATH } from './consts.js';
|
|
4
4
|
import { ProvideParamsSchema } from './model/provider.js';
|
|
5
5
|
export const modules = [
|
|
6
|
-
|
|
6
|
+
entrypoint(route(WL_PROVIDE, WL_PROVIDE_PATH, backend()), filter(params(ProvideParamsSchema)))
|
|
7
7
|
];
|
|
8
8
|
//# sourceMappingURL=modules.js.map
|
package/build/modules.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,UAAU,CACR,KAAK,CAAC,UAAU,EAAE,eAAe,EAAE,OAAO,EAAE,CAAC,EAC7C,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,CACpC;CACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/wled",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"type": "module",
|
|
5
6
|
"scripts": {
|
|
6
7
|
"build": "tsc -b",
|
|
@@ -23,14 +24,15 @@
|
|
|
23
24
|
"ajv": "*"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@owlmeans/auth": "^0.1.
|
|
27
|
-
"@owlmeans/
|
|
28
|
-
"@owlmeans/route": "^0.1.
|
|
27
|
+
"@owlmeans/auth": "^0.1.3",
|
|
28
|
+
"@owlmeans/entrypoint": "^0.1.3",
|
|
29
|
+
"@owlmeans/route": "^0.1.3"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
32
|
+
"@owlmeans/dep-config": "workspace:*",
|
|
31
33
|
"nodemon": "^3.1.11",
|
|
32
34
|
"npm-check": "^6.0.1",
|
|
33
|
-
"typescript": "^
|
|
35
|
+
"typescript": "^6.0.2"
|
|
34
36
|
},
|
|
35
37
|
"publishConfig": {
|
|
36
38
|
"access": "public"
|
package/src/modules.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { filter,
|
|
1
|
+
import { filter, entrypoint, params } from '@owlmeans/entrypoint'
|
|
2
2
|
import { route, backend } from '@owlmeans/route'
|
|
3
3
|
import { WL_PROVIDE, WL_PROVIDE_PATH } from './consts.js'
|
|
4
4
|
import { ProvideParamsSchema } from './model/provider.js'
|
|
5
5
|
|
|
6
6
|
export const modules = [
|
|
7
|
-
|
|
7
|
+
entrypoint(
|
|
8
8
|
route(WL_PROVIDE, WL_PROVIDE_PATH, backend()),
|
|
9
9
|
filter(params(ProvideParamsSchema))
|
|
10
10
|
)
|
package/tsconfig.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
|
-
"
|
|
3
|
+
"@owlmeans/dep-config/tsconfig.base.json"
|
|
4
4
|
],
|
|
5
5
|
"compilerOptions": {
|
|
6
|
-
"rootDir": "./src/",
|
|
7
|
-
"outDir": "./build/"
|
|
8
|
-
"moduleResolution": "Bundler",
|
|
6
|
+
"rootDir": "./src/",
|
|
7
|
+
"outDir": "./build/"
|
|
9
8
|
},
|
|
10
9
|
"exclude": [
|
|
11
10
|
"./dist/**/*",
|