@things-factory/integration-label-studio 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.
Files changed (152) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/EXTERNAL_DATA_SOURCING.md +484 -0
  3. package/IMPLEMENTATION_GUIDE.md +469 -0
  4. package/INTEGRATION.md +279 -0
  5. package/README.md +1014 -0
  6. package/SETUP_GUIDE.md +577 -0
  7. package/TEST_GUIDE.md +387 -0
  8. package/UI_CUSTOMIZATION.md +395 -0
  9. package/USER_SYNC_GUIDE.md +514 -0
  10. package/client/bootstrap.ts +1 -0
  11. package/client/index.ts +1 -0
  12. package/client/label-studio-label-page.ts +52 -0
  13. package/client/label-studio-project-create.ts +216 -0
  14. package/client/label-studio-project-list.ts +214 -0
  15. package/client/label-studio-wrapper.ts +294 -0
  16. package/client/route.ts +15 -0
  17. package/client/tsconfig.json +13 -0
  18. package/config/config.development.js +124 -0
  19. package/config/config.production.js +182 -0
  20. package/dist-client/bootstrap.d.ts +1 -0
  21. package/dist-client/bootstrap.js +2 -0
  22. package/dist-client/bootstrap.js.map +1 -0
  23. package/dist-client/index.d.ts +1 -0
  24. package/dist-client/index.js +2 -0
  25. package/dist-client/index.js.map +1 -0
  26. package/dist-client/label-studio-label-page.d.ts +8 -0
  27. package/dist-client/label-studio-label-page.js +54 -0
  28. package/dist-client/label-studio-label-page.js.map +1 -0
  29. package/dist-client/label-studio-project-create.d.ts +16 -0
  30. package/dist-client/label-studio-project-create.js +235 -0
  31. package/dist-client/label-studio-project-create.js.map +1 -0
  32. package/dist-client/label-studio-project-list.d.ts +16 -0
  33. package/dist-client/label-studio-project-list.js +222 -0
  34. package/dist-client/label-studio-project-list.js.map +1 -0
  35. package/dist-client/label-studio-wrapper.d.ts +57 -0
  36. package/dist-client/label-studio-wrapper.js +304 -0
  37. package/dist-client/label-studio-wrapper.js.map +1 -0
  38. package/dist-client/route.d.ts +1 -0
  39. package/dist-client/route.js +14 -0
  40. package/dist-client/route.js.map +1 -0
  41. package/dist-client/tsconfig.tsbuildinfo +1 -0
  42. package/dist-server/controller/label-studio-role-mapper.d.ts +35 -0
  43. package/dist-server/controller/label-studio-role-mapper.js +65 -0
  44. package/dist-server/controller/label-studio-role-mapper.js.map +1 -0
  45. package/dist-server/controller/user-provisioning-service.d.ts +66 -0
  46. package/dist-server/controller/user-provisioning-service.js +264 -0
  47. package/dist-server/controller/user-provisioning-service.js.map +1 -0
  48. package/dist-server/index.d.ts +7 -0
  49. package/dist-server/index.js +19 -0
  50. package/dist-server/index.js.map +1 -0
  51. package/dist-server/route/label-studio-sso.d.ts +2 -0
  52. package/dist-server/route/label-studio-sso.js +156 -0
  53. package/dist-server/route/label-studio-sso.js.map +1 -0
  54. package/dist-server/route/webhook.d.ts +65 -0
  55. package/dist-server/route/webhook.js +248 -0
  56. package/dist-server/route/webhook.js.map +1 -0
  57. package/dist-server/route.d.ts +1 -0
  58. package/dist-server/route.js +21 -0
  59. package/dist-server/route.js.map +1 -0
  60. package/dist-server/service/ai-prediction-service.d.ts +27 -0
  61. package/dist-server/service/ai-prediction-service.js +222 -0
  62. package/dist-server/service/ai-prediction-service.js.map +1 -0
  63. package/dist-server/service/dataset-labeling-integration.d.ts +44 -0
  64. package/dist-server/service/dataset-labeling-integration.js +512 -0
  65. package/dist-server/service/dataset-labeling-integration.js.map +1 -0
  66. package/dist-server/service/external-data-source-service.d.ts +78 -0
  67. package/dist-server/service/external-data-source-service.js +415 -0
  68. package/dist-server/service/external-data-source-service.js.map +1 -0
  69. package/dist-server/service/index.d.ts +12 -0
  70. package/dist-server/service/index.js +27 -0
  71. package/dist-server/service/index.js.map +1 -0
  72. package/dist-server/service/label-studio-sso-service.d.ts +38 -0
  73. package/dist-server/service/label-studio-sso-service.js +98 -0
  74. package/dist-server/service/label-studio-sso-service.js.map +1 -0
  75. package/dist-server/service/ml/ml-backend-service.d.ts +23 -0
  76. package/dist-server/service/ml/ml-backend-service.js +153 -0
  77. package/dist-server/service/ml/ml-backend-service.js.map +1 -0
  78. package/dist-server/service/prediction/prediction-management.d.ts +32 -0
  79. package/dist-server/service/prediction/prediction-management.js +299 -0
  80. package/dist-server/service/prediction/prediction-management.js.map +1 -0
  81. package/dist-server/service/project/project-management.d.ts +36 -0
  82. package/dist-server/service/project/project-management.js +309 -0
  83. package/dist-server/service/project/project-management.js.map +1 -0
  84. package/dist-server/service/task/task-management.d.ts +42 -0
  85. package/dist-server/service/task/task-management.js +372 -0
  86. package/dist-server/service/task/task-management.js.map +1 -0
  87. package/dist-server/service/user-provisioning/user-sync-mutation.d.ts +28 -0
  88. package/dist-server/service/user-provisioning/user-sync-mutation.js +111 -0
  89. package/dist-server/service/user-provisioning/user-sync-mutation.js.map +1 -0
  90. package/dist-server/service/webhook/webhook-management.d.ts +21 -0
  91. package/dist-server/service/webhook/webhook-management.js +134 -0
  92. package/dist-server/service/webhook/webhook-management.js.map +1 -0
  93. package/dist-server/tsconfig.tsbuildinfo +1 -0
  94. package/dist-server/types/dataset-labeling-types.d.ts +71 -0
  95. package/dist-server/types/dataset-labeling-types.js +259 -0
  96. package/dist-server/types/dataset-labeling-types.js.map +1 -0
  97. package/dist-server/types/label-studio-types.d.ts +128 -0
  98. package/dist-server/types/label-studio-types.js +494 -0
  99. package/dist-server/types/label-studio-types.js.map +1 -0
  100. package/dist-server/types/prediction-types.d.ts +39 -0
  101. package/dist-server/types/prediction-types.js +121 -0
  102. package/dist-server/types/prediction-types.js.map +1 -0
  103. package/dist-server/utils/annotation-exporter.d.ts +104 -0
  104. package/dist-server/utils/annotation-exporter.js +261 -0
  105. package/dist-server/utils/annotation-exporter.js.map +1 -0
  106. package/dist-server/utils/label-config-builder.d.ts +117 -0
  107. package/dist-server/utils/label-config-builder.js +286 -0
  108. package/dist-server/utils/label-config-builder.js.map +1 -0
  109. package/dist-server/utils/label-studio-api-client.d.ts +180 -0
  110. package/dist-server/utils/label-studio-api-client.js +401 -0
  111. package/dist-server/utils/label-studio-api-client.js.map +1 -0
  112. package/dist-server/utils/media-url-extractor.d.ts +45 -0
  113. package/dist-server/utils/media-url-extractor.js +152 -0
  114. package/dist-server/utils/media-url-extractor.js.map +1 -0
  115. package/dist-server/utils/task-transformer.d.ts +108 -0
  116. package/dist-server/utils/task-transformer.js +260 -0
  117. package/dist-server/utils/task-transformer.js.map +1 -0
  118. package/package.json +47 -0
  119. package/server/SERVER_STRUCTURE.md +351 -0
  120. package/server/controller/label-studio-role-mapper.ts +76 -0
  121. package/server/controller/user-provisioning-service.ts +340 -0
  122. package/server/index.ts +19 -0
  123. package/server/route/label-studio-sso.ts +194 -0
  124. package/server/route/webhook.ts +304 -0
  125. package/server/route.ts +35 -0
  126. package/server/service/ai-prediction-service.ts +239 -0
  127. package/server/service/dataset-labeling-integration.ts +590 -0
  128. package/server/service/external-data-source-service.ts +438 -0
  129. package/server/service/index.ts +24 -0
  130. package/server/service/label-studio-sso-service.ts +108 -0
  131. package/server/service/labeling-scenario-service.ts.deprecated +566 -0
  132. package/server/service/ml/ml-backend-service.ts +127 -0
  133. package/server/service/prediction/prediction-management.ts +281 -0
  134. package/server/service/project/project-management.ts +284 -0
  135. package/server/service/task/task-management.ts +363 -0
  136. package/server/service/user-provisioning/user-sync-mutation.ts +80 -0
  137. package/server/service/webhook/webhook-management.ts +109 -0
  138. package/server/tsconfig.json +11 -0
  139. package/server/types/dataset-labeling-types.ts +181 -0
  140. package/server/types/global.d.ts +23 -0
  141. package/server/types/label-studio-types.ts +346 -0
  142. package/server/types/prediction-types.ts +86 -0
  143. package/server/types/scenario-types.ts.deprecated +362 -0
  144. package/server/utils/annotation-exporter.ts +340 -0
  145. package/server/utils/label-config-builder.ts +340 -0
  146. package/server/utils/label-studio-api-client.ts +487 -0
  147. package/server/utils/media-url-extractor.ts +193 -0
  148. package/server/utils/task-transformer.ts +342 -0
  149. package/test-ai-prediction.js +268 -0
  150. package/test-dataset-integration.js +449 -0
  151. package/test-simple.js +89 -0
  152. package/things-factory.config.js +12 -0
