@serve.zone/dcrouter 12.1.0 → 12.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/dist_serve/bundle.js +750 -688
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.dcrouter.d.ts +6 -1
- package/dist_ts/classes.dcrouter.js +11 -3
- package/dist_ts/config/classes.db-seeder.d.ts +25 -0
- package/dist_ts/config/classes.db-seeder.js +69 -0
- package/dist_ts/config/classes.reference-resolver.d.ts +80 -0
- package/dist_ts/config/classes.reference-resolver.js +482 -0
- package/dist_ts/config/classes.route-config-manager.d.ts +13 -3
- package/dist_ts/config/classes.route-config-manager.js +53 -3
- package/dist_ts/config/index.d.ts +2 -0
- package/dist_ts/config/index.js +3 -1
- package/dist_ts/db/documents/classes.network-target.doc.d.ts +15 -0
- package/dist_ts/db/documents/classes.network-target.doc.js +118 -0
- package/dist_ts/db/documents/classes.security-profile.doc.d.ts +16 -0
- package/dist_ts/db/documents/classes.security-profile.doc.js +118 -0
- package/dist_ts/db/documents/classes.stored-route.doc.d.ts +2 -0
- package/dist_ts/db/documents/classes.stored-route.doc.js +8 -2
- package/dist_ts/db/documents/index.d.ts +2 -0
- package/dist_ts/db/documents/index.js +3 -1
- package/dist_ts/opsserver/classes.opsserver.d.ts +2 -0
- package/dist_ts/opsserver/classes.opsserver.js +5 -1
- package/dist_ts/opsserver/handlers/index.d.ts +2 -0
- package/dist_ts/opsserver/handlers/index.js +3 -1
- package/dist_ts/opsserver/handlers/network-target.handler.d.ts +10 -0
- package/dist_ts/opsserver/handlers/network-target.handler.js +117 -0
- package/dist_ts/opsserver/handlers/route-management.handler.js +3 -2
- package/dist_ts/opsserver/handlers/security-profile.handler.d.ts +10 -0
- package/dist_ts/opsserver/handlers/security-profile.handler.js +119 -0
- package/dist_ts_interfaces/data/route-management.d.ts +48 -1
- package/dist_ts_interfaces/requests/index.d.ts +2 -0
- package/dist_ts_interfaces/requests/index.js +3 -1
- package/dist_ts_interfaces/requests/network-targets.d.ts +102 -0
- package/dist_ts_interfaces/requests/network-targets.js +2 -0
- package/dist_ts_interfaces/requests/route-management.d.ts +3 -1
- package/dist_ts_interfaces/requests/security-profiles.d.ts +102 -0
- package/dist_ts_interfaces/requests/security-profiles.js +2 -0
- package/dist_ts_web/00_commitinfo_data.js +1 -1
- package/dist_ts_web/appstate.d.ts +43 -0
- package/dist_ts_web/appstate.js +176 -2
- package/dist_ts_web/elements/index.d.ts +2 -0
- package/dist_ts_web/elements/index.js +3 -1
- package/dist_ts_web/elements/ops-dashboard.js +13 -1
- package/dist_ts_web/elements/ops-view-networktargets.d.ts +17 -0
- package/dist_ts_web/elements/ops-view-networktargets.js +246 -0
- package/dist_ts_web/elements/ops-view-securityprofiles.d.ts +17 -0
- package/dist_ts_web/elements/ops-view-securityprofiles.js +275 -0
- package/dist_ts_web/router.d.ts +1 -1
- package/dist_ts_web/router.js +2 -2
- package/package.json +1 -1
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.dcrouter.ts +19 -1
- package/ts/config/classes.db-seeder.ts +95 -0
- package/ts/config/classes.reference-resolver.ts +576 -0
- package/ts/config/classes.route-config-manager.ts +64 -1
- package/ts/config/index.ts +3 -1
- package/ts/db/documents/classes.network-target.doc.ts +48 -0
- package/ts/db/documents/classes.security-profile.doc.ts +49 -0
- package/ts/db/documents/classes.stored-route.doc.ts +4 -0
- package/ts/db/documents/index.ts +2 -0
- package/ts/opsserver/classes.opsserver.ts +4 -0
- package/ts/opsserver/handlers/index.ts +3 -1
- package/ts/opsserver/handlers/network-target.handler.ts +167 -0
- package/ts/opsserver/handlers/route-management.handler.ts +2 -1
- package/ts/opsserver/handlers/security-profile.handler.ts +169 -0
- package/ts_web/00_commitinfo_data.ts +1 -1
- package/ts_web/appstate.ts +243 -1
- package/ts_web/elements/index.ts +2 -0
- package/ts_web/elements/ops-dashboard.ts +12 -0
- package/ts_web/elements/ops-view-networktargets.ts +214 -0
- package/ts_web/elements/ops-view-securityprofiles.ts +242 -0
- package/ts_web/router.ts +1 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeesElement,
|
|
3
|
+
html,
|
|
4
|
+
customElement,
|
|
5
|
+
type TemplateResult,
|
|
6
|
+
css,
|
|
7
|
+
state,
|
|
8
|
+
cssManager,
|
|
9
|
+
} from '@design.estate/dees-element';
|
|
10
|
+
import * as appstate from '../appstate.js';
|
|
11
|
+
import * as interfaces from '../../dist_ts_interfaces/index.js';
|
|
12
|
+
import { viewHostCss } from './shared/css.js';
|
|
13
|
+
import { type IStatsTile } from '@design.estate/dees-catalog';
|
|
14
|
+
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'ops-view-securityprofiles': OpsViewSecurityProfiles;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@customElement('ops-view-securityprofiles')
|
|
22
|
+
export class OpsViewSecurityProfiles extends DeesElement {
|
|
23
|
+
@state()
|
|
24
|
+
accessor profilesState: appstate.IProfilesTargetsState = appstate.profilesTargetsStatePart.getState()!;
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
const sub = appstate.profilesTargetsStatePart.select().subscribe((newState) => {
|
|
29
|
+
this.profilesState = newState;
|
|
30
|
+
});
|
|
31
|
+
this.rxSubscriptions.push(sub);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async connectedCallback() {
|
|
35
|
+
await super.connectedCallback();
|
|
36
|
+
await appstate.profilesTargetsStatePart.dispatchAction(appstate.fetchProfilesAndTargetsAction, null);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public static styles = [
|
|
40
|
+
cssManager.defaultStyles,
|
|
41
|
+
viewHostCss,
|
|
42
|
+
css`
|
|
43
|
+
.profilesContainer {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
gap: 24px;
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
public render(): TemplateResult {
|
|
52
|
+
const profiles = this.profilesState.profiles;
|
|
53
|
+
|
|
54
|
+
const statsTiles: IStatsTile[] = [
|
|
55
|
+
{
|
|
56
|
+
id: 'totalProfiles',
|
|
57
|
+
title: 'Total Profiles',
|
|
58
|
+
type: 'number',
|
|
59
|
+
value: profiles.length,
|
|
60
|
+
icon: 'lucide:shieldCheck',
|
|
61
|
+
description: 'Reusable security profiles',
|
|
62
|
+
color: '#3b82f6',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
return html`
|
|
67
|
+
<div class="profilesContainer">
|
|
68
|
+
<dees-statsgrid .tiles=${statsTiles}></dees-statsgrid>
|
|
69
|
+
<dees-table
|
|
70
|
+
.heading=${'Security Profiles'}
|
|
71
|
+
.data=${profiles}
|
|
72
|
+
.displayFunction=${(profile: interfaces.data.ISecurityProfile) => ({
|
|
73
|
+
Name: profile.name,
|
|
74
|
+
Description: profile.description || '-',
|
|
75
|
+
'IP Allow List': (profile.security?.ipAllowList || []).join(', ') || '-',
|
|
76
|
+
'IP Block List': (profile.security?.ipBlockList || []).join(', ') || '-',
|
|
77
|
+
'Max Connections': profile.security?.maxConnections ?? '-',
|
|
78
|
+
'Rate Limit': profile.security?.rateLimit?.enabled ? `${profile.security.rateLimit.maxRequests}/${profile.security.rateLimit.window}s` : '-',
|
|
79
|
+
Extends: (profile.extendsProfiles || []).length > 0
|
|
80
|
+
? profile.extendsProfiles!.map(id => {
|
|
81
|
+
const p = profiles.find(pp => pp.id === id);
|
|
82
|
+
return p ? p.name : id.slice(0, 8);
|
|
83
|
+
}).join(', ')
|
|
84
|
+
: '-',
|
|
85
|
+
})}
|
|
86
|
+
.dataActions=${[
|
|
87
|
+
{
|
|
88
|
+
name: 'Create Profile',
|
|
89
|
+
iconName: 'lucide:plus',
|
|
90
|
+
type: ['header' as const],
|
|
91
|
+
action: async (_: any, table: any) => {
|
|
92
|
+
await this.showCreateProfileDialog(table);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'Refresh',
|
|
97
|
+
iconName: 'lucide:rotateCw',
|
|
98
|
+
type: ['header' as const],
|
|
99
|
+
action: async () => {
|
|
100
|
+
await appstate.profilesTargetsStatePart.dispatchAction(appstate.fetchProfilesAndTargetsAction, null);
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'Edit',
|
|
105
|
+
iconName: 'lucide:pencil',
|
|
106
|
+
type: ['contextmenu' as const],
|
|
107
|
+
action: async (profile: interfaces.data.ISecurityProfile, table: any) => {
|
|
108
|
+
await this.showEditProfileDialog(profile, table);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'Delete',
|
|
113
|
+
iconName: 'lucide:trash2',
|
|
114
|
+
type: ['contextmenu' as const],
|
|
115
|
+
action: async (profile: interfaces.data.ISecurityProfile) => {
|
|
116
|
+
await this.deleteProfile(profile);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
]}
|
|
120
|
+
></dees-table>
|
|
121
|
+
</div>
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
private async showCreateProfileDialog(table: any) {
|
|
126
|
+
const { DeesModal } = await import('@design.estate/dees-catalog');
|
|
127
|
+
DeesModal.createAndShow({
|
|
128
|
+
heading: 'Create Security Profile',
|
|
129
|
+
content: html`
|
|
130
|
+
<dees-form>
|
|
131
|
+
<dees-input-text .key=${'name'} .label=${'Name'} .required=${true}></dees-input-text>
|
|
132
|
+
<dees-input-text .key=${'description'} .label=${'Description'}></dees-input-text>
|
|
133
|
+
<dees-input-text .key=${'ipAllowList'} .label=${'IP Allow List (comma-separated)'}></dees-input-text>
|
|
134
|
+
<dees-input-text .key=${'ipBlockList'} .label=${'IP Block List (comma-separated)'}></dees-input-text>
|
|
135
|
+
<dees-input-text .key=${'maxConnections'} .label=${'Max Connections'}></dees-input-text>
|
|
136
|
+
</dees-form>
|
|
137
|
+
`,
|
|
138
|
+
menuOptions: [
|
|
139
|
+
{
|
|
140
|
+
name: 'Create',
|
|
141
|
+
action: async (modalArg: any) => {
|
|
142
|
+
const form = modalArg.shadowRoot!.querySelector('dees-form');
|
|
143
|
+
const data = await form.collectFormData();
|
|
144
|
+
const ipAllowList = data.ipAllowList
|
|
145
|
+
? String(data.ipAllowList).split(',').map((s: string) => s.trim()).filter(Boolean)
|
|
146
|
+
: undefined;
|
|
147
|
+
const ipBlockList = data.ipBlockList
|
|
148
|
+
? String(data.ipBlockList).split(',').map((s: string) => s.trim()).filter(Boolean)
|
|
149
|
+
: undefined;
|
|
150
|
+
const maxConnections = data.maxConnections ? parseInt(String(data.maxConnections)) : undefined;
|
|
151
|
+
|
|
152
|
+
await appstate.profilesTargetsStatePart.dispatchAction(appstate.createProfileAction, {
|
|
153
|
+
name: String(data.name),
|
|
154
|
+
description: data.description ? String(data.description) : undefined,
|
|
155
|
+
security: {
|
|
156
|
+
...(ipAllowList ? { ipAllowList } : {}),
|
|
157
|
+
...(ipBlockList ? { ipBlockList } : {}),
|
|
158
|
+
...(maxConnections ? { maxConnections } : {}),
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
modalArg.destroy();
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
{ name: 'Cancel', action: async (modalArg: any) => modalArg.destroy() },
|
|
165
|
+
],
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
private async showEditProfileDialog(profile: interfaces.data.ISecurityProfile, table: any) {
|
|
170
|
+
const { DeesModal } = await import('@design.estate/dees-catalog');
|
|
171
|
+
DeesModal.createAndShow({
|
|
172
|
+
heading: `Edit Profile: ${profile.name}`,
|
|
173
|
+
content: html`
|
|
174
|
+
<dees-form>
|
|
175
|
+
<dees-input-text .key=${'name'} .label=${'Name'} .value=${profile.name}></dees-input-text>
|
|
176
|
+
<dees-input-text .key=${'description'} .label=${'Description'} .value=${profile.description || ''}></dees-input-text>
|
|
177
|
+
<dees-input-text .key=${'ipAllowList'} .label=${'IP Allow List (comma-separated)'} .value=${(profile.security?.ipAllowList || []).join(', ')}></dees-input-text>
|
|
178
|
+
<dees-input-text .key=${'ipBlockList'} .label=${'IP Block List (comma-separated)'} .value=${(profile.security?.ipBlockList || []).join(', ')}></dees-input-text>
|
|
179
|
+
<dees-input-text .key=${'maxConnections'} .label=${'Max Connections'} .value=${String(profile.security?.maxConnections || '')}></dees-input-text>
|
|
180
|
+
</dees-form>
|
|
181
|
+
`,
|
|
182
|
+
menuOptions: [
|
|
183
|
+
{
|
|
184
|
+
name: 'Save',
|
|
185
|
+
action: async (modalArg: any) => {
|
|
186
|
+
const form = modalArg.shadowRoot!.querySelector('dees-form');
|
|
187
|
+
const data = await form.collectFormData();
|
|
188
|
+
const ipAllowList = data.ipAllowList
|
|
189
|
+
? String(data.ipAllowList).split(',').map((s: string) => s.trim()).filter(Boolean)
|
|
190
|
+
: [];
|
|
191
|
+
const ipBlockList = data.ipBlockList
|
|
192
|
+
? String(data.ipBlockList).split(',').map((s: string) => s.trim()).filter(Boolean)
|
|
193
|
+
: [];
|
|
194
|
+
const maxConnections = data.maxConnections ? parseInt(String(data.maxConnections)) : undefined;
|
|
195
|
+
|
|
196
|
+
await appstate.profilesTargetsStatePart.dispatchAction(appstate.updateProfileAction, {
|
|
197
|
+
id: profile.id,
|
|
198
|
+
name: String(data.name),
|
|
199
|
+
description: data.description ? String(data.description) : undefined,
|
|
200
|
+
security: {
|
|
201
|
+
ipAllowList,
|
|
202
|
+
ipBlockList,
|
|
203
|
+
...(maxConnections ? { maxConnections } : {}),
|
|
204
|
+
},
|
|
205
|
+
});
|
|
206
|
+
modalArg.destroy();
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
{ name: 'Cancel', action: async (modalArg: any) => modalArg.destroy() },
|
|
210
|
+
],
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
private async deleteProfile(profile: interfaces.data.ISecurityProfile) {
|
|
215
|
+
await appstate.profilesTargetsStatePart.dispatchAction(appstate.deleteProfileAction, {
|
|
216
|
+
id: profile.id,
|
|
217
|
+
force: false,
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const currentState = appstate.profilesTargetsStatePart.getState()!;
|
|
221
|
+
if (currentState.error?.includes('in use')) {
|
|
222
|
+
const { DeesModal } = await import('@design.estate/dees-catalog');
|
|
223
|
+
DeesModal.createAndShow({
|
|
224
|
+
heading: 'Profile In Use',
|
|
225
|
+
content: html`<p>${currentState.error} Force delete?</p>`,
|
|
226
|
+
menuOptions: [
|
|
227
|
+
{
|
|
228
|
+
name: 'Force Delete',
|
|
229
|
+
action: async (modalArg: any) => {
|
|
230
|
+
await appstate.profilesTargetsStatePart.dispatchAction(appstate.deleteProfileAction, {
|
|
231
|
+
id: profile.id,
|
|
232
|
+
force: true,
|
|
233
|
+
});
|
|
234
|
+
modalArg.destroy();
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
{ name: 'Cancel', action: async (modalArg: any) => modalArg.destroy() },
|
|
238
|
+
],
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
package/ts_web/router.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as appstate from './appstate.js';
|
|
|
3
3
|
|
|
4
4
|
const SmartRouter = plugins.domtools.plugins.smartrouter.SmartRouter;
|
|
5
5
|
|
|
6
|
-
export const validViews = ['overview', 'network', 'emails', 'logs', 'routes', 'apitokens', 'configuration', 'security', 'certificates', 'remoteingress', 'vpn'] as const;
|
|
6
|
+
export const validViews = ['overview', 'network', 'emails', 'logs', 'routes', 'apitokens', 'configuration', 'security', 'certificates', 'remoteingress', 'vpn', 'securityprofiles', 'networktargets'] as const;
|
|
7
7
|
|
|
8
8
|
export type TValidView = typeof validViews[number];
|
|
9
9
|
|