@alepha/devtools 0.13.6 → 0.13.7
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/index.d.ts +249 -32
- package/dist/index.js +253 -22
- package/dist/index.js.map +1 -1
- package/package.json +12 -6
- package/src/{DevToolsProvider.ts → api/DevToolsProvider.ts} +29 -1
- package/src/{providers → api/providers}/DevToolsMetadataProvider.ts +210 -2
- package/src/api/schemas/DevAtomMetadata.ts +26 -0
- package/src/api/schemas/DevCommandMetadata.ts +9 -0
- package/src/api/schemas/DevEntityMetadata.ts +57 -0
- package/src/api/schemas/DevEnvMetadata.ts +22 -0
- package/src/{schemas → api/schemas}/DevMetadata.ts +10 -1
- package/src/api/schemas/DevRouteMetadata.ts +8 -0
- package/src/index.ts +23 -16
- package/src/ui/AppRouter.tsx +85 -2
- package/src/ui/components/DevAtomsViewer.tsx +636 -0
- package/src/ui/components/DevCacheInspector.tsx +423 -0
- package/src/ui/components/DevDashboard.tsx +188 -0
- package/src/ui/components/DevEnvExplorer.tsx +462 -0
- package/src/ui/components/DevLayout.tsx +65 -4
- package/src/ui/components/DevLogViewer.tsx +161 -163
- package/src/ui/components/DevQueueMonitor.tsx +51 -0
- package/src/ui/components/DevTopicsViewer.tsx +690 -0
- package/src/ui/components/actions/ActionGroup.tsx +37 -0
- package/src/ui/components/actions/ActionItem.tsx +138 -0
- package/src/ui/components/actions/DevActionsExplorer.tsx +132 -0
- package/src/ui/components/actions/MethodBadge.tsx +18 -0
- package/src/ui/components/actions/SchemaViewer.tsx +21 -0
- package/src/ui/components/actions/TryItPanel.tsx +140 -0
- package/src/ui/components/actions/constants.ts +7 -0
- package/src/ui/components/actions/helpers.ts +18 -0
- package/src/ui/components/actions/index.ts +8 -0
- package/src/ui/components/db/ColumnBadge.tsx +55 -0
- package/src/ui/components/db/DevDbStudio.tsx +485 -0
- package/src/ui/components/db/constants.ts +11 -0
- package/src/ui/components/db/index.ts +4 -0
- package/src/ui/components/db/types.ts +7 -0
- package/src/ui/components/graph/DevDependencyGraph.tsx +358 -0
- package/src/ui/components/graph/GraphControls.tsx +162 -0
- package/src/ui/components/graph/NodeDetails.tsx +181 -0
- package/src/ui/components/graph/ProviderNode.tsx +97 -0
- package/src/ui/components/graph/constants.ts +35 -0
- package/src/ui/components/graph/helpers.ts +443 -0
- package/src/ui/components/graph/index.ts +7 -0
- package/src/ui/components/graph/types.ts +28 -0
- package/src/ui/styles.css +0 -6
- package/src/ui/resources/wotfardregular/stylesheet.css +0 -12
- package/src/ui/resources/wotfardregular/wotfard-regular-webfont.eot +0 -0
- package/src/ui/resources/wotfardregular/wotfard-regular-webfont.ttf +0 -0
- package/src/ui/resources/wotfardregular/wotfard-regular-webfont.woff2 +0 -0
- /package/src/{entities → api/entities}/logs.ts +0 -0
- /package/src/{providers → api/providers}/DevToolsDatabaseProvider.ts +0 -0
- /package/src/{repositories → api/repositories}/LogRepository.ts +0 -0
- /package/src/{schemas → api/schemas}/DevActionMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevBucketMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevCacheMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevModuleMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevPageMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevProviderMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevQueueMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevRealmMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevSchedulerMetadata.ts +0 -0
- /package/src/{schemas → api/schemas}/DevTopicMetadata.ts +0 -0
|
@@ -49,6 +49,8 @@ export class DevToolsProvider {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
ev.entry.message = ev.entry.message?.slice(0, 2000); // limit message size
|
|
53
|
+
|
|
52
54
|
if (ev.entry.module === "alepha.devtools") {
|
|
53
55
|
// skip devtools logs to avoid infinite loop
|
|
54
56
|
return;
|
|
@@ -85,7 +87,7 @@ export class DevToolsProvider {
|
|
|
85
87
|
|
|
86
88
|
protected readonly uiRoute = $serve({
|
|
87
89
|
path: "/devtools",
|
|
88
|
-
root: join(fileURLToPath(import.meta.url), "
|
|
90
|
+
root: join(fileURLToPath(import.meta.url), "../../../assets/devtools"),
|
|
89
91
|
historyApiFallback: true,
|
|
90
92
|
});
|
|
91
93
|
|
|
@@ -126,4 +128,30 @@ export class DevToolsProvider {
|
|
|
126
128
|
);
|
|
127
129
|
},
|
|
128
130
|
});
|
|
131
|
+
|
|
132
|
+
protected readonly updateAtomRoute = $route({
|
|
133
|
+
method: "POST",
|
|
134
|
+
path: "/devtools/api/atoms",
|
|
135
|
+
silent: true,
|
|
136
|
+
schema: {
|
|
137
|
+
body: t.object({
|
|
138
|
+
name: t.text(),
|
|
139
|
+
value: t.any(),
|
|
140
|
+
}),
|
|
141
|
+
response: t.object({
|
|
142
|
+
success: t.boolean(),
|
|
143
|
+
}),
|
|
144
|
+
},
|
|
145
|
+
handler: ({ body }) => {
|
|
146
|
+
const atoms = this.alepha.store.getAtoms(false);
|
|
147
|
+
const atomEntry = atoms.find((a) => a.atom.key === body.name);
|
|
148
|
+
|
|
149
|
+
if (atomEntry) {
|
|
150
|
+
this.alepha.store.set(atomEntry.atom, body.value);
|
|
151
|
+
return { success: true };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return { success: false };
|
|
155
|
+
},
|
|
156
|
+
});
|
|
129
157
|
}
|
|
@@ -1,21 +1,45 @@
|
|
|
1
|
-
import { $inject, Alepha } from "alepha";
|
|
1
|
+
import { $inject, Alepha, type TObject, type TSchema, t } from "alepha";
|
|
2
2
|
import { $bucket } from "alepha/bucket";
|
|
3
3
|
import { $cache } from "alepha/cache";
|
|
4
|
+
import { $command } from "alepha/command";
|
|
4
5
|
import { $logger } from "alepha/logger";
|
|
6
|
+
import {
|
|
7
|
+
PG_CREATED_AT,
|
|
8
|
+
PG_DEFAULT,
|
|
9
|
+
PG_DELETED_AT,
|
|
10
|
+
PG_IDENTITY,
|
|
11
|
+
PG_PRIMARY_KEY,
|
|
12
|
+
PG_REF,
|
|
13
|
+
PG_SERIAL,
|
|
14
|
+
PG_UPDATED_AT,
|
|
15
|
+
PG_VERSION,
|
|
16
|
+
RepositoryProvider,
|
|
17
|
+
} from "alepha/orm";
|
|
5
18
|
import { $queue } from "alepha/queue";
|
|
6
19
|
import { $scheduler } from "alepha/scheduler";
|
|
7
20
|
import { $realm } from "alepha/security";
|
|
8
21
|
import { $action } from "alepha/server";
|
|
9
22
|
import { $topic } from "alepha/topic";
|
|
10
23
|
import type { DevActionMetadata } from "../schemas/DevActionMetadata.ts";
|
|
24
|
+
import type { DevAtomMetadata } from "../schemas/DevAtomMetadata.ts";
|
|
11
25
|
import type { DevBucketMetadata } from "../schemas/DevBucketMetadata.ts";
|
|
12
26
|
import type { DevCacheMetadata } from "../schemas/DevCacheMetadata.ts";
|
|
27
|
+
import type { DevCommandMetadata } from "../schemas/DevCommandMetadata.ts";
|
|
28
|
+
import type {
|
|
29
|
+
DevEntityColumn,
|
|
30
|
+
DevEntityConstraint,
|
|
31
|
+
DevEntityForeignKey,
|
|
32
|
+
DevEntityIndex,
|
|
33
|
+
DevEntityMetadata,
|
|
34
|
+
} from "../schemas/DevEntityMetadata.ts";
|
|
35
|
+
import type { DevEnvMetadata } from "../schemas/DevEnvMetadata.ts";
|
|
13
36
|
import type { DevMetadata } from "../schemas/DevMetadata.ts";
|
|
14
37
|
import type { DevModuleMetadata } from "../schemas/DevModuleMetadata.ts";
|
|
15
38
|
import type { DevPageMetadata } from "../schemas/DevPageMetadata.ts";
|
|
16
39
|
import type { DevProviderMetadata } from "../schemas/DevProviderMetadata.ts";
|
|
17
40
|
import type { DevQueueMetadata } from "../schemas/DevQueueMetadata.ts";
|
|
18
41
|
import type { DevRealmMetadata } from "../schemas/DevRealmMetadata.ts";
|
|
42
|
+
import type { DevRouteMetadata } from "../schemas/DevRouteMetadata.ts";
|
|
19
43
|
import type { DevSchedulerMetadata } from "../schemas/DevSchedulerMetadata.ts";
|
|
20
44
|
import type { DevTopicMetadata } from "../schemas/DevTopicMetadata.ts";
|
|
21
45
|
|
|
@@ -159,7 +183,7 @@ export class DevToolsMetadataProvider {
|
|
|
159
183
|
|
|
160
184
|
return Object.entries(graph).map(([name, info]) => ({
|
|
161
185
|
name,
|
|
162
|
-
module: info.module,
|
|
186
|
+
module: info.module ?? name,
|
|
163
187
|
dependencies: info.from,
|
|
164
188
|
aliases: info.as,
|
|
165
189
|
}));
|
|
@@ -185,6 +209,185 @@ export class DevToolsMetadataProvider {
|
|
|
185
209
|
}));
|
|
186
210
|
}
|
|
187
211
|
|
|
212
|
+
public getEntities(): DevEntityMetadata[] {
|
|
213
|
+
try {
|
|
214
|
+
const repositoryProvider = this.alepha.inject(RepositoryProvider);
|
|
215
|
+
const repositories = repositoryProvider.getRepositories();
|
|
216
|
+
|
|
217
|
+
return repositories.map((repo) => {
|
|
218
|
+
const entity = repo.entity;
|
|
219
|
+
const schema = entity.schema as TObject;
|
|
220
|
+
const options = entity.options;
|
|
221
|
+
|
|
222
|
+
// Extract columns from schema
|
|
223
|
+
const columns: DevEntityColumn[] = Object.entries(
|
|
224
|
+
schema.properties,
|
|
225
|
+
).map(([name, field]) => {
|
|
226
|
+
const fieldSchema = field as TSchema & Record<symbol, any>;
|
|
227
|
+
const refData = fieldSchema[PG_REF];
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
name,
|
|
231
|
+
type: this.getColumnType(fieldSchema),
|
|
232
|
+
nullable: this.isNullable(fieldSchema),
|
|
233
|
+
primaryKey: PG_PRIMARY_KEY in fieldSchema,
|
|
234
|
+
identity: PG_IDENTITY in fieldSchema || PG_SERIAL in fieldSchema,
|
|
235
|
+
createdAt: PG_CREATED_AT in fieldSchema,
|
|
236
|
+
updatedAt: PG_UPDATED_AT in fieldSchema,
|
|
237
|
+
deletedAt: PG_DELETED_AT in fieldSchema,
|
|
238
|
+
version: PG_VERSION in fieldSchema,
|
|
239
|
+
hasDefault: PG_DEFAULT in fieldSchema,
|
|
240
|
+
ref: refData
|
|
241
|
+
? {
|
|
242
|
+
entity: refData.ref?.()?.entity?.name ?? "unknown",
|
|
243
|
+
column: refData.ref?.()?.name ?? "unknown",
|
|
244
|
+
onUpdate: refData.actions?.onUpdate,
|
|
245
|
+
onDelete: refData.actions?.onDelete,
|
|
246
|
+
}
|
|
247
|
+
: undefined,
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// Extract indexes
|
|
252
|
+
const indexes: DevEntityIndex[] = (options.indexes ?? []).map(
|
|
253
|
+
(idx: any) => {
|
|
254
|
+
if (typeof idx === "string") {
|
|
255
|
+
return { columns: [idx], unique: false };
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
name: idx.name,
|
|
259
|
+
columns: idx.column ? [idx.column] : (idx.columns ?? []),
|
|
260
|
+
unique: idx.unique ?? false,
|
|
261
|
+
};
|
|
262
|
+
},
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
// Extract foreign keys
|
|
266
|
+
const foreignKeys: DevEntityForeignKey[] = (
|
|
267
|
+
options.foreignKeys ?? []
|
|
268
|
+
).map((fk: any) => ({
|
|
269
|
+
name: fk.name,
|
|
270
|
+
columns: fk.columns.map(String),
|
|
271
|
+
foreignEntity: fk.foreignColumns?.[0]?.()?.entity?.name ?? "unknown",
|
|
272
|
+
foreignColumns: fk.foreignColumns?.map(
|
|
273
|
+
(fc: any) => fc?.()?.name ?? "unknown",
|
|
274
|
+
),
|
|
275
|
+
}));
|
|
276
|
+
|
|
277
|
+
// Extract constraints
|
|
278
|
+
const constraints: DevEntityConstraint[] = (
|
|
279
|
+
options.constraints ?? []
|
|
280
|
+
).map((c: any) => ({
|
|
281
|
+
name: c.name,
|
|
282
|
+
columns: c.columns.map(String),
|
|
283
|
+
unique: !!c.unique,
|
|
284
|
+
hasCheck: !!c.check,
|
|
285
|
+
}));
|
|
286
|
+
|
|
287
|
+
return {
|
|
288
|
+
name: entity.name,
|
|
289
|
+
provider: repo.provider.constructor.name,
|
|
290
|
+
columns,
|
|
291
|
+
indexes,
|
|
292
|
+
foreignKeys,
|
|
293
|
+
constraints,
|
|
294
|
+
};
|
|
295
|
+
});
|
|
296
|
+
} catch {
|
|
297
|
+
// RepositoryProvider not available (ORM not used)
|
|
298
|
+
return [];
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
protected getColumnType(field: TSchema): string {
|
|
303
|
+
// Handle optional/nullable wrappers (unions with null)
|
|
304
|
+
if (t.schema.isUnion(field) && (field as any).anyOf) {
|
|
305
|
+
const types = (field as any).anyOf as TSchema[];
|
|
306
|
+
const nonNull = types.find((type) => !t.schema.isNull(type));
|
|
307
|
+
if (nonNull) {
|
|
308
|
+
return this.getColumnType(nonNull);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const f = field as any;
|
|
313
|
+
|
|
314
|
+
// Check for enum (t.enum wraps in Unsafe with type=string and enum array)
|
|
315
|
+
if (
|
|
316
|
+
t.schema.isUnsafe(field) &&
|
|
317
|
+
f.type === "string" &&
|
|
318
|
+
Array.isArray(f.enum)
|
|
319
|
+
) {
|
|
320
|
+
return "enum";
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// Use TypeBox's type guards
|
|
324
|
+
if (t.schema.isString(field)) {
|
|
325
|
+
if (f.enum) return "enum";
|
|
326
|
+
if (f.format === "uuid") return "uuid";
|
|
327
|
+
if (f.format === "date-time") return "datetime";
|
|
328
|
+
if (f.format === "date") return "date";
|
|
329
|
+
if (f.format === "bigint") return "bigint";
|
|
330
|
+
return "text";
|
|
331
|
+
}
|
|
332
|
+
if (t.schema.isInteger(field)) return "integer";
|
|
333
|
+
if (t.schema.isNumber(field)) return "number";
|
|
334
|
+
if (t.schema.isBoolean(field)) return "boolean";
|
|
335
|
+
if (t.schema.isArray(field)) return "array";
|
|
336
|
+
if (t.schema.isObject(field)) return "json";
|
|
337
|
+
if (t.schema.isLiteral(field)) return "literal";
|
|
338
|
+
|
|
339
|
+
return "unknown";
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
protected isNullable(field: TSchema): boolean {
|
|
343
|
+
if (t.schema.isUnion(field) && (field as any).anyOf) {
|
|
344
|
+
const types = (field as any).anyOf as TSchema[];
|
|
345
|
+
return types.some((type) => t.schema.isNull(type));
|
|
346
|
+
}
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
public getCommands(): DevCommandMetadata[] {
|
|
351
|
+
const commandPrimitives = this.alepha.primitives($command);
|
|
352
|
+
|
|
353
|
+
return commandPrimitives
|
|
354
|
+
.filter((cmd) => !cmd.options.hide)
|
|
355
|
+
.map((command) => ({
|
|
356
|
+
name: command.name,
|
|
357
|
+
description: command.options.description,
|
|
358
|
+
hidden: command.options.hide,
|
|
359
|
+
}));
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
public getRoutes(): DevRouteMetadata[] {
|
|
363
|
+
// Routes are the base primitive - actions and pages are routes
|
|
364
|
+
// Showing them separately would be redundant with actions
|
|
365
|
+
return [];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
public getEnvs(): DevEnvMetadata[] {
|
|
369
|
+
const envSchemas = this.alepha.getEnvSchemas();
|
|
370
|
+
|
|
371
|
+
return envSchemas.map((item, index) => ({
|
|
372
|
+
propertyKey: `env_${index}`,
|
|
373
|
+
schema: item.schema,
|
|
374
|
+
values: item.values,
|
|
375
|
+
serviceName: undefined,
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
public getAtoms(): DevAtomMetadata[] {
|
|
380
|
+
const atomsWithValues = this.alepha.store.getAtoms(false);
|
|
381
|
+
|
|
382
|
+
return atomsWithValues.map(({ atom, value }) => ({
|
|
383
|
+
name: atom.key,
|
|
384
|
+
description: atom.options.description,
|
|
385
|
+
schema: atom.schema,
|
|
386
|
+
defaultValue: atom.options.default,
|
|
387
|
+
currentValue: value,
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
|
|
188
391
|
public getMetadata(): DevMetadata {
|
|
189
392
|
return {
|
|
190
393
|
actions: this.getActions(),
|
|
@@ -197,6 +400,11 @@ export class DevToolsMetadataProvider {
|
|
|
197
400
|
pages: this.getPages(),
|
|
198
401
|
providers: this.getProviders(),
|
|
199
402
|
modules: this.getModules(),
|
|
403
|
+
entities: this.getEntities(),
|
|
404
|
+
commands: this.getCommands(),
|
|
405
|
+
routes: this.getRoutes(),
|
|
406
|
+
envs: this.getEnvs(),
|
|
407
|
+
atoms: this.getAtoms(),
|
|
200
408
|
};
|
|
201
409
|
}
|
|
202
410
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Static, t } from "alepha";
|
|
2
|
+
|
|
3
|
+
export const devAtomMetadataSchema = t.object({
|
|
4
|
+
/**
|
|
5
|
+
* The unique name/key of the atom
|
|
6
|
+
*/
|
|
7
|
+
name: t.text(),
|
|
8
|
+
/**
|
|
9
|
+
* Optional description of the atom
|
|
10
|
+
*/
|
|
11
|
+
description: t.optional(t.text()),
|
|
12
|
+
/**
|
|
13
|
+
* The schema for the atom value (TypeBox/JSON Schema)
|
|
14
|
+
*/
|
|
15
|
+
schema: t.any(),
|
|
16
|
+
/**
|
|
17
|
+
* The default value defined for the atom
|
|
18
|
+
*/
|
|
19
|
+
defaultValue: t.optional(t.any()),
|
|
20
|
+
/**
|
|
21
|
+
* The current value of the atom
|
|
22
|
+
*/
|
|
23
|
+
currentValue: t.optional(t.any()),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export type DevAtomMetadata = Static<typeof devAtomMetadataSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Static, t } from "alepha";
|
|
2
|
+
|
|
3
|
+
export const devCommandMetadataSchema = t.object({
|
|
4
|
+
name: t.text(),
|
|
5
|
+
description: t.optional(t.text()),
|
|
6
|
+
hidden: t.optional(t.boolean()),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type DevCommandMetadata = Static<typeof devCommandMetadataSchema>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Static, t } from "alepha";
|
|
2
|
+
|
|
3
|
+
export const devEntityColumnSchema = t.object({
|
|
4
|
+
name: t.text(),
|
|
5
|
+
type: t.text(),
|
|
6
|
+
nullable: t.boolean(),
|
|
7
|
+
primaryKey: t.boolean(),
|
|
8
|
+
identity: t.boolean(),
|
|
9
|
+
createdAt: t.boolean(),
|
|
10
|
+
updatedAt: t.boolean(),
|
|
11
|
+
deletedAt: t.boolean(),
|
|
12
|
+
version: t.boolean(),
|
|
13
|
+
hasDefault: t.boolean(),
|
|
14
|
+
ref: t.optional(
|
|
15
|
+
t.object({
|
|
16
|
+
entity: t.text(),
|
|
17
|
+
column: t.text(),
|
|
18
|
+
onUpdate: t.optional(t.text()),
|
|
19
|
+
onDelete: t.optional(t.text()),
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const devEntityIndexSchema = t.object({
|
|
25
|
+
name: t.optional(t.text()),
|
|
26
|
+
columns: t.array(t.text()),
|
|
27
|
+
unique: t.boolean(),
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const devEntityForeignKeySchema = t.object({
|
|
31
|
+
name: t.optional(t.text()),
|
|
32
|
+
columns: t.array(t.text()),
|
|
33
|
+
foreignEntity: t.text(),
|
|
34
|
+
foreignColumns: t.array(t.text()),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const devEntityConstraintSchema = t.object({
|
|
38
|
+
name: t.optional(t.text()),
|
|
39
|
+
columns: t.array(t.text()),
|
|
40
|
+
unique: t.boolean(),
|
|
41
|
+
hasCheck: t.boolean(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const devEntityMetadataSchema = t.object({
|
|
45
|
+
name: t.text(),
|
|
46
|
+
provider: t.text(),
|
|
47
|
+
columns: t.array(devEntityColumnSchema),
|
|
48
|
+
indexes: t.array(devEntityIndexSchema),
|
|
49
|
+
foreignKeys: t.array(devEntityForeignKeySchema),
|
|
50
|
+
constraints: t.array(devEntityConstraintSchema),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export type DevEntityColumn = Static<typeof devEntityColumnSchema>;
|
|
54
|
+
export type DevEntityIndex = Static<typeof devEntityIndexSchema>;
|
|
55
|
+
export type DevEntityForeignKey = Static<typeof devEntityForeignKeySchema>;
|
|
56
|
+
export type DevEntityConstraint = Static<typeof devEntityConstraintSchema>;
|
|
57
|
+
export type DevEntityMetadata = Static<typeof devEntityMetadataSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Static, t } from "alepha";
|
|
2
|
+
|
|
3
|
+
export const devEnvMetadataSchema = t.object({
|
|
4
|
+
/**
|
|
5
|
+
* The property name in the service where $env is defined
|
|
6
|
+
*/
|
|
7
|
+
propertyKey: t.text(),
|
|
8
|
+
/**
|
|
9
|
+
* The schema for the environment variables (TypeBox/JSON Schema)
|
|
10
|
+
*/
|
|
11
|
+
schema: t.any(),
|
|
12
|
+
/**
|
|
13
|
+
* The parsed values from the environment
|
|
14
|
+
*/
|
|
15
|
+
values: t.record(t.text(), t.any()),
|
|
16
|
+
/**
|
|
17
|
+
* The service class name where this $env is defined
|
|
18
|
+
*/
|
|
19
|
+
serviceName: t.optional(t.text()),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export type DevEnvMetadata = Static<typeof devEnvMetadataSchema>;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { type Static, t } from "alepha";
|
|
2
2
|
import { devActionMetadataSchema } from "./DevActionMetadata.ts";
|
|
3
|
+
import { devAtomMetadataSchema } from "./DevAtomMetadata.ts";
|
|
3
4
|
import { devBucketMetadataSchema } from "./DevBucketMetadata.ts";
|
|
4
5
|
import { devCacheMetadataSchema } from "./DevCacheMetadata.ts";
|
|
6
|
+
import { devCommandMetadataSchema } from "./DevCommandMetadata.ts";
|
|
7
|
+
import { devEntityMetadataSchema } from "./DevEntityMetadata.ts";
|
|
8
|
+
import { devEnvMetadataSchema } from "./DevEnvMetadata.ts";
|
|
5
9
|
import { devModuleMetadataSchema } from "./DevModuleMetadata.ts";
|
|
6
10
|
import { devPageMetadataSchema } from "./DevPageMetadata.ts";
|
|
7
11
|
import { devProviderMetadataSchema } from "./DevProviderMetadata.ts";
|
|
8
12
|
import { devQueueMetadataSchema } from "./DevQueueMetadata.ts";
|
|
9
13
|
import { devRealmMetadataSchema } from "./DevRealmMetadata.ts";
|
|
14
|
+
import { devRouteMetadataSchema } from "./DevRouteMetadata.ts";
|
|
10
15
|
import { devSchedulerMetadataSchema } from "./DevSchedulerMetadata.ts";
|
|
11
16
|
import { devTopicMetadataSchema } from "./DevTopicMetadata.ts";
|
|
12
17
|
|
|
@@ -21,7 +26,11 @@ export const devMetadataSchema = t.object({
|
|
|
21
26
|
pages: t.array(devPageMetadataSchema),
|
|
22
27
|
providers: t.array(devProviderMetadataSchema),
|
|
23
28
|
modules: t.array(devModuleMetadataSchema),
|
|
24
|
-
|
|
29
|
+
entities: t.array(devEntityMetadataSchema),
|
|
30
|
+
commands: t.array(devCommandMetadataSchema),
|
|
31
|
+
routes: t.array(devRouteMetadataSchema),
|
|
32
|
+
envs: t.array(devEnvMetadataSchema),
|
|
33
|
+
atoms: t.array(devAtomMetadataSchema),
|
|
25
34
|
});
|
|
26
35
|
|
|
27
36
|
export type DevMetadata = Static<typeof devMetadataSchema>;
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { $module } from "alepha";
|
|
2
|
-
import { DevToolsProvider } from "./DevToolsProvider.ts";
|
|
3
|
-
import { DevToolsDatabaseProvider } from "./providers/DevToolsDatabaseProvider.ts";
|
|
4
|
-
import { DevToolsMetadataProvider } from "./providers/DevToolsMetadataProvider.ts";
|
|
5
|
-
import { LogRepository } from "./repositories/LogRepository.ts";
|
|
2
|
+
import { DevToolsProvider } from "./api/DevToolsProvider.ts";
|
|
3
|
+
import { DevToolsDatabaseProvider } from "./api/providers/DevToolsDatabaseProvider.ts";
|
|
4
|
+
import { DevToolsMetadataProvider } from "./api/providers/DevToolsMetadataProvider.ts";
|
|
5
|
+
import { LogRepository } from "./api/repositories/LogRepository.ts";
|
|
6
6
|
|
|
7
7
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
8
8
|
|
|
9
|
-
export * from "./providers/DevToolsMetadataProvider.ts";
|
|
10
|
-
export * from "./schemas/DevActionMetadata.ts";
|
|
11
|
-
export * from "./schemas/DevBucketMetadata.ts";
|
|
12
|
-
export * from "./schemas/DevCacheMetadata.ts";
|
|
13
|
-
export * from "./schemas/
|
|
14
|
-
export * from "./schemas/
|
|
15
|
-
export * from "./schemas/
|
|
16
|
-
export * from "./schemas/
|
|
17
|
-
export * from "./schemas/
|
|
18
|
-
export * from "./schemas/
|
|
19
|
-
export * from "./schemas/
|
|
20
|
-
export * from "./schemas/
|
|
9
|
+
export * from "./api/providers/DevToolsMetadataProvider.ts";
|
|
10
|
+
export * from "./api/schemas/DevActionMetadata.ts";
|
|
11
|
+
export * from "./api/schemas/DevBucketMetadata.ts";
|
|
12
|
+
export * from "./api/schemas/DevCacheMetadata.ts";
|
|
13
|
+
export * from "./api/schemas/DevCommandMetadata.ts";
|
|
14
|
+
export * from "./api/schemas/DevEntityMetadata.ts";
|
|
15
|
+
export * from "./api/schemas/DevMetadata.ts";
|
|
16
|
+
export * from "./api/schemas/DevModuleMetadata.ts";
|
|
17
|
+
export * from "./api/schemas/DevPageMetadata.ts";
|
|
18
|
+
export * from "./api/schemas/DevProviderMetadata.ts";
|
|
19
|
+
export * from "./api/schemas/DevQueueMetadata.ts";
|
|
20
|
+
export * from "./api/schemas/DevRealmMetadata.ts";
|
|
21
|
+
export * from "./api/schemas/DevRouteMetadata.ts";
|
|
22
|
+
export * from "./api/schemas/DevSchedulerMetadata.ts";
|
|
23
|
+
export * from "./api/schemas/DevTopicMetadata.ts";
|
|
21
24
|
|
|
22
25
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
23
26
|
|
|
@@ -40,6 +43,10 @@ export const AlephaDevtools = $module({
|
|
|
40
43
|
LogRepository,
|
|
41
44
|
],
|
|
42
45
|
register: (alepha) => {
|
|
46
|
+
if (!alepha.isViteDev()) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
43
50
|
alepha.with(DevToolsProvider);
|
|
44
51
|
alepha.with(DevToolsDatabaseProvider);
|
|
45
52
|
alepha.with(DevToolsMetadataProvider);
|
package/src/ui/AppRouter.tsx
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { $page } from "@alepha/react";
|
|
2
2
|
import { RootRouter } from "@alepha/ui";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
IconApi,
|
|
5
|
+
IconArchive,
|
|
6
|
+
IconAtom,
|
|
7
|
+
IconDashboard,
|
|
8
|
+
IconDatabase,
|
|
9
|
+
IconLogs,
|
|
10
|
+
IconMessageCircle,
|
|
11
|
+
IconStack2,
|
|
12
|
+
IconTopologyRing,
|
|
13
|
+
IconVariable,
|
|
14
|
+
} from "@tabler/icons-react";
|
|
4
15
|
|
|
5
16
|
export class AppRouter extends RootRouter {
|
|
6
17
|
layout = $page({
|
|
@@ -14,7 +25,79 @@ export class AppRouter extends RootRouter {
|
|
|
14
25
|
icon: <IconDashboard />,
|
|
15
26
|
static: true,
|
|
16
27
|
parent: this.layout,
|
|
17
|
-
|
|
28
|
+
lazy: () => import("./components/DevDashboard.tsx"),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
actions = $page({
|
|
32
|
+
path: "/actions",
|
|
33
|
+
label: "Actions",
|
|
34
|
+
icon: <IconApi />,
|
|
35
|
+
static: true,
|
|
36
|
+
parent: this.layout,
|
|
37
|
+
lazy: () => import("./components/actions/DevActionsExplorer.tsx"),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
queues = $page({
|
|
41
|
+
path: "/queues",
|
|
42
|
+
label: "Queues",
|
|
43
|
+
icon: <IconStack2 />,
|
|
44
|
+
static: true,
|
|
45
|
+
parent: this.layout,
|
|
46
|
+
lazy: () => import("./components/DevQueueMonitor.tsx"),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
topics = $page({
|
|
50
|
+
path: "/topics",
|
|
51
|
+
label: "Topics",
|
|
52
|
+
icon: <IconMessageCircle />,
|
|
53
|
+
static: true,
|
|
54
|
+
parent: this.layout,
|
|
55
|
+
lazy: () => import("./components/DevTopicsViewer.tsx"),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
caches = $page({
|
|
59
|
+
path: "/caches",
|
|
60
|
+
label: "Caches",
|
|
61
|
+
icon: <IconArchive />,
|
|
62
|
+
static: true,
|
|
63
|
+
parent: this.layout,
|
|
64
|
+
lazy: () => import("./components/DevCacheInspector.tsx"),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
env = $page({
|
|
68
|
+
path: "/env",
|
|
69
|
+
label: "Environment",
|
|
70
|
+
icon: <IconVariable />,
|
|
71
|
+
static: true,
|
|
72
|
+
parent: this.layout,
|
|
73
|
+
lazy: () => import("./components/DevEnvExplorer.tsx"),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
atoms = $page({
|
|
77
|
+
path: "/atoms",
|
|
78
|
+
label: "Atoms",
|
|
79
|
+
icon: <IconAtom />,
|
|
80
|
+
static: true,
|
|
81
|
+
parent: this.layout,
|
|
82
|
+
lazy: () => import("./components/DevAtomsViewer.tsx"),
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
db = $page({
|
|
86
|
+
path: "/db",
|
|
87
|
+
label: "DB Studio",
|
|
88
|
+
icon: <IconDatabase />,
|
|
89
|
+
static: true,
|
|
90
|
+
parent: this.layout,
|
|
91
|
+
lazy: () => import("./components/db/DevDbStudio.tsx"),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
graph = $page({
|
|
95
|
+
path: "/graph",
|
|
96
|
+
label: "Graph",
|
|
97
|
+
icon: <IconTopologyRing />,
|
|
98
|
+
static: true,
|
|
99
|
+
parent: this.layout,
|
|
100
|
+
lazy: () => import("./components/graph/DevDependencyGraph.tsx"),
|
|
18
101
|
});
|
|
19
102
|
|
|
20
103
|
logs = $page({
|