@@ -0,0 +1,372 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaskManagement = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const label_studio_api_client_js_1 = require("../../utils/label-studio-api-client.js");
7
+ const task_transformer_js_1 = require("../../utils/task-transformer.js");
8
+ const annotation_exporter_js_1 = require("../../utils/annotation-exporter.js");
9
+ const label_studio_types_js_1 = require("../../types/label-studio-types.js");
10
+ let TaskManagement = class TaskManagement {
11
+ /**
12
+ * Get tasks for a project
13
+ */
14
+ async labelStudioTasks(projectId, page, pageSize, context) {
15
+ try {
16
+ const response = await label_studio_api_client_js_1.labelStudioApi.getTasks(projectId, {
17
+ page,
18
+ page_size: pageSize
19
+ });
20
+ const tasks = response.tasks || response.results || response;
21
+ return tasks.map((task) => ({
22
+ id: task.id,
23
+ data: JSON.stringify(task.data),
24
+ annotationCount: task.annotations?.length || task.total_annotations || 0,
25
+ isCompleted: task.is_labeled || false,
26
+ createdAt: task.created_at ? new Date(task.created_at) : undefined
27
+ }));
28
+ }
29
+ catch (error) {
30
+ console.error(`Failed to fetch tasks for project ${projectId}:`, error);
31
+ throw new Error(`Failed to fetch tasks: ${error.message}`);
32
+ }
33
+ }
34
+ /**
35
+ * Get single task by ID
36
+ */
37
+ async labelStudioTask(taskId, context) {
38
+ try {
39
+ const task = await label_studio_api_client_js_1.labelStudioApi.getTask(taskId);
40
+ if (!task) {
41
+ return null;
42
+ }
43
+ return {
44
+ id: task.id,
45
+ data: JSON.stringify(task.data),
46
+ annotationCount: task.annotations?.length || task.total_annotations || 0,
47
+ isCompleted: task.is_labeled || false,
48
+ createdAt: task.created_at ? new Date(task.created_at) : undefined
49
+ };
50
+ }
51
+ catch (error) {
52
+ console.error(`Failed to fetch task ${taskId}:`, error);
53
+ return null;
54
+ }
55
+ }
56
+ /**
57
+ * Import tasks to Label Studio project
58
+ */
59
+ async importTasksToLabelStudio(projectId, tasks, context) {
60
+ const errors = [];
61
+ const taskIds = [];
62
+ let imported = 0;
63
+ let failed = 0;
64
+ try {
65
+ // Parse task data
66
+ const parsedTasks = tasks.map(task => {
67
+ try {
68
+ return JSON.parse(task.data);
69
+ }
70
+ catch (e) {
71
+ failed++;
72
+ errors.push(`Invalid JSON in task data: ${task.data}`);
73
+ return null;
74
+ }
75
+ });
76
+ const validTasks = parsedTasks.filter(task => task !== null);
77
+ if (validTasks.length === 0) {
78
+ return {
79
+ imported: 0,
80
+ failed: tasks.length,
81
+ taskIds: [],
82
+ errors
83
+ };
84
+ }
85
+ // Import tasks using Label Studio API
86
+ const response = await label_studio_api_client_js_1.labelStudioApi.importTasks(projectId, validTasks);
87
+ // Parse response
88
+ if (response.task_count !== undefined) {
89
+ imported = response.task_count;
90
+ }
91
+ else if (response.annotation_count !== undefined) {
92
+ imported = response.annotation_count;
93
+ }
94
+ else if (Array.isArray(response)) {
95
+ imported = response.length;
96
+ taskIds.push(...response.map((t) => t.id));
97
+ }
98
+ return {
99
+ imported,
100
+ failed,
101
+ taskIds,
102
+ errors: errors.length > 0 ? errors : undefined
103
+ };
104
+ }
105
+ catch (error) {
106
+ console.error(`Failed to import tasks to project ${projectId}:`, error);
107
+ throw new Error(`Failed to import tasks: ${error.message}`);
108
+ }
109
+ }
110
+ /**
111
+ * Delete task
112
+ */
113
+ async deleteLabelStudioTask(taskId, context) {
114
+ try {
115
+ await label_studio_api_client_js_1.labelStudioApi.deleteTask(taskId);
116
+ return true;
117
+ }
118
+ catch (error) {
119
+ console.error(`Failed to delete task ${taskId}:`, error);
120
+ throw new Error(`Failed to delete task: ${error.message}`);
121
+ }
122
+ }
123
+ /**
124
+ * Get annotations for a task
125
+ */
126
+ async labelStudioTaskAnnotations(taskId, context) {
127
+ try {
128
+ const annotations = await label_studio_api_client_js_1.labelStudioApi.getAnnotations(taskId);
129
+ return annotations.map((annotation) => ({
130
+ id: annotation.id,
131
+ taskId: annotation.task || taskId,
132
+ result: JSON.stringify(annotation.result),
133
+ completedBy: annotation.completed_by?.email || 'unknown',
134
+ createdAt: new Date(annotation.created_at),
135
+ leadTime: annotation.lead_time || undefined
136
+ }));
137
+ }
138
+ catch (error) {
139
+ console.error(`Failed to fetch annotations for task ${taskId}:`, error);
140
+ throw new Error(`Failed to fetch annotations: ${error.message}`);
141
+ }
142
+ }
143
+ /**
144
+ * Export annotations from project
145
+ */
146
+ async exportLabelStudioAnnotations(projectId, format, context) {
147
+ try {
148
+ const exportData = await label_studio_api_client_js_1.labelStudioApi.exportAnnotations(projectId, format);
149
+ // For JSON exports, we get the data directly
150
+ // For file exports, we might get a download URL
151
+ const annotationCount = Array.isArray(exportData) ? exportData.length : 0;
152
+ return {
153
+ exportPath: JSON.stringify(exportData), // In practice, this would be a file path or URL
154
+ annotationCount,
155
+ format
156
+ };
157
+ }
158
+ catch (error) {
159
+ console.error(`Failed to export annotations from project ${projectId}:`, error);
160
+ throw new Error(`Failed to export annotations: ${error.message}`);
161
+ }
162
+ }
163
+ /**
164
+ * Sync completed annotations to Things-Factory database
165
+ * This allows storing annotations in TF for further processing
166
+ */
167
+ async syncAnnotationsToDatabase(projectId, context) {
168
+ try {
169
+ const { domain } = context.state;
170
+ // Export annotations
171
+ const annotations = await label_studio_api_client_js_1.labelStudioApi.exportAnnotations(projectId, 'JSON');
172
+ // TODO: Store annotations in Things-Factory database
173
+ // This would typically involve:
174
+ // 1. Creating an Annotation entity
175
+ // 2. Saving each annotation with project reference
176
+ // 3. Linking to Things-Factory business objects if needed
177
+ // For now, just return count
178
+ const count = Array.isArray(annotations) ? annotations.length : 0;
179
+ console.log(`Synced ${count} annotations from project ${projectId} to database`);
180
+ return count;
181
+ }
182
+ catch (error) {
183
+ console.error(`Failed to sync annotations from project ${projectId}:`, error);
184
+ throw new Error(`Failed to sync annotations: ${error.message}`);
185
+ }
186
+ }
187
+ /**
188
+ * Import tasks with flexible data transformation
189
+ * Uses TaskTransformer for mapping source data to Label Studio format
190
+ */
191
+ async importTasksWithTransform(projectId, input, context) {
192
+ const errors = [];
193
+ const taskIds = [];
194
+ let imported = 0;
195
+ let failed = 0;
196
+ try {
197
+ // Parse source data
198
+ const sourceData = JSON.parse(input.sourceData);
199
+ if (!Array.isArray(sourceData)) {
200
+ throw new Error('Source data must be an array');
201
+ }
202
+ // Parse transform rule
203
+ const dataFields = JSON.parse(input.transformRule.dataFields);
204
+ const predictions = input.transformRule.predictions ? JSON.parse(input.transformRule.predictions) : undefined;
205
+ const meta = input.transformRule.meta ? JSON.parse(input.transformRule.meta) : undefined;
206
+ // Transform data using TaskTransformer
207
+ const lsTasks = task_transformer_js_1.TaskTransformer.transform(sourceData, {
208
+ dataFields,
209
+ predictions,
210
+ meta
211
+ });
212
+ // Import to Label Studio
213
+ const response = await label_studio_api_client_js_1.labelStudioApi.importTasks(projectId, lsTasks);
214
+ if (response.task_count) {
215
+ imported = response.task_count;
216
+ taskIds.push(...(response.task_ids || []));
217
+ }
218
+ return {
219
+ imported,
220
+ failed,
221
+ taskIds,
222
+ errors: errors.length > 0 ? errors : undefined
223
+ };
224
+ }
225
+ catch (error) {
226
+ console.error(`Failed to import tasks with transform for project ${projectId}:`, error);
227
+ throw new Error(`Failed to import tasks: ${error.message}`);
228
+ }
229
+ }
230
+ /**
231
+ * Export annotations with flexible format conversion
232
+ * Uses AnnotationExporter for custom format support
233
+ */
234
+ async exportAnnotationsWithFormat(projectId, input, context) {
235
+ try {
236
+ // Get annotations from Label Studio
237
+ let annotations = await label_studio_api_client_js_1.labelStudioApi.exportAnnotations(projectId, 'JSON');
238
+ // Filter by task IDs if specified
239
+ if (input.taskIds) {
240
+ const taskIds = JSON.parse(input.taskIds);
241
+ annotations = annotations.filter((a) => taskIds.includes(a.task));
242
+ }
243
+ // Export using custom format
244
+ const exportedData = await (0, annotation_exporter_js_1.exportAnnotations)(annotations, input.format, {
245
+ projectId,
246
+ exportedAt: new Date().toISOString()
247
+ });
248
+ // Convert to string if not already
249
+ const dataString = typeof exportedData === 'string' ? exportedData : JSON.stringify(exportedData);
250
+ return {
251
+ data: dataString,
252
+ count: annotations.length,
253
+ format: input.format
254
+ };
255
+ }
256
+ catch (error) {
257
+ console.error(`Failed to export annotations for project ${projectId}:`, error);
258
+ throw new Error(`Failed to export annotations: ${error.message}`);
259
+ }
260
+ }
261
+ };
262
+ exports.TaskManagement = TaskManagement;
263
+ tslib_1.__decorate([
264
+ (0, type_graphql_1.Query)(returns => [label_studio_types_js_1.LabelStudioTask], {
265
+ description: 'Get all tasks for a Label Studio project'
266
+ }),
267
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "query")'),
268
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId', type => type_graphql_1.Int)),
269
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('page', type => type_graphql_1.Int, { nullable: true, defaultValue: 1 })),
270
+ tslib_1.__param(2, (0, type_graphql_1.Arg)('pageSize', type => type_graphql_1.Int, { nullable: true, defaultValue: 100 })),
271
+ tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
272
+ tslib_1.__metadata("design:type", Function),
273
+ tslib_1.__metadata("design:paramtypes", [Number, Number, Number, Object]),
274
+ tslib_1.__metadata("design:returntype", Promise)
275
+ ], TaskManagement.prototype, "labelStudioTasks", null);
276
+ tslib_1.__decorate([
277
+ (0, type_graphql_1.Query)(returns => label_studio_types_js_1.LabelStudioTask, {
278
+ description: 'Get a single task by ID',
279
+ nullable: true
280
+ }),
281
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "query")'),
282
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('taskId', type => type_graphql_1.Int)),
283
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
284
+ tslib_1.__metadata("design:type", Function),
285
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
286
+ tslib_1.__metadata("design:returntype", Promise)
287
+ ], TaskManagement.prototype, "labelStudioTask", null);
288
+ tslib_1.__decorate([
289
+ (0, type_graphql_1.Mutation)(returns => label_studio_types_js_1.TaskImportResult, {
290
+ description: 'Import tasks to a Label Studio project in bulk'
291
+ }),
292
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "mutation")'),
293
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId', type => type_graphql_1.Int)),
294
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('tasks', type => [label_studio_types_js_1.TaskDataInput])),
295
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
296
+ tslib_1.__metadata("design:type", Function),
297
+ tslib_1.__metadata("design:paramtypes", [Number, Array, Object]),
298
+ tslib_1.__metadata("design:returntype", Promise)
299
+ ], TaskManagement.prototype, "importTasksToLabelStudio", null);
300
+ tslib_1.__decorate([
301
+ (0, type_graphql_1.Mutation)(returns => Boolean, {
302
+ description: 'Delete a task from Label Studio'
303
+ }),
304
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "mutation")'),
305
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('taskId', type => type_graphql_1.Int)),
306
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
307
+ tslib_1.__metadata("design:type", Function),
308
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
309
+ tslib_1.__metadata("design:returntype", Promise)
310
+ ], TaskManagement.prototype, "deleteLabelStudioTask", null);
311
+ tslib_1.__decorate([
312
+ (0, type_graphql_1.Query)(returns => [label_studio_types_js_1.LabelStudioAnnotation], {
313
+ description: 'Get all annotations for a task'
314
+ }),
315
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "query")'),
316
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('taskId', type => type_graphql_1.Int)),
317
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
318
+ tslib_1.__metadata("design:type", Function),
319
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
320
+ tslib_1.__metadata("design:returntype", Promise)
321
+ ], TaskManagement.prototype, "labelStudioTaskAnnotations", null);
322
+ tslib_1.__decorate([
323
+ (0, type_graphql_1.Mutation)(returns => label_studio_types_js_1.ExportResult, {
324
+ description: 'Export annotations from a Label Studio project'
325
+ }),
326
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "query")'),
327
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId', type => type_graphql_1.Int)),
328
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('format', { defaultValue: 'JSON' })),
329
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
330
+ tslib_1.__metadata("design:type", Function),
331
+ tslib_1.__metadata("design:paramtypes", [Number, String, Object]),
332
+ tslib_1.__metadata("design:returntype", Promise)
333
+ ], TaskManagement.prototype, "exportLabelStudioAnnotations", null);
334
+ tslib_1.__decorate([
335
+ (0, type_graphql_1.Mutation)(returns => type_graphql_1.Int, {
336
+ description: 'Sync completed annotations from Label Studio to Things-Factory database'
337
+ }),
338
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "mutation")'),
339
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId', type => type_graphql_1.Int)),
340
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
341
+ tslib_1.__metadata("design:type", Function),
342
+ tslib_1.__metadata("design:paramtypes", [Number, Object]),
343
+ tslib_1.__metadata("design:returntype", Promise)
344
+ ], TaskManagement.prototype, "syncAnnotationsToDatabase", null);
345
+ tslib_1.__decorate([
346
+ (0, type_graphql_1.Mutation)(returns => label_studio_types_js_1.TaskImportResult, {
347
+ description: 'Import tasks to Label Studio with flexible data transformation'
348
+ }),
349
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "mutation")'),
350
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId', type => type_graphql_1.Int)),
351
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('input')),
352
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
353
+ tslib_1.__metadata("design:type", Function),
354
+ tslib_1.__metadata("design:paramtypes", [Number, label_studio_types_js_1.ImportTasksWithTransformInput, Object]),
355
+ tslib_1.__metadata("design:returntype", Promise)
356
+ ], TaskManagement.prototype, "importTasksWithTransform", null);
357
+ tslib_1.__decorate([
358
+ (0, type_graphql_1.Mutation)(returns => label_studio_types_js_1.AnnotationExportResult, {
359
+ description: 'Export annotations from Label Studio with flexible format conversion'
360
+ }),
361
+ (0, type_graphql_1.Directive)('@privilege(category: "label-studio", privilege: "query")'),
362
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('projectId', type => type_graphql_1.Int)),
363
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('input')),
364
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
365
+ tslib_1.__metadata("design:type", Function),
366
+ tslib_1.__metadata("design:paramtypes", [Number, label_studio_types_js_1.ExportAnnotationsInput, Object]),
367
+ tslib_1.__metadata("design:returntype", Promise)
368
+ ], TaskManagement.prototype, "exportAnnotationsWithFormat", null);
369
+ exports.TaskManagement = TaskManagement = tslib_1.__decorate([
370
+ (0, type_graphql_1.Resolver)()
371
+ ], TaskManagement);
372
+ //# sourceMappingURL=task-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-management.js","sourceRoot":"","sources":["../../../server/service/task/task-management.ts"],"names":[],"mappings":";;;;AAAA,+CAAkF;AAClF,uFAAuE;AACvE,yEAAiE;AACjE,+EAAsE;AACtE,6EAS0C;AAGnC,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB;;OAEG;IAKG,AAAN,KAAK,CAAC,gBAAgB,CACW,SAAiB,EACe,IAAY,EACN,QAAgB,EAC9E,OAAwB;QAE/B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,2CAAc,CAAC,QAAQ,CAAC,SAAS,EAAE;gBACxD,IAAI;gBACJ,SAAS,EAAE,QAAQ;aACpB,CAAC,CAAA;YAEF,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,CAAA;YAE5D,OA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G,GAAE,CAAA;;;;kEAkBP;AAUK;IAJL,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,kBAAG,EAAE;QACxB,WAAW,EAAE,yEAAyE;KACvF,CAAC;IACD,IAAA,wBAAS,EAAC,6DAA6D,CAAC;IAEtE,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC,CAAA;IAC7B,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAwBP;AAUK;IAJL,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,wCAAgB,EAAE;QACrC,WAAW,EAAE,gEAAgE;KAC9E,CAAC;IACD,IAAA,wBAAS,EAAC,6DAA6D,CAAC;IAEtE,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC,CAAA;IAC7B,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDADe,qDAA6B;;8DA6CnD;AAUK;IAJL,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,8CAAsB,EAAE;QAC3C,WAAW,EAAE,sEAAsE;KACpF,CAAC;IACD,IAAA,wBAAS,EAAC,0DAA0D,CAAC;IAEnE,mBAAA,IAAA,kBAAG,EAAC,WAAW,EAAE,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC,CAAA;IAC7B,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDADe,8CAAsB;;iEA+B5C;yBAzVU,cAAc;IAD1B,IAAA,uBAAQ,GAAE;GACE,cAAc,CA0V1B","sourcesContent":["import { Resolver, Query, Mutation, Arg, Ctx, Int, Directive } from 'type-graphql'\nimport { labelStudioApi } from '../../utils/label-studio-api-client.js'\nimport { TaskTransformer } from '../../utils/task-transformer.js'\nimport { exportAnnotations } from '../../utils/annotation-exporter.js'\nimport {\n LabelStudioTask,\n TaskDataInput,\n TaskImportResult,\n LabelStudioAnnotation,\n ExportResult,\n ImportTasksWithTransformInput,\n ExportAnnotationsInput,\n AnnotationExportResult\n} from '../../types/label-studio-types.js'\n\n@Resolver()\nexport class TaskManagement {\n /**\n * Get tasks for a project\n */\n @Query(returns => [LabelStudioTask], {\n description: 'Get all tasks for a Label Studio project'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"query\")')\n async labelStudioTasks(\n @Arg('projectId', type => Int) projectId: number,\n @Arg('page', type => Int, { nullable: true, defaultValue: 1 }) page: number,\n @Arg('pageSize', type => Int, { nullable: true, defaultValue: 100 }) pageSize: number,\n @Ctx() context: ResolverContext\n ): Promise<LabelStudioTask[]> {\n try {\n const response = await labelStudioApi.getTasks(projectId, {\n page,\n page_size: pageSize\n })\n\n const tasks = response.tasks || response.results || response\n\n return tasks.map((task: any) => ({\n id: task.id,\n data: JSON.stringify(task.data),\n annotationCount: task.annotations?.length || task.total_annotations || 0,\n isCompleted: task.is_labeled || false,\n createdAt: task.created_at ? new Date(task.created_at) : undefined\n }))\n } catch (error) {\n console.error(`Failed to fetch tasks for project ${projectId}:`, error)\n throw new Error(`Failed to fetch tasks: ${error.message}`)\n }\n }\n\n /**\n * Get single task by ID\n */\n @Query(returns => LabelStudioTask, {\n description: 'Get a single task by ID',\n nullable: true\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"query\")')\n async labelStudioTask(\n @Arg('taskId', type => Int) taskId: number,\n @Ctx() context: ResolverContext\n ): Promise<LabelStudioTask | null> {\n try {\n const task = await labelStudioApi.getTask(taskId)\n\n if (!task) {\n return null\n }\n\n return {\n id: task.id,\n data: JSON.stringify(task.data),\n annotationCount: task.annotations?.length || task.total_annotations || 0,\n isCompleted: task.is_labeled || false,\n createdAt: task.created_at ? new Date(task.created_at) : undefined\n }\n } catch (error) {\n console.error(`Failed to fetch task ${taskId}:`, error)\n return null\n }\n }\n\n /**\n * Import tasks to Label Studio project\n */\n @Mutation(returns => TaskImportResult, {\n description: 'Import tasks to a Label Studio project in bulk'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"mutation\")')\n async importTasksToLabelStudio(\n @Arg('projectId', type => Int) projectId: number,\n @Arg('tasks', type => [TaskDataInput]) tasks: TaskDataInput[],\n @Ctx() context: ResolverContext\n ): Promise<TaskImportResult> {\n const errors: string[] = []\n const taskIds: number[] = []\n let imported = 0\n let failed = 0\n\n try {\n // Parse task data\n const parsedTasks = tasks.map(task => {\n try {\n return JSON.parse(task.data)\n } catch (e) {\n failed++\n errors.push(`Invalid JSON in task data: ${task.data}`)\n return null\n }\n })\n\n const validTasks = parsedTasks.filter(task => task !== null)\n\n if (validTasks.length === 0) {\n return {\n imported: 0,\n failed: tasks.length,\n taskIds: [],\n errors\n }\n }\n\n // Import tasks using Label Studio API\n const response = await labelStudioApi.importTasks(projectId, validTasks)\n\n // Parse response\n if (response.task_count !== undefined) {\n imported = response.task_count\n } else if (response.annotation_count !== undefined) {\n imported = response.annotation_count\n } else if (Array.isArray(response)) {\n imported = response.length\n taskIds.push(...response.map((t: any) => t.id))\n }\n\n return {\n imported,\n failed,\n taskIds,\n errors: errors.length > 0 ? errors : undefined\n }\n } catch (error) {\n console.error(`Failed to import tasks to project ${projectId}:`, error)\n throw new Error(`Failed to import tasks: ${error.message}`)\n }\n }\n\n /**\n * Delete task\n */\n @Mutation(returns => Boolean, {\n description: 'Delete a task from Label Studio'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"mutation\")')\n async deleteLabelStudioTask(\n @Arg('taskId', type => Int) taskId: number,\n @Ctx() context: ResolverContext\n ): Promise<boolean> {\n try {\n await labelStudioApi.deleteTask(taskId)\n return true\n } catch (error) {\n console.error(`Failed to delete task ${taskId}:`, error)\n throw new Error(`Failed to delete task: ${error.message}`)\n }\n }\n\n /**\n * Get annotations for a task\n */\n @Query(returns => [LabelStudioAnnotation], {\n description: 'Get all annotations for a task'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"query\")')\n async labelStudioTaskAnnotations(\n @Arg('taskId', type => Int) taskId: number,\n @Ctx() context: ResolverContext\n ): Promise<LabelStudioAnnotation[]> {\n try {\n const annotations = await labelStudioApi.getAnnotations(taskId)\n\n return annotations.map((annotation: any) => ({\n id: annotation.id,\n taskId: annotation.task || taskId,\n result: JSON.stringify(annotation.result),\n completedBy: annotation.completed_by?.email || 'unknown',\n createdAt: new Date(annotation.created_at),\n leadTime: annotation.lead_time || undefined\n }))\n } catch (error) {\n console.error(`Failed to fetch annotations for task ${taskId}:`, error)\n throw new Error(`Failed to fetch annotations: ${error.message}`)\n }\n }\n\n /**\n * Export annotations from project\n */\n @Mutation(returns => ExportResult, {\n description: 'Export annotations from a Label Studio project'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"query\")')\n async exportLabelStudioAnnotations(\n @Arg('projectId', type => Int) projectId: number,\n @Arg('format', { defaultValue: 'JSON' })\n format: 'JSON' | 'JSON_MIN' | 'CSV' | 'TSV' | 'CONLL2003' | 'COCO' | 'VOC' | 'YOLO',\n @Ctx() context: ResolverContext\n ): Promise<ExportResult> {\n try {\n const exportData = await labelStudioApi.exportAnnotations(projectId, format)\n\n // For JSON exports, we get the data directly\n // For file exports, we might get a download URL\n const annotationCount = Array.isArray(exportData) ? exportData.length : 0\n\n return {\n exportPath: JSON.stringify(exportData), // In practice, this would be a file path or URL\n annotationCount,\n format\n }\n } catch (error) {\n console.error(`Failed to export annotations from project ${projectId}:`, error)\n throw new Error(`Failed to export annotations: ${error.message}`)\n }\n }\n\n /**\n * Sync completed annotations to Things-Factory database\n * This allows storing annotations in TF for further processing\n */\n @Mutation(returns => Int, {\n description: 'Sync completed annotations from Label Studio to Things-Factory database'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"mutation\")')\n async syncAnnotationsToDatabase(\n @Arg('projectId', type => Int) projectId: number,\n @Ctx() context: ResolverContext\n ): Promise<number> {\n try {\n const { domain } = context.state\n\n // Export annotations\n const annotations = await labelStudioApi.exportAnnotations(projectId, 'JSON')\n\n // TODO: Store annotations in Things-Factory database\n // This would typically involve:\n // 1. Creating an Annotation entity\n // 2. Saving each annotation with project reference\n // 3. Linking to Things-Factory business objects if needed\n\n // For now, just return count\n const count = Array.isArray(annotations) ? annotations.length : 0\n\n console.log(`Synced ${count} annotations from project ${projectId} to database`)\n\n return count\n } catch (error) {\n console.error(`Failed to sync annotations from project ${projectId}:`, error)\n throw new Error(`Failed to sync annotations: ${error.message}`)\n }\n }\n\n /**\n * Import tasks with flexible data transformation\n * Uses TaskTransformer for mapping source data to Label Studio format\n */\n @Mutation(returns => TaskImportResult, {\n description: 'Import tasks to Label Studio with flexible data transformation'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"mutation\")')\n async importTasksWithTransform(\n @Arg('projectId', type => Int) projectId: number,\n @Arg('input') input: ImportTasksWithTransformInput,\n @Ctx() context: ResolverContext\n ): Promise<TaskImportResult> {\n const errors: string[] = []\n const taskIds: number[] = []\n let imported = 0\n let failed = 0\n\n try {\n // Parse source data\n const sourceData = JSON.parse(input.sourceData)\n if (!Array.isArray(sourceData)) {\n throw new Error('Source data must be an array')\n }\n\n // Parse transform rule\n const dataFields = JSON.parse(input.transformRule.dataFields)\n const predictions = input.transformRule.predictions ? JSON.parse(input.transformRule.predictions) : undefined\n const meta = input.transformRule.meta ? JSON.parse(input.transformRule.meta) : undefined\n\n // Transform data using TaskTransformer\n const lsTasks = TaskTransformer.transform(sourceData, {\n dataFields,\n predictions,\n meta\n })\n\n // Import to Label Studio\n const response = await labelStudioApi.importTasks(projectId, lsTasks)\n\n if (response.task_count) {\n imported = response.task_count\n taskIds.push(...(response.task_ids || []))\n }\n\n return {\n imported,\n failed,\n taskIds,\n errors: errors.length > 0 ? errors : undefined\n }\n } catch (error) {\n console.error(`Failed to import tasks with transform for project ${projectId}:`, error)\n throw new Error(`Failed to import tasks: ${error.message}`)\n }\n }\n\n /**\n * Export annotations with flexible format conversion\n * Uses AnnotationExporter for custom format support\n */\n @Mutation(returns => AnnotationExportResult, {\n description: 'Export annotations from Label Studio with flexible format conversion'\n })\n @Directive('@privilege(category: \"label-studio\", privilege: \"query\")')\n async exportAnnotationsWithFormat(\n @Arg('projectId', type => Int) projectId: number,\n @Arg('input') input: ExportAnnotationsInput,\n @Ctx() context: ResolverContext\n ): Promise<AnnotationExportResult> {\n try {\n // Get annotations from Label Studio\n let annotations = await labelStudioApi.exportAnnotations(projectId, 'JSON')\n\n // Filter by task IDs if specified\n if (input.taskIds) {\n const taskIds = JSON.parse(input.taskIds) as number[]\n annotations = annotations.filter((a: any) => taskIds.includes(a.task))\n }\n\n // Export using custom format\n const exportedData = await exportAnnotations(annotations, input.format, {\n projectId,\n exportedAt: new Date().toISOString()\n })\n\n // Convert to string if not already\n const dataString = typeof exportedData === 'string' ? exportedData : JSON.stringify(exportedData)\n\n return {\n data: dataString,\n count: annotations.length,\n format: input.format\n }\n } catch (error) {\n console.error(`Failed to export annotations for project ${projectId}:`, error)\n throw new Error(`Failed to export annotations: ${error.message}`)\n }\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ declare class UserSyncResult {
2
+ success: boolean;
3
+ email: string;
4
+ action: string;
5
+ lsUserId?: string;
6
+ lsPermissions?: string;
7
+ error?: string;
8
+ }
9
+ declare class UserSyncSummary {
10
+ total: number;
11
+ created: number;
12
+ updated: number;
13
+ deactivated: number;
14
+ skipped: number;
15
+ errors: number;
16
+ results: UserSyncResult[];
17
+ }
18
+ export declare class UserSyncMutation {
19
+ /**
20
+ * 현재 사용자를 Label Studio에 동기화
21
+ */
22
+ syncMyUserToLabelStudio(context: ResolverContext): Promise<UserSyncResult>;
23
+ /**
24
+ * 도메인의 모든 사용자를 Label Studio에 일괄 동기화
25
+ */
26
+ syncAllUsersToLabelStudio(context: ResolverContext): Promise<UserSyncSummary>;
27
+ }
28
+ export {};
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserSyncMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const user_provisioning_service_js_1 = require("../../controller/user-provisioning-service.js");
7
+ let UserSyncResult = class UserSyncResult {
8
+ };
9
+ tslib_1.__decorate([
10
+ (0, type_graphql_1.Field)(),
11
+ tslib_1.__metadata("design:type", Boolean)
12
+ ], UserSyncResult.prototype, "success", void 0);
13
+ tslib_1.__decorate([
14
+ (0, type_graphql_1.Field)(),
15
+ tslib_1.__metadata("design:type", String)
16
+ ], UserSyncResult.prototype, "email", void 0);
17
+ tslib_1.__decorate([
18
+ (0, type_graphql_1.Field)(),
19
+ tslib_1.__metadata("design:type", String)
20
+ ], UserSyncResult.prototype, "action", void 0);
21
+ tslib_1.__decorate([
22
+ (0, type_graphql_1.Field)({ nullable: true }),
23
+ tslib_1.__metadata("design:type", String)
24
+ ], UserSyncResult.prototype, "lsUserId", void 0);
25
+ tslib_1.__decorate([
26
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Label Studio permissions (Admin/Staff/Inactive)' }),
27
+ tslib_1.__metadata("design:type", String)
28
+ ], UserSyncResult.prototype, "lsPermissions", void 0);
29
+ tslib_1.__decorate([
30
+ (0, type_graphql_1.Field)({ nullable: true }),
31
+ tslib_1.__metadata("design:type", String)
32
+ ], UserSyncResult.prototype, "error", void 0);
33
+ UserSyncResult = tslib_1.__decorate([
34
+ (0, type_graphql_1.ObjectType)({ description: 'User synchronization result' })
35
+ ], UserSyncResult);
36
+ let UserSyncSummary = class UserSyncSummary {
37
+ };
38
+ tslib_1.__decorate([
39
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
40
+ tslib_1.__metadata("design:type", Number)
41
+ ], UserSyncSummary.prototype, "total", void 0);
42
+ tslib_1.__decorate([
43
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
44
+ tslib_1.__metadata("design:type", Number)
45
+ ], UserSyncSummary.prototype, "created", void 0);
46
+ tslib_1.__decorate([
47
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
48
+ tslib_1.__metadata("design:type", Number)
49
+ ], UserSyncSummary.prototype, "updated", void 0);
50
+ tslib_1.__decorate([
51
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
52
+ tslib_1.__metadata("design:type", Number)
53
+ ], UserSyncSummary.prototype, "deactivated", void 0);
54
+ tslib_1.__decorate([
55
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
56
+ tslib_1.__metadata("design:type", Number)
57
+ ], UserSyncSummary.prototype, "skipped", void 0);
58
+ tslib_1.__decorate([
59
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int),
60
+ tslib_1.__metadata("design:type", Number)
61
+ ], UserSyncSummary.prototype, "errors", void 0);
62
+ tslib_1.__decorate([
63
+ (0, type_graphql_1.Field)(type => [UserSyncResult]),
64
+ tslib_1.__metadata("design:type", Array)
65
+ ], UserSyncSummary.prototype, "results", void 0);
66
+ UserSyncSummary = tslib_1.__decorate([
67
+ (0, type_graphql_1.ObjectType)({ description: 'User synchronization summary' })
68
+ ], UserSyncSummary);
69
+ let UserSyncMutation = class UserSyncMutation {
70
+ /**
71
+ * 현재 사용자를 Label Studio에 동기화
72
+ */
73
+ async syncMyUserToLabelStudio(context) {
74
+ const { user, domain } = context.state;
75
+ const result = await user_provisioning_service_js_1.UserProvisioningService.syncUser(domain, user);
76
+ return result;
77
+ }
78
+ /**
79
+ * 도메인의 모든 사용자를 Label Studio에 일괄 동기화
80
+ */
81
+ async syncAllUsersToLabelStudio(context) {
82
+ const { domain } = context.state;
83
+ const summary = await user_provisioning_service_js_1.UserProvisioningService.syncAllUsers(domain);
84
+ return summary;
85
+ }
86
+ };
87
+ exports.UserSyncMutation = UserSyncMutation;
88
+ tslib_1.__decorate([
89
+ (0, type_graphql_1.Mutation)(returns => UserSyncResult, {
90
+ description: 'Synchronize current user to Label Studio'
91
+ }),
92
+ (0, type_graphql_1.Directive)('@privilege(domainOwnerGranted: true)'),
93
+ tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
94
+ tslib_1.__metadata("design:type", Function),
95
+ tslib_1.__metadata("design:paramtypes", [Object]),
96
+ tslib_1.__metadata("design:returntype", Promise)
97
+ ], UserSyncMutation.prototype, "syncMyUserToLabelStudio", null);
98
+ tslib_1.__decorate([
99
+ (0, type_graphql_1.Mutation)(returns => UserSyncSummary, {
100
+ description: 'Synchronize all domain users to Label Studio (batch operation)'
101
+ }),
102
+ (0, type_graphql_1.Directive)('@privilege(domainOwnerGranted: true)'),
103
+ tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
104
+ tslib_1.__metadata("design:type", Function),
105
+ tslib_1.__metadata("design:paramtypes", [Object]),
106
+ tslib_1.__metadata("design:returntype", Promise)
107
+ ], UserSyncMutation.prototype, "syncAllUsersToLabelStudio", null);
108
+ exports.UserSyncMutation = UserSyncMutation = tslib_1.__decorate([
109
+ (0, type_graphql_1.Resolver)()
110
+ ], UserSyncMutation);
111
+ //# sourceMappingURL=user-sync-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-sync-mutation.js","sourceRoot":"","sources":["../../../server/service/user-provisioning/user-sync-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAyF;AACzF,gGAAuF;AAGvF,IAAM,cAAc,GAApB,MAAM,cAAc;CAkBnB,CAAA;AAhBC;IADC,IAAA,oBAAK,GAAE;;+CACQ;AAGhB;IADC,IAAA,oBAAK,GAAE;;6CACK;AAGb;IADC,IAAA,oBAAK,GAAE;;8CACM;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;qDACpE;AAGtB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACZ;AAjBV,cAAc;IADnB,IAAA,yBAAU,EAAC,EA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CAAC,CAAA;QAElE,OAAO,OAA0B,CAAA;IACnC,CAAC;CACF,CAAA;AA9BY,4CAAgB;AAQrB;IAJL,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,cAAc,EAAE;QACnC,WAAW,EAAE,0CAA0C;KACxD,CAAC;IACD,IAAA,wBAAS,EAAC,sCAAsC,CAAC;IACnB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+DAMnC;AASK;IAJL,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,eAAe,EAAE;QACpC,WAAW,EAAE,gEAAgE;KAC9E,CAAC;IACD,IAAA,wBAAS,EAAC,sCAAsC,CAAC;IACjB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;iEAMrC;2BA7BU,gBAAgB;IAD5B,IAAA,uBAAQ,GAAE;GACE,gBAAgB,CA8B5B","sourcesContent":["import { Resolver, Mutation, Ctx, Field, ObjectType, Int, Directive } from 'type-graphql'\nimport { UserProvisioningService } from '../../controller/user-provisioning-service.js'\n\n@ObjectType({ description: 'User synchronization result' })\nclass UserSyncResult {\n @Field()\n success: boolean\n\n @Field()\n email: string\n\n @Field()\n action: string\n\n @Field({ nullable: true })\n lsUserId?: string\n\n @Field({ nullable: true, description: 'Label Studio permissions (Admin/Staff/Inactive)' })\n lsPermissions?: string\n\n @Field({ nullable: true })\n error?: string\n}\n\n@ObjectType({ description: 'User synchronization summary' })\nclass UserSyncSummary {\n @Field(type => Int)\n total: number\n\n @Field(type => Int)\n created: number\n\n @Field(type => Int)\n updated: number\n\n @Field(type => Int)\n deactivated: number\n\n @Field(type => Int)\n skipped: number\n\n @Field(type => Int)\n errors: number\n\n @Field(type => [UserSyncResult])\n results: UserSyncResult[]\n}\n\n@Resolver()\nexport class UserSyncMutation {\n /**\n * 현재 사용자를 Label Studio에 동기화\n */\n @Mutation(returns => UserSyncResult, {\n description: 'Synchronize current user to Label Studio'\n })\n @Directive('@privilege(domainOwnerGranted: true)')\n async syncMyUserToLabelStudio(@Ctx() context: ResolverContext): Promise<UserSyncResult> {\n const { user, domain } = context.state\n\n const result = await UserProvisioningService.syncUser(domain, user)\n\n return result as UserSyncResult\n }\n\n /**\n * 도메인의 모든 사용자를 Label Studio에 일괄 동기화\n */\n @Mutation(returns => UserSyncSummary, {\n description: 'Synchronize all domain users to Label Studio (batch operation)'\n })\n @Directive('@privilege(domainOwnerGranted: true)')\n async syncAllUsersToLabelStudio(@Ctx() context: ResolverContext): Promise<UserSyncSummary> {\n const { domain } = context.state\n\n const summary = await UserProvisioningService.syncAllUsers(domain)\n\n return summary as UserSyncSummary\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ export declare class Webhook {
2
+ id: number;
3
+ url: string;
4
+ projectId: number;
5
+ isActive: boolean;
6
+ sendPayload: boolean;
7
+ }
8
+ export declare class WebhookManagement {
9
+ /**
10
+ * Register webhook for a project
11
+ */
12
+ registerLabelStudioWebhook(projectId: number, context: ResolverContext): Promise<Webhook>;
13
+ /**
14
+ * Get webhooks for a project
15
+ */
16
+ labelStudioWebhooks(projectId: number, context: ResolverContext): Promise<Webhook[]>;
17
+ /**
18
+ * Delete webhook
19
+ */
20
+ deleteLabelStudioWebhook(webhookId: number, context: ResolverContext): Promise<boolean>;
21
+ }