@morscherlab/mint-sdk 1.0.56 → 1.0.58
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/__tests__/components/ArtifactSaveDialog.test.d.ts +1 -0
- package/dist/__tests__/components/ArtifactSelectorModal.test.d.ts +1 -0
- package/dist/__tests__/composables/useAnalysisArtifacts.test.d.ts +1 -0
- package/dist/analysisArtifactTypes-Cu40dzSG.js +7 -0
- package/dist/analysisArtifactTypes-Cu40dzSG.js.map +1 -0
- package/dist/components/ArtifactSaveDialog.vue.d.ts +59 -0
- package/dist/components/ArtifactSelectorModal.vue.d.ts +41 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -2
- package/dist/{components-BQwOeyiy.js → components-CpnOaPbP.js} +1774 -1144
- package/dist/components-CpnOaPbP.js.map +1 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/index.js +4 -3
- package/dist/composables/useAnalysisArtifacts.d.ts +59 -0
- package/dist/{composables-TpXyhRZZ.js → composables-OYTD0Y3r.js} +2 -2
- package/dist/{composables-TpXyhRZZ.js.map → composables-OYTD0Y3r.js.map} +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/install.js +1 -1
- package/dist/styles.css +412 -0
- package/dist/types/analysisArtifactTypes.d.ts +133 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/{useJobsStatusTray-CVecN6Ao.js → useAnalysisArtifacts-Ob8UtVwl.js} +157 -2
- package/dist/useAnalysisArtifacts-Ob8UtVwl.js.map +1 -0
- package/package.json +1 -1
- package/src/__tests__/components/ArtifactSaveDialog.test.ts +566 -0
- package/src/__tests__/components/ArtifactSelectorModal.test.ts +178 -0
- package/src/__tests__/composables/useAnalysisArtifacts.test.ts +667 -0
- package/src/components/ArtifactSaveDialog.story.vue +319 -0
- package/src/components/ArtifactSaveDialog.vue +434 -0
- package/src/components/ArtifactSelectorModal.story.vue +295 -0
- package/src/components/ArtifactSelectorModal.vue +326 -0
- package/src/components/index.ts +2 -0
- package/src/composables/index.ts +6 -0
- package/src/composables/useAnalysisArtifacts.ts +305 -0
- package/src/styles/components/artifact-save-dialog.css +17 -0
- package/src/styles/components/artifact-selector-modal.css +216 -0
- package/src/styles/index.css +2 -0
- package/src/types/analysisArtifactTypes.ts +167 -0
- package/src/types/index.ts +24 -0
- package/dist/components-BQwOeyiy.js.map +0 -1
- package/dist/useJobsStatusTray-CVecN6Ao.js.map +0 -1
- /package/dist/{ExperimentPopover-8A4Rhffp.js → ExperimentPopover-Ryusjrhv.js} +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { TreeNode } from './componentLabTypes'
|
|
2
|
+
import type { SummaryData } from './componentWorkflowTypes'
|
|
3
|
+
|
|
4
|
+
/** Result schema identifier for file-backed analysis artifacts. */
|
|
5
|
+
export const ANALYSIS_FILE_ARTIFACT_SCHEMA = 'mint.analysis_file.v1'
|
|
6
|
+
|
|
7
|
+
/** Known artifact lifecycle states; kept open for forward compatibility. */
|
|
8
|
+
export type AnalysisArtifactStatus = 'active' | 'archived' | (string & {})
|
|
9
|
+
|
|
10
|
+
/** Status filter vocabulary for artifact lists. */
|
|
11
|
+
export type AnalysisArtifactStatusFilter = 'active' | 'archived' | 'all'
|
|
12
|
+
|
|
13
|
+
/** Summary row returned by GET /experiments/{id}/analysis-artifacts. */
|
|
14
|
+
export interface AnalysisArtifactSummary {
|
|
15
|
+
id: number
|
|
16
|
+
experiment_id: number
|
|
17
|
+
plugin_id: string
|
|
18
|
+
artifact_key: string
|
|
19
|
+
display_name: string
|
|
20
|
+
note?: string | null
|
|
21
|
+
status: AnalysisArtifactStatus
|
|
22
|
+
result_keys: string[]
|
|
23
|
+
created_at?: string | null
|
|
24
|
+
updated_at?: string | null
|
|
25
|
+
archived_at?: string | null
|
|
26
|
+
archived_by?: number | null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Full artifact returned by GET /experiments/{id}/analysis-artifacts/{artifactId}. */
|
|
30
|
+
export interface AnalysisArtifactDetail extends AnalysisArtifactSummary {
|
|
31
|
+
result: Record<string, unknown>
|
|
32
|
+
tree: TreeNode[]
|
|
33
|
+
summary: SummaryData | null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Response of GET /experiments/{id}/analysis-artifacts. */
|
|
37
|
+
export interface AnalysisArtifactListResponse {
|
|
38
|
+
artifacts: AnalysisArtifactSummary[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Body of PATCH /experiments/{id}/analysis-artifacts/{artifactId}. */
|
|
42
|
+
export interface AnalysisArtifactMetadataUpdate {
|
|
43
|
+
display_name?: string
|
|
44
|
+
/** undefined = keep, string = set, null = clear. */
|
|
45
|
+
note?: string | null
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** How a save payload should be applied by the plugin backend. */
|
|
49
|
+
export type ArtifactSaveMode = 'create' | 'upsert' | 'update'
|
|
50
|
+
|
|
51
|
+
/** Where file content comes from when a plugin uses ArtifactSaveDialog. */
|
|
52
|
+
export type ArtifactFileSource = 'upload' | 'handler'
|
|
53
|
+
|
|
54
|
+
interface ArtifactSavePayloadBase {
|
|
55
|
+
experimentId: number
|
|
56
|
+
artifactKey: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* JSON artifact save — handler maps to save_analysis_artifact, which upserts by key.
|
|
61
|
+
* That call only assigns display_name/note when they are provided, and cannot clear
|
|
62
|
+
* either; use the metadata PATCH (useAnalysisArtifacts.updateMetadata) for that.
|
|
63
|
+
*/
|
|
64
|
+
export interface JsonArtifactSavePayload extends ArtifactSavePayloadBase {
|
|
65
|
+
kind: 'json'
|
|
66
|
+
mode: 'create' | 'upsert'
|
|
67
|
+
result: Record<string, unknown>
|
|
68
|
+
displayName?: string
|
|
69
|
+
note?: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** File artifact create — handler maps to save_analysis_file_artifact (create-only: a reused key conflicts). */
|
|
73
|
+
export interface FileArtifactCreatePayload extends ArtifactSavePayloadBase {
|
|
74
|
+
kind: 'file'
|
|
75
|
+
mode: 'create'
|
|
76
|
+
file: File
|
|
77
|
+
/** Maps to the Python `kind=` argument (defaults to "file" backend-side). */
|
|
78
|
+
fileKind: string
|
|
79
|
+
filename?: string
|
|
80
|
+
displayName?: string
|
|
81
|
+
note?: string
|
|
82
|
+
contentType?: string
|
|
83
|
+
metadata?: Record<string, unknown>
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* File artifact replacement — handler maps to update_analysis_file_artifact
|
|
88
|
+
* (transactional CAS replace). `kind` and `filename` are immutable backend-side, so
|
|
89
|
+
* `fileKind` echoes the artifact's existing kind and no filename is carried. `note`
|
|
90
|
+
* is three-state: omitted preserves, null clears, a string sets. `metadata` REPLACES
|
|
91
|
+
* the previous result metadata rather than merging, so it always carries the full
|
|
92
|
+
* intended map — omitting it clears whatever was there.
|
|
93
|
+
*/
|
|
94
|
+
export interface FileArtifactUpdatePayload extends ArtifactSavePayloadBase {
|
|
95
|
+
kind: 'file'
|
|
96
|
+
mode: 'update'
|
|
97
|
+
file: File
|
|
98
|
+
fileKind: string
|
|
99
|
+
note?: string | null
|
|
100
|
+
contentType?: string
|
|
101
|
+
metadata?: Record<string, unknown>
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* File artifact create where the plugin handler produces the bytes itself.
|
|
106
|
+
* This is intended for server-side serialization of in-memory analysis state;
|
|
107
|
+
* the browser neither fabricates nor uploads a placeholder File.
|
|
108
|
+
*/
|
|
109
|
+
export interface HandlerFileArtifactCreatePayload extends ArtifactSavePayloadBase {
|
|
110
|
+
kind: 'file'
|
|
111
|
+
mode: 'create'
|
|
112
|
+
source: 'handler'
|
|
113
|
+
fileKind: string
|
|
114
|
+
displayName?: string
|
|
115
|
+
note?: string
|
|
116
|
+
metadata?: Record<string, unknown>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** File artifact replacement where the plugin handler produces the bytes itself. */
|
|
120
|
+
export interface HandlerFileArtifactUpdatePayload extends ArtifactSavePayloadBase {
|
|
121
|
+
kind: 'file'
|
|
122
|
+
mode: 'update'
|
|
123
|
+
source: 'handler'
|
|
124
|
+
fileKind: string
|
|
125
|
+
note?: string | null
|
|
126
|
+
metadata?: Record<string, unknown>
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type ArtifactSavePayload =
|
|
130
|
+
| JsonArtifactSavePayload
|
|
131
|
+
| FileArtifactCreatePayload
|
|
132
|
+
| FileArtifactUpdatePayload
|
|
133
|
+
|
|
134
|
+
/** Payloads accepted when `ArtifactSaveDialog.fileSource` is `handler`. */
|
|
135
|
+
export type HandlerArtifactSavePayload =
|
|
136
|
+
| JsonArtifactSavePayload
|
|
137
|
+
| HandlerFileArtifactCreatePayload
|
|
138
|
+
| HandlerFileArtifactUpdatePayload
|
|
139
|
+
|
|
140
|
+
/** Every payload variant the dialog can emit across both file sources. */
|
|
141
|
+
export type ArtifactSaveDialogPayload =
|
|
142
|
+
| ArtifactSavePayload
|
|
143
|
+
| HandlerFileArtifactCreatePayload
|
|
144
|
+
| HandlerFileArtifactUpdatePayload
|
|
145
|
+
|
|
146
|
+
/** Optional handler result; cleanupPending surfaces AnalysisFileArtifactUpdate.cleanup_pending. */
|
|
147
|
+
export interface ArtifactSaveResult {
|
|
148
|
+
artifact?: AnalysisArtifactSummary
|
|
149
|
+
cleanupPending?: boolean
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Plugin-supplied save handler. The dialog never writes to the platform;
|
|
154
|
+
* the handler forwards the payload to the plugin backend, which calls
|
|
155
|
+
* save_analysis_artifact / save_analysis_file_artifact / update_analysis_file_artifact.
|
|
156
|
+
*/
|
|
157
|
+
export type ArtifactSaveHandler = (
|
|
158
|
+
payload: ArtifactSavePayload,
|
|
159
|
+
) => Promise<ArtifactSaveResult | void>
|
|
160
|
+
|
|
161
|
+
/** Save handler paired with `ArtifactSaveDialog.fileSource="handler"`. */
|
|
162
|
+
export type HandlerArtifactSaveHandler = (
|
|
163
|
+
payload: HandlerArtifactSavePayload,
|
|
164
|
+
) => Promise<ArtifactSaveResult | void>
|
|
165
|
+
|
|
166
|
+
/** Handler accepted by ArtifactSaveDialog; `fileSource` selects the payload family. */
|
|
167
|
+
export type ArtifactSaveDialogHandler = ArtifactSaveHandler | HandlerArtifactSaveHandler
|
package/src/types/index.ts
CHANGED
|
@@ -176,6 +176,30 @@ export type {
|
|
|
176
176
|
TreeNode,
|
|
177
177
|
} from './components'
|
|
178
178
|
|
|
179
|
+
export type {
|
|
180
|
+
AnalysisArtifactStatus,
|
|
181
|
+
AnalysisArtifactStatusFilter,
|
|
182
|
+
AnalysisArtifactSummary,
|
|
183
|
+
AnalysisArtifactDetail,
|
|
184
|
+
AnalysisArtifactListResponse,
|
|
185
|
+
AnalysisArtifactMetadataUpdate,
|
|
186
|
+
ArtifactSaveMode,
|
|
187
|
+
ArtifactFileSource,
|
|
188
|
+
JsonArtifactSavePayload,
|
|
189
|
+
FileArtifactCreatePayload,
|
|
190
|
+
FileArtifactUpdatePayload,
|
|
191
|
+
HandlerFileArtifactCreatePayload,
|
|
192
|
+
HandlerFileArtifactUpdatePayload,
|
|
193
|
+
ArtifactSavePayload,
|
|
194
|
+
HandlerArtifactSavePayload,
|
|
195
|
+
ArtifactSaveDialogPayload,
|
|
196
|
+
ArtifactSaveResult,
|
|
197
|
+
ArtifactSaveHandler,
|
|
198
|
+
HandlerArtifactSaveHandler,
|
|
199
|
+
ArtifactSaveDialogHandler,
|
|
200
|
+
} from './analysisArtifactTypes'
|
|
201
|
+
export { ANALYSIS_FILE_ARTIFACT_SCHEMA } from './analysisArtifactTypes'
|
|
202
|
+
|
|
179
203
|
export type {
|
|
180
204
|
JobListPayload,
|
|
181
205
|
JobProgress,
|