@xpert-ai/plugin-live-dashboard 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/.xpertai-plugin/plugin.json +1 -1
- package/dist/lib/dashboard-view.schema.d.ts +81 -0
- package/dist/lib/dashboard-view.schema.js +2 -1
- package/dist/lib/dashboard.service.d.ts +12 -3
- package/dist/lib/dashboard.service.js +13 -1
- package/dist/lib/projects.schema.d.ts +14 -0
- package/dist/lib/projects.schema.js +2 -1
- package/dist/lib/projects.service.d.ts +2 -0
- package/dist/lib/projects.service.js +10 -0
- package/dist/lib/view.provider.d.ts +33 -4
- package/dist/lib/view.provider.js +13 -5
- package/dist/remote/app.css +1 -1
- package/dist/remote/app.js +20 -20
- package/dist/remote/build-manifest.json +16 -15
- package/package.json +1 -1
|
@@ -64,7 +64,10 @@ export declare const dashboardPickerPageSchema: z.ZodObject<{
|
|
|
64
64
|
}>, "many">;
|
|
65
65
|
page: z.ZodNumber;
|
|
66
66
|
hasMore: z.ZodBoolean;
|
|
67
|
+
canEdit: z.ZodDefault<z.ZodBoolean>;
|
|
68
|
+
mode: z.ZodOptional<z.ZodEnum<["draft", "published"]>>;
|
|
67
69
|
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
canEdit: boolean;
|
|
68
71
|
page: number;
|
|
69
72
|
items: {
|
|
70
73
|
artifactId: string;
|
|
@@ -78,6 +81,7 @@ export declare const dashboardPickerPageSchema: z.ZodObject<{
|
|
|
78
81
|
canDelete?: boolean | undefined;
|
|
79
82
|
}[];
|
|
80
83
|
hasMore: boolean;
|
|
84
|
+
mode?: "draft" | "published" | undefined;
|
|
81
85
|
}, {
|
|
82
86
|
page: number;
|
|
83
87
|
items: {
|
|
@@ -92,6 +96,8 @@ export declare const dashboardPickerPageSchema: z.ZodObject<{
|
|
|
92
96
|
canDelete?: boolean | undefined;
|
|
93
97
|
}[];
|
|
94
98
|
hasMore: boolean;
|
|
99
|
+
mode?: "draft" | "published" | undefined;
|
|
100
|
+
canEdit?: boolean | undefined;
|
|
95
101
|
}>;
|
|
96
102
|
export declare const dashboardSavedSchema: z.ZodObject<{
|
|
97
103
|
artifactId: z.ZodString;
|
|
@@ -578,6 +584,37 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
|
|
|
578
584
|
updatedAt?: string | undefined;
|
|
579
585
|
canDelete?: boolean | undefined;
|
|
580
586
|
}>, "many">;
|
|
587
|
+
selectedDashboard: z.ZodOptional<z.ZodObject<{
|
|
588
|
+
artifactId: z.ZodString;
|
|
589
|
+
versionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
590
|
+
versionNumber: z.ZodOptional<z.ZodNumber>;
|
|
591
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
592
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
593
|
+
draftRevision: z.ZodOptional<z.ZodNumber>;
|
|
594
|
+
canDelete: z.ZodOptional<z.ZodBoolean>;
|
|
595
|
+
isDraft: z.ZodOptional<z.ZodBoolean>;
|
|
596
|
+
baseVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
597
|
+
}, "strip", z.ZodTypeAny, {
|
|
598
|
+
artifactId: string;
|
|
599
|
+
title?: string | null | undefined;
|
|
600
|
+
versionId?: string | null | undefined;
|
|
601
|
+
draftRevision?: number | undefined;
|
|
602
|
+
versionNumber?: number | undefined;
|
|
603
|
+
baseVersionId?: string | null | undefined;
|
|
604
|
+
isDraft?: boolean | undefined;
|
|
605
|
+
updatedAt?: string | undefined;
|
|
606
|
+
canDelete?: boolean | undefined;
|
|
607
|
+
}, {
|
|
608
|
+
artifactId: string;
|
|
609
|
+
title?: string | null | undefined;
|
|
610
|
+
versionId?: string | null | undefined;
|
|
611
|
+
draftRevision?: number | undefined;
|
|
612
|
+
versionNumber?: number | undefined;
|
|
613
|
+
baseVersionId?: string | null | undefined;
|
|
614
|
+
isDraft?: boolean | undefined;
|
|
615
|
+
updatedAt?: string | undefined;
|
|
616
|
+
canDelete?: boolean | undefined;
|
|
617
|
+
}>>;
|
|
581
618
|
sources: z.ZodArray<z.ZodObject<{
|
|
582
619
|
source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
|
|
583
620
|
name: z.ZodString;
|
|
@@ -1100,6 +1137,17 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
|
|
|
1100
1137
|
target: "workbench.view";
|
|
1101
1138
|
viewKey: "live-dashboard__live-dashboard";
|
|
1102
1139
|
} | undefined;
|
|
1140
|
+
selectedDashboard?: {
|
|
1141
|
+
artifactId: string;
|
|
1142
|
+
title?: string | null | undefined;
|
|
1143
|
+
versionId?: string | null | undefined;
|
|
1144
|
+
draftRevision?: number | undefined;
|
|
1145
|
+
versionNumber?: number | undefined;
|
|
1146
|
+
baseVersionId?: string | null | undefined;
|
|
1147
|
+
isDraft?: boolean | undefined;
|
|
1148
|
+
updatedAt?: string | undefined;
|
|
1149
|
+
canDelete?: boolean | undefined;
|
|
1150
|
+
} | undefined;
|
|
1103
1151
|
versions?: {
|
|
1104
1152
|
artifactId: string;
|
|
1105
1153
|
title?: string | null | undefined;
|
|
@@ -1207,6 +1255,17 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
|
|
|
1207
1255
|
target: "workbench.view";
|
|
1208
1256
|
viewKey: "live-dashboard__live-dashboard";
|
|
1209
1257
|
} | undefined;
|
|
1258
|
+
selectedDashboard?: {
|
|
1259
|
+
artifactId: string;
|
|
1260
|
+
title?: string | null | undefined;
|
|
1261
|
+
versionId?: string | null | undefined;
|
|
1262
|
+
draftRevision?: number | undefined;
|
|
1263
|
+
versionNumber?: number | undefined;
|
|
1264
|
+
baseVersionId?: string | null | undefined;
|
|
1265
|
+
isDraft?: boolean | undefined;
|
|
1266
|
+
updatedAt?: string | undefined;
|
|
1267
|
+
canDelete?: boolean | undefined;
|
|
1268
|
+
} | undefined;
|
|
1210
1269
|
versions?: {
|
|
1211
1270
|
artifactId: string;
|
|
1212
1271
|
title?: string | null | undefined;
|
|
@@ -1303,6 +1362,17 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
|
|
|
1303
1362
|
target: "workbench.view";
|
|
1304
1363
|
viewKey: "live-dashboard__live-dashboard";
|
|
1305
1364
|
} | undefined;
|
|
1365
|
+
selectedDashboard?: {
|
|
1366
|
+
artifactId: string;
|
|
1367
|
+
title?: string | null | undefined;
|
|
1368
|
+
versionId?: string | null | undefined;
|
|
1369
|
+
draftRevision?: number | undefined;
|
|
1370
|
+
versionNumber?: number | undefined;
|
|
1371
|
+
baseVersionId?: string | null | undefined;
|
|
1372
|
+
isDraft?: boolean | undefined;
|
|
1373
|
+
updatedAt?: string | undefined;
|
|
1374
|
+
canDelete?: boolean | undefined;
|
|
1375
|
+
} | undefined;
|
|
1306
1376
|
versions?: {
|
|
1307
1377
|
artifactId: string;
|
|
1308
1378
|
title?: string | null | undefined;
|
|
@@ -1412,6 +1482,17 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
|
|
|
1412
1482
|
target: "workbench.view";
|
|
1413
1483
|
viewKey: "live-dashboard__live-dashboard";
|
|
1414
1484
|
} | undefined;
|
|
1485
|
+
selectedDashboard?: {
|
|
1486
|
+
artifactId: string;
|
|
1487
|
+
title?: string | null | undefined;
|
|
1488
|
+
versionId?: string | null | undefined;
|
|
1489
|
+
draftRevision?: number | undefined;
|
|
1490
|
+
versionNumber?: number | undefined;
|
|
1491
|
+
baseVersionId?: string | null | undefined;
|
|
1492
|
+
isDraft?: boolean | undefined;
|
|
1493
|
+
updatedAt?: string | undefined;
|
|
1494
|
+
canDelete?: boolean | undefined;
|
|
1495
|
+
} | undefined;
|
|
1415
1496
|
versions?: {
|
|
1416
1497
|
artifactId: string;
|
|
1417
1498
|
title?: string | null | undefined;
|
|
@@ -8,7 +8,7 @@ const projects_schema_1 = require("./projects.schema");
|
|
|
8
8
|
const dashboard_schema_1 = require("./dashboard.schema");
|
|
9
9
|
const dashboard_navigation_1 = require("./dashboard-navigation");
|
|
10
10
|
exports.dashboardSummarySchema = v3_1.z.object({ artifactId: v3_1.z.string(), versionId: v3_1.z.string().nullish(), versionNumber: v3_1.z.number().optional(), title: v3_1.z.string().nullish(), updatedAt: v3_1.z.string().optional(), draftRevision: v3_1.z.number().optional(), canDelete: v3_1.z.boolean().optional(), isDraft: v3_1.z.boolean().optional(), baseVersionId: v3_1.z.string().nullish() });
|
|
11
|
-
exports.dashboardPickerPageSchema = v3_1.z.object({ items: v3_1.z.array(exports.dashboardSummarySchema), page: v3_1.z.number().int().positive(), hasMore: v3_1.z.boolean() });
|
|
11
|
+
exports.dashboardPickerPageSchema = v3_1.z.object({ items: v3_1.z.array(exports.dashboardSummarySchema), page: v3_1.z.number().int().positive(), hasMore: v3_1.z.boolean(), canEdit: v3_1.z.boolean().default(false), mode: v3_1.z.enum(['draft', 'published']).optional() });
|
|
12
12
|
exports.dashboardSavedSchema = exports.dashboardSummarySchema.extend({ manifest: dashboard_schema_1.dashboardSchema, dependencies: artifact_document_1.artifactDocumentDependencyAssets.optional() });
|
|
13
13
|
// Source identities belong to Analytics, including immutable Definitions and Artifacts.
|
|
14
14
|
// The viewer consumes only the reference and label; DataSource fields are not universal.
|
|
@@ -20,6 +20,7 @@ exports.dashboardViewDataSchema = v3_1.z.object({ meta: v3_1.z.object({
|
|
|
20
20
|
pagination: v3_1.z.object({ page: v3_1.z.number(), pageSize: v3_1.z.number(), hasMore: v3_1.z.boolean() }).optional(),
|
|
21
21
|
navigationTarget: dashboard_navigation_1.dashboardNavigationTargetSchema.optional(),
|
|
22
22
|
dashboards: v3_1.z.array(exports.dashboardSummarySchema),
|
|
23
|
+
selectedDashboard: exports.dashboardSummarySchema.optional(),
|
|
23
24
|
sources: v3_1.z.array(v3_1.z.object({ source: analytics_1.analyticsSourceRefSchema, name: v3_1.z.string() })),
|
|
24
25
|
saved: exports.dashboardSavedSchema.optional(),
|
|
25
26
|
versions: v3_1.z.array(exports.dashboardSummarySchema).optional()
|
|
@@ -14,11 +14,11 @@ export declare class DashboardService {
|
|
|
14
14
|
list(context: XpertResolvedViewHostContext): Promise<{
|
|
15
15
|
title: string | null | undefined;
|
|
16
16
|
draftRevision?: number | undefined;
|
|
17
|
+
updatedAt: string | Date | undefined;
|
|
17
18
|
canDelete: boolean;
|
|
18
19
|
artifactId: string;
|
|
19
20
|
versionId: string | null | undefined;
|
|
20
21
|
versionNumber: number | undefined;
|
|
21
|
-
updatedAt: string | Date | undefined;
|
|
22
22
|
}[]>;
|
|
23
23
|
access(context: XpertResolvedViewHostContext): Promise<DashboardAccess>;
|
|
24
24
|
listPage(context: XpertResolvedViewHostContext, page?: number, pageSize?: number): Promise<{
|
|
@@ -28,11 +28,11 @@ export declare class DashboardService {
|
|
|
28
28
|
items: {
|
|
29
29
|
title: string | null | undefined;
|
|
30
30
|
draftRevision?: number | undefined;
|
|
31
|
+
updatedAt: string | Date | undefined;
|
|
31
32
|
canDelete: boolean;
|
|
32
33
|
artifactId: string;
|
|
33
34
|
versionId: string | null | undefined;
|
|
34
35
|
versionNumber: number | undefined;
|
|
35
|
-
updatedAt: string | Date | undefined;
|
|
36
36
|
}[];
|
|
37
37
|
}>;
|
|
38
38
|
searchPage(context: XpertResolvedViewHostContext, input: {
|
|
@@ -42,15 +42,24 @@ export declare class DashboardService {
|
|
|
42
42
|
items: {
|
|
43
43
|
title: string | null | undefined;
|
|
44
44
|
draftRevision?: number | undefined;
|
|
45
|
+
updatedAt: string | Date | undefined;
|
|
45
46
|
canDelete: boolean;
|
|
46
47
|
artifactId: string;
|
|
47
48
|
versionId: string | null | undefined;
|
|
48
49
|
versionNumber: number | undefined;
|
|
49
|
-
updatedAt: string | Date | undefined;
|
|
50
50
|
}[];
|
|
51
51
|
page: number;
|
|
52
52
|
hasMore: boolean;
|
|
53
53
|
}>;
|
|
54
|
+
selectedSummary(context: XpertResolvedViewHostContext, artifactId: string): Promise<{
|
|
55
|
+
title: string | null | undefined;
|
|
56
|
+
draftRevision?: number | undefined;
|
|
57
|
+
canDelete: boolean;
|
|
58
|
+
artifactId: string;
|
|
59
|
+
versionId: string | null | undefined;
|
|
60
|
+
versionNumber: number | undefined;
|
|
61
|
+
updatedAt: string | Date | undefined;
|
|
62
|
+
} | undefined>;
|
|
54
63
|
trash(context: XpertResolvedViewHostContext, artifactId: string, expectedRevision: number): Promise<{
|
|
55
64
|
artifactId: string;
|
|
56
65
|
}>;
|
|
@@ -59,7 +59,7 @@ let DashboardService = class DashboardService {
|
|
|
59
59
|
return { page, pageSize, hasMore: page * pageSize < result.total, items: items.filter(item => access.canReadDraft || !!item.currentVersionId).map(item => {
|
|
60
60
|
const draft = drafts.get(item.id);
|
|
61
61
|
return { ...summary(item), canDelete: !!draft && access.canManage,
|
|
62
|
-
...(draft ? { title: draft.title ?? item.title, draftRevision: draft.revision } : {}) };
|
|
62
|
+
...(draft ? { title: draft.title ?? item.title, draftRevision: draft.revision, updatedAt: draft.updatedAt ?? item.updatedAt } : {}) };
|
|
63
63
|
}) };
|
|
64
64
|
}
|
|
65
65
|
async searchPage(context, input) {
|
|
@@ -76,6 +76,18 @@ let DashboardService = class DashboardService {
|
|
|
76
76
|
}
|
|
77
77
|
return { items: matches.slice(offset, offset + pageSize), page: input.page, hasMore: matches.length > offset + pageSize };
|
|
78
78
|
}
|
|
79
|
+
async selectedSummary(context, artifactId) {
|
|
80
|
+
const access = await this.access(context);
|
|
81
|
+
const artifact = await this.runtime.require(plugin_sdk_1.ArtifactsRuntimeCapability).getArtifact(artifactId);
|
|
82
|
+
assertOwned(context, artifact);
|
|
83
|
+
if (artifact.status !== 'active')
|
|
84
|
+
throw new common_1.ForbiddenException('DASHBOARD_ARCHIVED');
|
|
85
|
+
if (!access.canReadDraft && !artifact.currentVersionId)
|
|
86
|
+
return undefined;
|
|
87
|
+
const draft = access.canReadDraft ? (await this.runtime.require(plugin_sdk_1.ArtifactDraftsRuntimeCapability).list([artifactId]))[0] : undefined;
|
|
88
|
+
return { ...summary(artifact), canDelete: !!draft && access.canManage,
|
|
89
|
+
...(draft ? { title: draft.title ?? artifact.title, draftRevision: draft.revision } : {}) };
|
|
90
|
+
}
|
|
79
91
|
async trash(context, artifactId, expectedRevision) {
|
|
80
92
|
await this.authorizeProject(context, 'manage');
|
|
81
93
|
const artifact = await this.runtime.require(plugin_sdk_1.ArtifactsRuntimeCapability).getArtifact(artifactId);
|
|
@@ -9,6 +9,20 @@ export declare const projectSearchSchema: z.ZodObject<{
|
|
|
9
9
|
search?: string | undefined;
|
|
10
10
|
page?: number | undefined;
|
|
11
11
|
}>;
|
|
12
|
+
export declare const dashboardSearchSchema: z.ZodObject<{
|
|
13
|
+
search: z.ZodDefault<z.ZodString>;
|
|
14
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
15
|
+
} & {
|
|
16
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strict", z.ZodTypeAny, {
|
|
18
|
+
search: string;
|
|
19
|
+
page: number;
|
|
20
|
+
projectId?: string | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
search?: string | undefined;
|
|
23
|
+
page?: number | undefined;
|
|
24
|
+
projectId?: string | undefined;
|
|
25
|
+
}>;
|
|
12
26
|
export declare const dashboardProjectSchema: z.ZodObject<{
|
|
13
27
|
id: z.ZodString;
|
|
14
28
|
name: z.ZodString;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dashboardProjectsSchema = exports.dashboardProjectSchema = exports.projectSearchSchema = void 0;
|
|
3
|
+
exports.dashboardProjectsSchema = exports.dashboardProjectSchema = exports.dashboardSearchSchema = exports.projectSearchSchema = void 0;
|
|
4
4
|
const v3_1 = require("zod/v3");
|
|
5
5
|
exports.projectSearchSchema = v3_1.z.object({ search: v3_1.z.string().trim().max(200).default(''), page: v3_1.z.number().int().positive().default(1) }).strict();
|
|
6
|
+
exports.dashboardSearchSchema = exports.projectSearchSchema.extend({ projectId: v3_1.z.string().uuid().optional() });
|
|
6
7
|
exports.dashboardProjectSchema = v3_1.z.object({ id: v3_1.z.string().uuid(), name: v3_1.z.string() });
|
|
7
8
|
exports.dashboardProjectsSchema = v3_1.z.object({ items: v3_1.z.array(exports.dashboardProjectSchema), page: v3_1.z.number().int().positive(), hasMore: v3_1.z.boolean() });
|
|
@@ -12,6 +12,8 @@ export declare class DashboardProjectsService {
|
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
14
14
|
} | null>;
|
|
15
|
+
/** A picker target is untrusted until membership and the Assistant binding are revalidated. */
|
|
16
|
+
pickerContext(context: XpertResolvedViewHostContext, targetProjectId: string): Promise<XpertResolvedViewHostContext>;
|
|
15
17
|
list(context: XpertResolvedViewHostContext, input: z.infer<typeof projectSearchSchema>): Promise<{
|
|
16
18
|
items: {
|
|
17
19
|
id: string;
|
|
@@ -35,6 +35,16 @@ let DashboardProjectsService = class DashboardProjectsService {
|
|
|
35
35
|
const access = await this.runtime.require(plugin_sdk_1.ProjectAccessRuntimeCapability).assertAssistant({ actor: this.actor(context), projectId: id, assistantId: context.hostId });
|
|
36
36
|
return { id, name: access.name ?? id };
|
|
37
37
|
}
|
|
38
|
+
/** A picker target is untrusted until membership and the Assistant binding are revalidated. */
|
|
39
|
+
async pickerContext(context, targetProjectId) {
|
|
40
|
+
const access = await this.runtime.require(plugin_sdk_1.ProjectAccessRuntimeCapability).assertAssistant({
|
|
41
|
+
actor: this.actor(context), projectId: targetProjectId, assistantId: context.hostId
|
|
42
|
+
});
|
|
43
|
+
if (access.archived || access.projectId !== targetProjectId)
|
|
44
|
+
throw new common_1.ForbiddenException('DASHBOARD_ACCESS_DENIED');
|
|
45
|
+
// Domain reads/deletes accept a Project host. Do not fabricate file/conversation grants.
|
|
46
|
+
return { ...context, hostType: 'project', hostId: access.projectId, runtimeScope: undefined };
|
|
47
|
+
}
|
|
38
48
|
async list(context, input) {
|
|
39
49
|
const actor = this.actor(context), access = this.runtime.require(plugin_sdk_1.ProjectAccessRuntimeCapability);
|
|
40
50
|
const projects = await access.listReadable({ actor });
|
|
@@ -33,12 +33,21 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
33
33
|
dashboards: {
|
|
34
34
|
title: string | null | undefined;
|
|
35
35
|
draftRevision?: number | undefined;
|
|
36
|
+
updatedAt: string | Date | undefined;
|
|
36
37
|
canDelete: boolean;
|
|
37
38
|
artifactId: string;
|
|
38
39
|
versionId: string | null | undefined;
|
|
39
40
|
versionNumber: number | undefined;
|
|
40
|
-
updatedAt: string | Date | undefined;
|
|
41
41
|
}[];
|
|
42
|
+
selectedDashboard: {
|
|
43
|
+
title: string | null | undefined;
|
|
44
|
+
draftRevision?: number | undefined;
|
|
45
|
+
updatedAt: string | Date | undefined;
|
|
46
|
+
canDelete: boolean;
|
|
47
|
+
artifactId: string;
|
|
48
|
+
versionId: string | null | undefined;
|
|
49
|
+
versionNumber: number | undefined;
|
|
50
|
+
} | undefined;
|
|
42
51
|
pagination: {
|
|
43
52
|
page: number;
|
|
44
53
|
pageSize: number;
|
|
@@ -113,12 +122,21 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
113
122
|
dashboards: {
|
|
114
123
|
title: string | null | undefined;
|
|
115
124
|
draftRevision?: number | undefined;
|
|
125
|
+
updatedAt: string | Date | undefined;
|
|
116
126
|
canDelete: boolean;
|
|
117
127
|
artifactId: string;
|
|
118
128
|
versionId: string | null | undefined;
|
|
119
129
|
versionNumber: number | undefined;
|
|
120
|
-
updatedAt: string | Date | undefined;
|
|
121
130
|
}[];
|
|
131
|
+
selectedDashboard: {
|
|
132
|
+
title: string | null | undefined;
|
|
133
|
+
draftRevision?: number | undefined;
|
|
134
|
+
updatedAt: string | Date | undefined;
|
|
135
|
+
canDelete: boolean;
|
|
136
|
+
artifactId: string;
|
|
137
|
+
versionId: string | null | undefined;
|
|
138
|
+
versionNumber: number | undefined;
|
|
139
|
+
} | undefined;
|
|
122
140
|
pagination: {
|
|
123
141
|
page: number;
|
|
124
142
|
pageSize: number;
|
|
@@ -139,12 +157,21 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
139
157
|
dashboards: {
|
|
140
158
|
title: string | null | undefined;
|
|
141
159
|
draftRevision?: number | undefined;
|
|
160
|
+
updatedAt: string | Date | undefined;
|
|
142
161
|
canDelete: boolean;
|
|
143
162
|
artifactId: string;
|
|
144
163
|
versionId: string | null | undefined;
|
|
145
164
|
versionNumber: number | undefined;
|
|
146
|
-
updatedAt: string | Date | undefined;
|
|
147
165
|
}[];
|
|
166
|
+
selectedDashboard: {
|
|
167
|
+
title: string | null | undefined;
|
|
168
|
+
draftRevision?: number | undefined;
|
|
169
|
+
updatedAt: string | Date | undefined;
|
|
170
|
+
canDelete: boolean;
|
|
171
|
+
artifactId: string;
|
|
172
|
+
versionId: string | null | undefined;
|
|
173
|
+
versionNumber: number | undefined;
|
|
174
|
+
} | undefined;
|
|
148
175
|
pagination: {
|
|
149
176
|
page: number;
|
|
150
177
|
pageSize: number;
|
|
@@ -156,14 +183,16 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
156
183
|
executeViewAction(context: XpertResolvedViewHostContext, viewKey: string, action: string, request: XpertViewActionRequest): Promise<{
|
|
157
184
|
success: boolean;
|
|
158
185
|
data: {
|
|
186
|
+
canEdit: boolean;
|
|
187
|
+
mode: string;
|
|
159
188
|
items: {
|
|
160
189
|
title: string | null | undefined;
|
|
161
190
|
draftRevision?: number | undefined;
|
|
191
|
+
updatedAt: string | Date | undefined;
|
|
162
192
|
canDelete: boolean;
|
|
163
193
|
artifactId: string;
|
|
164
194
|
versionId: string | null | undefined;
|
|
165
195
|
versionNumber: number | undefined;
|
|
166
|
-
updatedAt: string | Date | undefined;
|
|
167
196
|
}[];
|
|
168
197
|
page: number;
|
|
169
198
|
hasMore: boolean;
|
|
@@ -11,6 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DashboardViewProvider = exports.FEATURE = exports.VIEW_PROVIDER = exports.VIEW_KEY = void 0;
|
|
13
13
|
const projects_service_1 = require("./projects.service");
|
|
14
|
+
const projects_schema_1 = require("./projects.schema");
|
|
14
15
|
const common_1 = require("@nestjs/common");
|
|
15
16
|
const v3_1 = require("zod/v3");
|
|
16
17
|
const contracts_1 = require("@xpert-ai/contracts");
|
|
@@ -74,10 +75,13 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
74
75
|
if (mode === 'draft' && !access.canReadDraft)
|
|
75
76
|
throw new common_1.ForbiddenException('DASHBOARD_DRAFT_ACCESS_DENIED');
|
|
76
77
|
const page = await this.service.listPage(context, params.page, params.pageSize);
|
|
78
|
+
const selectedDashboard = params.artifactId
|
|
79
|
+
? page.items.find(item => item.artifactId === params.artifactId) ?? await this.service.selectedSummary(context, params.artifactId)
|
|
80
|
+
: undefined;
|
|
77
81
|
const versions = params.artifactId ? await this.service.history(context, params.artifactId) : undefined;
|
|
78
82
|
const unavailable = params.artifactId && mode === 'published' && !params.versionId && !versions?.some(version => version.current);
|
|
79
83
|
return { meta: { navigationTarget: (0, dashboard_navigation_1.dashboardNavigationTarget)(context), access, mode, currentProject,
|
|
80
|
-
dashboards: page.items, pagination: { page: page.page, pageSize: page.pageSize, hasMore: page.hasMore },
|
|
84
|
+
dashboards: page.items, selectedDashboard, pagination: { page: page.page, pageSize: page.pageSize, hasMore: page.hasMore },
|
|
81
85
|
sources: access.canEdit ? await this.service.sources(context) : [],
|
|
82
86
|
...(unavailable ? { notice: 'not_published' } : params.artifactId ? {
|
|
83
87
|
saved: await this.service.openDocument(context, params.artifactId, params.versionId, params.draftRevision, mode), versions
|
|
@@ -86,10 +90,13 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
86
90
|
async executeViewAction(context, viewKey, action, request) {
|
|
87
91
|
assertView(viewKey);
|
|
88
92
|
if (action === 'dashboards') {
|
|
89
|
-
const parsed =
|
|
93
|
+
const parsed = projects_schema_1.dashboardSearchSchema.safeParse(request.input);
|
|
90
94
|
if (!parsed.success)
|
|
91
95
|
throw new common_1.BadRequestException('DASHBOARD_INVALID_PICKER_QUERY');
|
|
92
|
-
|
|
96
|
+
const target = parsed.data.projectId ? await this.projects.pickerContext(context, parsed.data.projectId) : context;
|
|
97
|
+
const page = await this.service.searchPage(target, parsed.data);
|
|
98
|
+
const access = await this.service.access(target);
|
|
99
|
+
return { success: true, data: { ...page, canEdit: access.canEdit, mode: access.canReadDraft ? 'draft' : 'published' }, refresh: false };
|
|
93
100
|
}
|
|
94
101
|
if (action === 'projects')
|
|
95
102
|
return { success: true, data: await this.projects.list(context, projects_service_1.projectSearchSchema.parse(request.input)), refresh: false };
|
|
@@ -100,11 +107,12 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
100
107
|
return { success: true, data: action === 'share-status' ? await this.sharing.inspect(context, input.artifactId, input.versionId) : await this.sharing.revoke(context, input.artifactId), refresh: false };
|
|
101
108
|
}
|
|
102
109
|
if (action === 'delete') {
|
|
103
|
-
const parsed = v3_1.z.object({ artifactId: v3_1.z.string().uuid(), expectedRevision: v3_1.z.number().int().positive(), confirmed: v3_1.z.literal(true) }).strict().safeParse(request.input);
|
|
110
|
+
const parsed = v3_1.z.object({ artifactId: v3_1.z.string().uuid(), expectedRevision: v3_1.z.number().int().positive(), confirmed: v3_1.z.literal(true), projectId: v3_1.z.string().uuid().optional() }).strict().safeParse(request.input);
|
|
104
111
|
if (!parsed.success)
|
|
105
112
|
throw new common_1.BadRequestException('DASHBOARD_DELETION_CONFIRMATION_REQUIRED');
|
|
106
113
|
const input = parsed.data;
|
|
107
|
-
|
|
114
|
+
const target = input.projectId ? await this.projects.pickerContext(context, input.projectId) : context;
|
|
115
|
+
return { success: true, data: await this.service.trash(target, input.artifactId, input.expectedRevision), refresh: false };
|
|
108
116
|
}
|
|
109
117
|
if (action === 'publish') {
|
|
110
118
|
const parsed = v3_1.z.object({ artifactId: v3_1.z.string().uuid(), expectedRevision: v3_1.z.number().int().positive(),
|