@things-factory/labeling 9.1.19
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/CHANGELOG.md +87 -0
- package/ENTITY_IMPLEMENTATION.md +351 -0
- package/INTEGRATION_COMPLETE.md +531 -0
- package/MIGRATION_GUIDE.md +310 -0
- package/README.md +551 -0
- package/REFACTORING_SUMMARY.md +212 -0
- package/UI_DOCUMENTATION.md +552 -0
- package/dist-client/index.d.ts +3 -0
- package/dist-client/index.js +9 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/pages/labeling-workflow-builder.d.ts +26 -0
- package/dist-client/pages/labeling-workflow-builder.js +636 -0
- package/dist-client/pages/labeling-workflow-builder.js.map +1 -0
- package/dist-client/pages/labeling-workflow-list.d.ts +24 -0
- package/dist-client/pages/labeling-workflow-list.js +495 -0
- package/dist-client/pages/labeling-workflow-list.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +47 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-server/entities/index.d.ts +5 -0
- package/dist-server/entities/index.js +11 -0
- package/dist-server/entities/index.js.map +1 -0
- package/dist-server/index.d.ts +3 -0
- package/dist-server/index.js +7 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/route.d.ts +2 -0
- package/dist-server/route.js +6 -0
- package/dist-server/route.js.map +1 -0
- package/dist-server/service/index.d.ts +8 -0
- package/dist-server/service/index.js +21 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/labeling-workflow-service.d.ts +69 -0
- package/dist-server/service/labeling-workflow-service.js +521 -0
- package/dist-server/service/labeling-workflow-service.js.map +1 -0
- package/dist-server/service/labeling-workflow.d.ts +30 -0
- package/dist-server/service/labeling-workflow.js +119 -0
- package/dist-server/service/labeling-workflow.js.map +1 -0
- package/dist-server/service/workflow-execution-step.d.ts +28 -0
- package/dist-server/service/workflow-execution-step.js +115 -0
- package/dist-server/service/workflow-execution-step.js.map +1 -0
- package/dist-server/service/workflow-execution.d.ts +27 -0
- package/dist-server/service/workflow-execution.js +110 -0
- package/dist-server/service/workflow-execution.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/dist-server/types/workflow-types.d.ts +141 -0
- package/dist-server/types/workflow-types.js +488 -0
- package/dist-server/types/workflow-types.js.map +1 -0
- package/package.json +51 -0
- package/things-factory.config.js +11 -0
- package/translations/en.json +6 -0
- package/translations/ja.json +6 -0
- package/translations/ko.json +6 -0
- package/translations/ms.json +6 -0
- package/translations/zh.json +6 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Migration Guide: labeling-scenario → labeling (workflow)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This guide covers the migration from the old `labeling-scenario` implementation in `@things-factory/integration-label-studio` to the new `@things-factory/labeling` package with `workflow` terminology.
|
|
6
|
+
|
|
7
|
+
## What Changed
|
|
8
|
+
|
|
9
|
+
### 1. Package Structure
|
|
10
|
+
|
|
11
|
+
**Before:**
|
|
12
|
+
```
|
|
13
|
+
packages/integration-label-studio/
|
|
14
|
+
server/
|
|
15
|
+
types/scenario-types.ts
|
|
16
|
+
service/labeling-scenario-service.ts
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**After:**
|
|
20
|
+
```
|
|
21
|
+
packages/labeling/ # NEW PACKAGE
|
|
22
|
+
server/
|
|
23
|
+
types/workflow-types.ts # Renamed from scenario-types
|
|
24
|
+
service/labeling-workflow-service.ts # Renamed from labeling-scenario-service
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 2. Terminology Changes
|
|
28
|
+
|
|
29
|
+
All `Scenario` terms have been renamed to `Workflow`:
|
|
30
|
+
|
|
31
|
+
| Old Term | New Term |
|
|
32
|
+
|----------|----------|
|
|
33
|
+
| `LabelingScenario` | `LabelingWorkflow` |
|
|
34
|
+
| `ScenarioStep` | `WorkflowStep` |
|
|
35
|
+
| `ScenarioStepType` | `WorkflowStepType` |
|
|
36
|
+
| `ScenarioStatus` | `WorkflowStatus` |
|
|
37
|
+
| `ScenarioExecution` | `WorkflowExecution` |
|
|
38
|
+
| `ScenarioExecutionStep` | `WorkflowExecutionStep` |
|
|
39
|
+
| `CreateScenarioRequest` | `CreateWorkflowRequest` |
|
|
40
|
+
| `ExecuteScenarioRequest` | `ExecuteWorkflowRequest` |
|
|
41
|
+
| `LabelingScenarioList` | `LabelingWorkflowList` |
|
|
42
|
+
| `ScenarioExecutionList` | `WorkflowExecutionList` |
|
|
43
|
+
| `LabelingScenarioService` | `LabelingWorkflowService` |
|
|
44
|
+
|
|
45
|
+
### 3. GraphQL API Changes
|
|
46
|
+
|
|
47
|
+
#### Mutations
|
|
48
|
+
|
|
49
|
+
| Old Mutation | New Mutation |
|
|
50
|
+
|-------------|-------------|
|
|
51
|
+
| `createLabelingScenario` | `createLabelingWorkflow` |
|
|
52
|
+
| `executeScenario` | `executeLabelingWorkflow` |
|
|
53
|
+
| `pauseScenario` | `pauseLabelingWorkflow` |
|
|
54
|
+
| `resumeScenario` | `resumeLabelingWorkflow` |
|
|
55
|
+
|
|
56
|
+
#### Queries
|
|
57
|
+
|
|
58
|
+
| Old Query | New Query |
|
|
59
|
+
|-----------|-----------|
|
|
60
|
+
| `labelingScenario` | `labelingWorkflow` |
|
|
61
|
+
| `labelingScenarios` | `labelingWorkflows` |
|
|
62
|
+
| `scenarioExecution` | `workflowExecution` |
|
|
63
|
+
| `scenarioExecutions` | `workflowExecutions` |
|
|
64
|
+
|
|
65
|
+
#### Arguments
|
|
66
|
+
|
|
67
|
+
| Old Argument | New Argument |
|
|
68
|
+
|-------------|-------------|
|
|
69
|
+
| `scenarioId` | `workflowId` |
|
|
70
|
+
|
|
71
|
+
## Migration Steps
|
|
72
|
+
|
|
73
|
+
### For Backend Code
|
|
74
|
+
|
|
75
|
+
1. **Update package dependencies** in your `package.json`:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@things-factory/labeling": "^9.1.0"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
2. **Update imports**:
|
|
86
|
+
|
|
87
|
+
**Before:**
|
|
88
|
+
```typescript
|
|
89
|
+
import {
|
|
90
|
+
LabelingScenario,
|
|
91
|
+
ScenarioStep,
|
|
92
|
+
CreateScenarioRequest
|
|
93
|
+
} from '@things-factory/integration-label-studio/dist-server/types/scenario-types.js'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**After:**
|
|
97
|
+
```typescript
|
|
98
|
+
import {
|
|
99
|
+
LabelingWorkflow,
|
|
100
|
+
WorkflowStep,
|
|
101
|
+
CreateWorkflowRequest
|
|
102
|
+
} from '@things-factory/labeling/dist-server/types/workflow-types.js'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
3. **Update type references** in your code:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Replace all occurrences
|
|
109
|
+
LabelingScenario → LabelingWorkflow
|
|
110
|
+
ScenarioStep → WorkflowStep
|
|
111
|
+
ScenarioStatus → WorkflowStatus
|
|
112
|
+
// etc.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### For GraphQL Queries/Mutations
|
|
116
|
+
|
|
117
|
+
1. **Update mutation calls**:
|
|
118
|
+
|
|
119
|
+
**Before:**
|
|
120
|
+
```graphql
|
|
121
|
+
mutation {
|
|
122
|
+
createLabelingScenario(input: {
|
|
123
|
+
name: "My Scenario"
|
|
124
|
+
projectId: 123
|
|
125
|
+
steps: [...]
|
|
126
|
+
}) {
|
|
127
|
+
id
|
|
128
|
+
name
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**After:**
|
|
134
|
+
```graphql
|
|
135
|
+
mutation {
|
|
136
|
+
createLabelingWorkflow(input: {
|
|
137
|
+
name: "My Workflow"
|
|
138
|
+
projectId: 123
|
|
139
|
+
steps: [...]
|
|
140
|
+
}) {
|
|
141
|
+
id
|
|
142
|
+
name
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
2. **Update query calls**:
|
|
148
|
+
|
|
149
|
+
**Before:**
|
|
150
|
+
```graphql
|
|
151
|
+
query {
|
|
152
|
+
labelingScenarios(projectId: 123) {
|
|
153
|
+
items {
|
|
154
|
+
id
|
|
155
|
+
name
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**After:**
|
|
162
|
+
```graphql
|
|
163
|
+
query {
|
|
164
|
+
labelingWorkflows(projectId: 123) {
|
|
165
|
+
items {
|
|
166
|
+
id
|
|
167
|
+
name
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
3. **Update execution calls**:
|
|
174
|
+
|
|
175
|
+
**Before:**
|
|
176
|
+
```graphql
|
|
177
|
+
mutation {
|
|
178
|
+
executeScenario(input: {
|
|
179
|
+
scenarioId: "uuid"
|
|
180
|
+
}) {
|
|
181
|
+
executionId
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**After:**
|
|
187
|
+
```graphql
|
|
188
|
+
mutation {
|
|
189
|
+
executeLabelingWorkflow(input: {
|
|
190
|
+
workflowId: "uuid"
|
|
191
|
+
}) {
|
|
192
|
+
executionId
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### For Frontend Code
|
|
198
|
+
|
|
199
|
+
1. **Update GraphQL query strings** in your components:
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
// Before
|
|
203
|
+
const GET_SCENARIOS = gql`
|
|
204
|
+
query {
|
|
205
|
+
labelingScenarios {
|
|
206
|
+
items {
|
|
207
|
+
id
|
|
208
|
+
name
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
`
|
|
213
|
+
|
|
214
|
+
// After
|
|
215
|
+
const GET_WORKFLOWS = gql`
|
|
216
|
+
query {
|
|
217
|
+
labelingWorkflows {
|
|
218
|
+
items {
|
|
219
|
+
id
|
|
220
|
+
name
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
`
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
2. **Update component props and state**:
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// Before
|
|
231
|
+
interface Props {
|
|
232
|
+
scenario: LabelingScenario
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// After
|
|
236
|
+
interface Props {
|
|
237
|
+
workflow: LabelingWorkflow
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Breaking Changes
|
|
242
|
+
|
|
243
|
+
### 1. GraphQL Schema
|
|
244
|
+
|
|
245
|
+
All GraphQL operations have new names. Old operations will not work and must be updated.
|
|
246
|
+
|
|
247
|
+
### 2. Package Location
|
|
248
|
+
|
|
249
|
+
The service is no longer in `@things-factory/integration-label-studio`. You must add `@things-factory/labeling` as a dependency.
|
|
250
|
+
|
|
251
|
+
### 3. Privilege Categories
|
|
252
|
+
|
|
253
|
+
The privilege category has changed from `"label-studio"` to `"labeling"`:
|
|
254
|
+
|
|
255
|
+
**Before:**
|
|
256
|
+
```typescript
|
|
257
|
+
@Directive('@privilege(category: "label-studio", privilege: "mutation")')
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**After:**
|
|
261
|
+
```typescript
|
|
262
|
+
@Directive('@privilege(category: "labeling", privilege: "mutation")')
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
You may need to update your user roles and permissions accordingly.
|
|
266
|
+
|
|
267
|
+
## Backward Compatibility
|
|
268
|
+
|
|
269
|
+
**There is NO backward compatibility.** This is a breaking change that requires:
|
|
270
|
+
|
|
271
|
+
1. Updating all code references
|
|
272
|
+
2. Updating all GraphQL queries/mutations
|
|
273
|
+
3. Migrating any stored scenario data (if applicable)
|
|
274
|
+
|
|
275
|
+
The old files have been marked as `.deprecated` in `integration-label-studio` and will be removed in a future version.
|
|
276
|
+
|
|
277
|
+
## Data Migration
|
|
278
|
+
|
|
279
|
+
If you have existing scenario data stored in a database or configuration:
|
|
280
|
+
|
|
281
|
+
1. Export existing scenario definitions
|
|
282
|
+
2. Transform field names: `scenarioId` → `workflowId`, etc.
|
|
283
|
+
3. Update GraphQL type names in JSON configs
|
|
284
|
+
4. Re-import using the new workflow API
|
|
285
|
+
|
|
286
|
+
## Testing Checklist
|
|
287
|
+
|
|
288
|
+
- [ ] All imports updated to use `@things-factory/labeling`
|
|
289
|
+
- [ ] All type references changed from `Scenario*` to `Workflow*`
|
|
290
|
+
- [ ] All GraphQL queries/mutations updated
|
|
291
|
+
- [ ] Privilege categories updated to `"labeling"`
|
|
292
|
+
- [ ] Frontend components updated
|
|
293
|
+
- [ ] Integration tests passing
|
|
294
|
+
- [ ] End-to-end workflow execution verified
|
|
295
|
+
|
|
296
|
+
## Support
|
|
297
|
+
|
|
298
|
+
If you encounter issues during migration, please:
|
|
299
|
+
|
|
300
|
+
1. Check this guide for common problems
|
|
301
|
+
2. Review the [README.md](./README.md) for usage examples
|
|
302
|
+
3. Contact the Things-Factory team
|
|
303
|
+
|
|
304
|
+
## Timeline
|
|
305
|
+
|
|
306
|
+
- **Current Version**: `9.1.0` - New `@things-factory/labeling` package introduced
|
|
307
|
+
- **Deprecation**: Old scenario files marked as `.deprecated`
|
|
308
|
+
- **Future Version**: Old files will be removed entirely
|
|
309
|
+
|
|
310
|
+
Please migrate as soon as possible to avoid disruption.
|