@xpert-ai/plugin-live-dashboard 0.2.0 → 0.3.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.
@@ -80,6 +80,8 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
80
80
  };
81
81
  dashboards: {
82
82
  title: string | null | undefined;
83
+ draftRevision?: number | undefined;
84
+ canDelete: boolean;
83
85
  artifactId: string;
84
86
  versionId: string | null | undefined;
85
87
  versionNumber: number | undefined;
@@ -116,128 +118,6 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
116
118
  success: boolean;
117
119
  data: {
118
120
  artifactId: string;
119
- versionId: string;
120
- versionNumber: number;
121
- title: string | null | undefined;
122
- };
123
- refresh: boolean;
124
- } | {
125
- success: boolean;
126
- data: {
127
- artifactId: string;
128
- draftId: string;
129
- draftRevision: number;
130
- baseVersionId: string | null;
131
- status: "draft";
132
- title: string;
133
- };
134
- refresh: boolean;
135
- } | {
136
- success: boolean;
137
- data: {
138
- payload?: {
139
- ok: boolean;
140
- widget_type: string;
141
- surface: string;
142
- sources: never[];
143
- manifest: {
144
- version: number;
145
- surface: string;
146
- title: string;
147
- cards: never[];
148
- filters: never[];
149
- sources: never[];
150
- charts: {
151
- id: string;
152
- title: string;
153
- type: "bar" | "line" | "area" | "pie" | "scatter";
154
- dataset: string;
155
- encodings: {
156
- color?: {
157
- field: string;
158
- } | undefined;
159
- x: {
160
- field: string;
161
- };
162
- y: {
163
- field: string;
164
- };
165
- };
166
- }[];
167
- tables: {
168
- id: string;
169
- title: string;
170
- dataset: string;
171
- columns: {
172
- field: string;
173
- label: string;
174
- }[];
175
- }[];
176
- blocks: ({
177
- id: string;
178
- type: string;
179
- chartId: string;
180
- } | {
181
- id: string;
182
- type: string;
183
- tableId: string;
184
- })[];
185
- };
186
- snapshot: {
187
- version: number;
188
- generatedAt: string;
189
- status: string;
190
- datasets: any;
191
- };
192
- } | undefined;
193
- datasets: import("@xpert-ai/contracts").AnalyticalDataset[];
194
- failures: {
195
- bindingId: string;
196
- datasetId: string;
197
- reason: "unavailable";
198
- }[];
199
- manifest: {
200
- schema: "xpert.live-dashboard";
201
- id: string;
202
- title: string;
203
- bindings: import("@xpert-ai/contracts").AnalyticsBinding[];
204
- controls: {
205
- type: "string" | "number" | "boolean" | "date";
206
- controlId: string;
207
- label: string;
208
- defaultValue?: string | number | boolean | null | undefined;
209
- allowedValues?: (string | number | boolean | null)[] | undefined;
210
- }[];
211
- charts: {
212
- type: "bar" | "line" | "area" | "pie" | "scatter";
213
- id: string;
214
- title: string;
215
- datasetId: string;
216
- x: string;
217
- y: string;
218
- color?: string | undefined;
219
- }[];
220
- tables: {
221
- id: string;
222
- title: string;
223
- datasetId: string;
224
- fields: string[];
225
- }[];
226
- presentation?: {
227
- type: "html";
228
- html: string;
229
- dependencies?: import("@xpert-ai/plugin-sdk/artifact-document").ArtifactDocumentDependencyLock[] | undefined;
230
- } | undefined;
231
- };
232
- draftId?: string | undefined;
233
- draftRevision?: number | undefined;
234
- baseVersionId?: string | null | undefined;
235
- isDraft?: boolean | undefined;
236
- title: string | null | undefined;
237
- updatedAt: string | Date | undefined;
238
- artifactId: string;
239
- versionId: string | null | undefined;
240
- versionNumber: number | undefined;
241
121
  };
242
122
  refresh: boolean;
243
123
  } | {
@@ -47,6 +47,7 @@ let DashboardViewProvider = class DashboardViewProvider {
47
47
  filter: { toolNames: dashboard_receipt_1.DASHBOARD_MUTATION_TOOLS }, action: { type: 'forward', debounceMs: 0 } }] },
48
48
  actions: [
49
49
  ...['share-status', 'share', 'revoke-share'].map(key => ({ key, label: text('Team sharing', '团队分享'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } })),
50
+ { key: 'delete', label: text('Delete dashboard', '删除看板'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
50
51
  { key: 'publish', label: text('Publish draft', '发布草稿'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
51
52
  { key: 'save', label: text('Save', '保存'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
52
53
  { key: 'query', label: text('Refresh', '刷新'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
@@ -69,6 +70,13 @@ let DashboardViewProvider = class DashboardViewProvider {
69
70
  const input = v3_1.z.object({ artifactId: v3_1.z.string().uuid(), versionId: v3_1.z.string().uuid().optional() }).strict().parse(request.input);
70
71
  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 };
71
72
  }
73
+ if (action === 'delete') {
74
+ 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);
75
+ if (!parsed.success)
76
+ throw new common_1.BadRequestException('DASHBOARD_DELETION_CONFIRMATION_REQUIRED');
77
+ const input = parsed.data;
78
+ return { success: true, data: await this.service.trash(context, input.artifactId, input.expectedRevision), refresh: false };
79
+ }
72
80
  if (action === 'publish') {
73
81
  const parsed = v3_1.z.object({ artifactId: v3_1.z.string().uuid(), expectedRevision: v3_1.z.number().int().positive(),
74
82
  expectedCurrentVersionId: v3_1.z.string().uuid().nullable(), confirmed: v3_1.z.literal(true) }).strict().safeParse(request.input);