@jumoo/processing 17.4.3-prerelease.2 → 17.4.3-prerelease.4

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.
@@ -1,3 +1,3 @@
1
1
  export { client, type CreateClientConfig } from './client.gen';
2
2
  export { type Options, PipelinesService, QueuesService } from './sdk.gen';
3
- export { type ClearPipelineData, type ClearPipelineError, type ClearPipelineErrors, type ClearPipelineResponses, type ClientOptions, type CreatePipelineData, type CreatePipelineError, type CreatePipelineErrors, type CreatePipelineResponse, type CreatePipelineResponses, type DeleteData, type DeleteError, type DeleteErrors, type DeleteResponses, type GetPipelineData, type GetPipelineError, type GetPipelineErrors, type GetPipelineResponse, type GetPipelineResponses, type GetProcessorsData, type GetProcessorsError, type GetProcessorsErrors, type GetProcessorsResponse, type GetProcessorsResponses, type GetResultsData, type GetResultsError, type GetResultsErrors, type GetResultsResponse, type GetResultsResponses, type ListPipelinesByStrategyData, type ListPipelinesByStrategyError, type ListPipelinesByStrategyErrors, type ListPipelinesByStrategyResponse, type ListPipelinesByStrategyResponses, type ListPipelinesData, type ListPipelinesError, type ListPipelinesErrors, type ListPipelinesResponse, type ListPipelinesResponses, type ListQueueData, type ListQueueError, type ListQueueErrors, type ListQueueResponse, type ListQueueResponses, type PagedModelQueuedItemModel, type PeekItemData, type PeekItemError, type PeekItemErrors, type PeekItemResponse, type PeekItemResponses, type Pipeline, type PipelineBackgroundState, type PipelineCreateRequest, type PipelineState, PipelineStatus, type ProblemDetails, type ProcessData, type ProcessError, type ProcessErrors, type ProcessingChildRequestAction, type ProcessingErrorDetails, type ProcessingOptions, type ProcessingOptionsResults, type ProcessingRequest, type ProcessingRequestAction, type ProcessingResults, type ProcessPipelineData, type ProcessPipelineError, type ProcessPipelineErrors, type ProcessPipelineResponse, type ProcessPipelineResponses, type ProcessResponse, type ProcessResponses, type ProgressInformation, type QueuedItem, type ReattachPipelineData, type ReattachPipelineError, type ReattachPipelineErrors, type ReattachPipelineResponse, type ReattachPipelineResponses, type StepInfo, StepStatus, type UpdatePipelineData, type UpdatePipelineError, type UpdatePipelineErrors, type UpdatePipelineResponse, type UpdatePipelineResponses } from './types.gen';
3
+ export { type CancelPipelineData, type CancelPipelineError, type CancelPipelineErrors, type CancelPipelineResponses, type ClearPipelineData, type ClearPipelineError, type ClearPipelineErrors, type ClearPipelineResponses, type ClientOptions, type CreatePipelineData, type CreatePipelineError, type CreatePipelineErrors, type CreatePipelineResponse, type CreatePipelineResponses, type DeleteData, type DeleteError, type DeleteErrors, type DeleteResponses, type GetPipelineData, type GetPipelineError, type GetPipelineErrors, type GetPipelineResponse, type GetPipelineResponses, type GetProcessorsData, type GetProcessorsError, type GetProcessorsErrors, type GetProcessorsResponse, type GetProcessorsResponses, type GetResultsData, type GetResultsError, type GetResultsErrors, type GetResultsResponse, type GetResultsResponses, type ListPipelinesByStrategyData, type ListPipelinesByStrategyError, type ListPipelinesByStrategyErrors, type ListPipelinesByStrategyResponse, type ListPipelinesByStrategyResponses, type ListPipelinesData, type ListPipelinesError, type ListPipelinesErrors, type ListPipelinesResponse, type ListPipelinesResponses, type ListQueueData, type ListQueueError, type ListQueueErrors, type ListQueueResponse, type ListQueueResponses, type PagedModelQueuedItemModel, type PeekItemData, type PeekItemError, type PeekItemErrors, type PeekItemResponse, type PeekItemResponses, type Pipeline, type PipelineBackgroundState, type PipelineConflictProblemDetails, type PipelineCreateRequest, type PipelineRunError, type PipelineRunProgress, type PipelineRunRejected, PipelineRunRejectedReason, type PipelineRunRequest, type PipelineRunStarted, PipelineRunState, type PipelineRunStatus, type PipelineRunSummary, type PipelineState, PipelineStatus, type PipelineStatusData, type PipelineStatusError, type PipelineStatusErrors, type PipelineStatusResponse, type PipelineStatusResponses, type ProblemDetails, type ProcessData, type ProcessError, type ProcessErrors, type ProcessingChildRequestAction, type ProcessingErrorDetails, type ProcessingOptions, type ProcessingOptionsResults, type ProcessingRequest, type ProcessingRequestAction, type ProcessingResults, type ProcessPipelineData, type ProcessPipelineError, type ProcessPipelineErrors, type ProcessPipelineResponse, type ProcessPipelineResponses, type ProcessResponse, type ProcessResponses, type ProgressInformation, type QueuedItem, type ReattachPipelineData, type ReattachPipelineError, type ReattachPipelineErrors, type ReattachPipelineResponse, type ReattachPipelineResponses, type StartPipelineData, type StartPipelineError, type StartPipelineErrors, type StartPipelineResponse, type StartPipelineResponses, type StepInfo, StepStatus, type UpdatePipelineData, type UpdatePipelineError, type UpdatePipelineErrors, type UpdatePipelineResponse, type UpdatePipelineResponses } from './types.gen';
package/dist/api/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
  export { client } from './client.gen';
3
3
  export { PipelinesService, QueuesService } from './sdk.gen';
4
- export { PipelineStatus, StepStatus } from './types.gen';
4
+ export { PipelineRunRejectedReason, PipelineRunState, PipelineStatus, StepStatus } from './types.gen';
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { ClearPipelineData, ClearPipelineErrors, ClearPipelineResponses, CreatePipelineData, CreatePipelineErrors, CreatePipelineResponses, DeleteData, DeleteErrors, DeleteResponses, GetPipelineData, GetPipelineErrors, GetPipelineResponses, GetProcessorsData, GetProcessorsErrors, GetProcessorsResponses, GetResultsData, GetResultsErrors, GetResultsResponses, ListPipelinesByStrategyData, ListPipelinesByStrategyErrors, ListPipelinesByStrategyResponses, ListPipelinesData, ListPipelinesErrors, ListPipelinesResponses, ListQueueData, ListQueueErrors, ListQueueResponses, PeekItemData, PeekItemErrors, PeekItemResponses, ProcessData, ProcessErrors, ProcessPipelineData, ProcessPipelineErrors, ProcessPipelineResponses, ProcessResponses, ReattachPipelineData, ReattachPipelineErrors, ReattachPipelineResponses, UpdatePipelineData, UpdatePipelineErrors, UpdatePipelineResponses } from './types.gen';
2
+ import type { CancelPipelineData, CancelPipelineErrors, CancelPipelineResponses, ClearPipelineData, ClearPipelineErrors, ClearPipelineResponses, CreatePipelineData, CreatePipelineErrors, CreatePipelineResponses, DeleteData, DeleteErrors, DeleteResponses, GetPipelineData, GetPipelineErrors, GetPipelineResponses, GetProcessorsData, GetProcessorsErrors, GetProcessorsResponses, GetResultsData, GetResultsErrors, GetResultsResponses, ListPipelinesByStrategyData, ListPipelinesByStrategyErrors, ListPipelinesByStrategyResponses, ListPipelinesData, ListPipelinesErrors, ListPipelinesResponses, ListQueueData, ListQueueErrors, ListQueueResponses, PeekItemData, PeekItemErrors, PeekItemResponses, PipelineStatusData, PipelineStatusErrors, PipelineStatusResponses, ProcessData, ProcessErrors, ProcessPipelineData, ProcessPipelineErrors, ProcessPipelineResponses, ProcessResponses, ReattachPipelineData, ReattachPipelineErrors, ReattachPipelineResponses, StartPipelineData, StartPipelineErrors, StartPipelineResponses, UpdatePipelineData, UpdatePipelineErrors, UpdatePipelineResponses } from './types.gen';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -14,6 +14,7 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
14
14
  meta?: Record<string, unknown>;
15
15
  };
16
16
  export declare class PipelinesService {
17
+ static cancelPipeline<ThrowOnError extends boolean = true>(options: Options<CancelPipelineData, ThrowOnError>): import("./client").RequestResult<CancelPipelineResponses, CancelPipelineErrors, ThrowOnError, "fields">;
17
18
  static clearPipeline<ThrowOnError extends boolean = true>(options: Options<ClearPipelineData, ThrowOnError>): import("./client").RequestResult<ClearPipelineResponses, ClearPipelineErrors, ThrowOnError, "fields">;
18
19
  static createPipeline<ThrowOnError extends boolean = true>(options?: Options<CreatePipelineData, ThrowOnError>): import("./client").RequestResult<CreatePipelineResponses, CreatePipelineErrors, ThrowOnError, "fields">;
19
20
  static getPipeline<ThrowOnError extends boolean = true>(options: Options<GetPipelineData, ThrowOnError>): import("./client").RequestResult<GetPipelineResponses, GetPipelineErrors, ThrowOnError, "fields">;
@@ -21,8 +22,10 @@ export declare class PipelinesService {
21
22
  static getResults<ThrowOnError extends boolean = true>(options: Options<GetResultsData, ThrowOnError>): import("./client").RequestResult<GetResultsResponses, GetResultsErrors, ThrowOnError, "fields">;
22
23
  static listPipelines<ThrowOnError extends boolean = true>(options: Options<ListPipelinesData, ThrowOnError>): import("./client").RequestResult<ListPipelinesResponses, ListPipelinesErrors, ThrowOnError, "fields">;
23
24
  static listPipelinesByStrategy<ThrowOnError extends boolean = true>(options: Options<ListPipelinesByStrategyData, ThrowOnError>): import("./client").RequestResult<ListPipelinesByStrategyResponses, ListPipelinesByStrategyErrors, ThrowOnError, "fields">;
25
+ static pipelineStatus<ThrowOnError extends boolean = true>(options: Options<PipelineStatusData, ThrowOnError>): import("./client").RequestResult<PipelineStatusResponses, PipelineStatusErrors, ThrowOnError, "fields">;
24
26
  static processPipeline<ThrowOnError extends boolean = true>(options: Options<ProcessPipelineData, ThrowOnError>): import("./client").RequestResult<ProcessPipelineResponses, ProcessPipelineErrors, ThrowOnError, "fields">;
25
27
  static reattachPipeline<ThrowOnError extends boolean = true>(options: Options<ReattachPipelineData, ThrowOnError>): import("./client").RequestResult<ReattachPipelineResponses, ReattachPipelineErrors, ThrowOnError, "fields">;
28
+ static startPipeline<ThrowOnError extends boolean = true>(options?: Options<StartPipelineData, ThrowOnError>): import("./client").RequestResult<StartPipelineResponses, StartPipelineErrors, ThrowOnError, "fields">;
26
29
  static updatePipeline<ThrowOnError extends boolean = true>(options: Options<UpdatePipelineData, ThrowOnError>): import("./client").RequestResult<UpdatePipelineResponses, UpdatePipelineErrors, ThrowOnError, "fields">;
27
30
  }
28
31
  export declare class QueuesService {
@@ -1,6 +1,13 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
  import { client } from './client.gen';
3
3
  export class PipelinesService {
4
+ static cancelPipeline(options) {
5
+ return (options.client ?? client).post({
6
+ security: [{ scheme: 'bearer', type: 'http' }],
7
+ url: '/umbraco/jumoo/api/v1/processing/CancelPipeline/{id}',
8
+ ...options
9
+ });
10
+ }
4
11
  static clearPipeline(options) {
5
12
  return (options.client ?? client).post({
6
13
  security: [{ scheme: 'bearer', type: 'http' }],
@@ -54,6 +61,13 @@ export class PipelinesService {
54
61
  ...options
55
62
  });
56
63
  }
64
+ static pipelineStatus(options) {
65
+ return (options.client ?? client).get({
66
+ security: [{ scheme: 'bearer', type: 'http' }],
67
+ url: '/umbraco/jumoo/api/v1/processing/PipelineStatus/{id}',
68
+ ...options
69
+ });
70
+ }
57
71
  static processPipeline(options) {
58
72
  return (options.client ?? client).post({
59
73
  security: [{ scheme: 'bearer', type: 'http' }],
@@ -68,6 +82,17 @@ export class PipelinesService {
68
82
  ...options
69
83
  });
70
84
  }
85
+ static startPipeline(options) {
86
+ return (options?.client ?? client).post({
87
+ security: [{ scheme: 'bearer', type: 'http' }],
88
+ url: '/umbraco/jumoo/api/v1/processing/StartPipeline',
89
+ ...options,
90
+ headers: {
91
+ 'Content-Type': 'application/json',
92
+ ...options?.headers
93
+ }
94
+ });
95
+ }
71
96
  static updatePipeline(options) {
72
97
  return (options.client ?? client).post({
73
98
  security: [{ scheme: 'bearer', type: 'http' }],
@@ -20,12 +20,84 @@ export type PipelineBackgroundState = {
20
20
  failedElement?: string | null;
21
21
  clientId?: string | null;
22
22
  };
23
+ export type PipelineConflictProblemDetails = {
24
+ type?: string | null;
25
+ title?: string | null;
26
+ status?: number | null;
27
+ detail?: string | null;
28
+ instance?: string | null;
29
+ runningPipelineId: string;
30
+ concurrencyKey: string;
31
+ [key: string]: unknown;
32
+ };
23
33
  export type PipelineCreateRequest = {
24
34
  alias: string;
25
35
  strategy: string;
26
36
  options?: ProcessingOptions | null;
27
37
  clientId?: string | null;
28
38
  };
39
+ export type PipelineRunError = {
40
+ message: string;
41
+ action?: string | null;
42
+ step?: string | null;
43
+ };
44
+ export type PipelineRunProgress = {
45
+ percentage: number;
46
+ action?: string | null;
47
+ step?: string | null;
48
+ page: number;
49
+ };
50
+ export type PipelineRunRejected = {
51
+ reason: PipelineRunRejectedReason;
52
+ message: string;
53
+ runningPipelineId?: string | null;
54
+ concurrencyKey?: string | null;
55
+ };
56
+ export declare enum PipelineRunRejectedReason {
57
+ NOT_FOUND = "NotFound",
58
+ ALREADY_RUNNING = "AlreadyRunning",
59
+ INVALID = "Invalid"
60
+ }
61
+ export type PipelineRunRequest = {
62
+ processor: string;
63
+ strategy: string;
64
+ options?: ProcessingOptions | null;
65
+ startAtUtc?: string | null;
66
+ clientId?: string | null;
67
+ };
68
+ export type PipelineRunStarted = {
69
+ pipelineId: string;
70
+ status: PipelineRunState;
71
+ statusUrl: string;
72
+ };
73
+ export declare enum PipelineRunState {
74
+ QUEUED = "Queued",
75
+ RUNNING = "Running",
76
+ SCHEDULED = "Scheduled",
77
+ WAITING = "Waiting",
78
+ COMPLETED = "Completed",
79
+ FAILED = "Failed",
80
+ CANCELLED = "Cancelled"
81
+ }
82
+ export type PipelineRunStatus = {
83
+ pipelineId: string;
84
+ processor: string;
85
+ strategy: string;
86
+ status: PipelineRunState;
87
+ complete: boolean;
88
+ succeeded: boolean;
89
+ cancelRequested: boolean;
90
+ progress: PipelineRunProgress;
91
+ startedBy?: string | null;
92
+ created?: string | null;
93
+ modified?: string | null;
94
+ scheduledFor?: string | null;
95
+ error?: PipelineRunError | null;
96
+ summary?: PipelineRunSummary | null;
97
+ };
98
+ export type PipelineRunSummary = {
99
+ [key: string]: unknown;
100
+ };
29
101
  export type PipelineState = {
30
102
  status: PipelineStatus;
31
103
  childPipeline?: string | null;
@@ -35,6 +107,11 @@ export type PipelineState = {
35
107
  schedule?: string | null;
36
108
  backgroundState?: PipelineBackgroundState | null;
37
109
  isChildPipeline: boolean;
110
+ cancelRequested: boolean;
111
+ concurrencyKey?: string | null;
112
+ userKey?: string | null;
113
+ created?: string | null;
114
+ modified?: string | null;
38
115
  };
39
116
  export declare enum PipelineStatus {
40
117
  NOT_STARTED = "NotStarted",
@@ -43,7 +120,8 @@ export declare enum PipelineStatus {
43
120
  WAITING = "Waiting",
44
121
  SCHEDULED = "Scheduled",
45
122
  COMPLETED = "Completed",
46
- FAILED = "Failed"
123
+ FAILED = "Failed",
124
+ CANCELLED = "Cancelled"
47
125
  }
48
126
  export type ProblemDetails = {
49
127
  type?: string | null;
@@ -134,6 +212,8 @@ export type QueuedItem = {
134
212
  note?: string | null;
135
213
  claimedBy?: string | null;
136
214
  claimedUntil?: string | null;
215
+ ownerNode?: string | null;
216
+ ownerHeartbeat?: string | null;
137
217
  };
138
218
  export type StepInfo = {
139
219
  icon: string;
@@ -146,6 +226,43 @@ export declare enum StepStatus {
146
226
  COMPLETE = "Complete",
147
227
  ERROR = "Error"
148
228
  }
229
+ export type CancelPipelineData = {
230
+ body?: never;
231
+ path: {
232
+ id: string;
233
+ };
234
+ query?: never;
235
+ url: '/umbraco/jumoo/api/v1/processing/CancelPipeline/{id}';
236
+ };
237
+ export type CancelPipelineErrors = {
238
+ /**
239
+ * Bad Request
240
+ */
241
+ 400: ProblemDetails;
242
+ /**
243
+ * The resource is protected and requires an authentication token
244
+ */
245
+ 401: unknown;
246
+ /**
247
+ * Forbidden
248
+ */
249
+ 403: ProblemDetails;
250
+ /**
251
+ * Not Found
252
+ */
253
+ 404: unknown;
254
+ /**
255
+ * Conflict
256
+ */
257
+ 409: ProblemDetails;
258
+ };
259
+ export type CancelPipelineError = CancelPipelineErrors[keyof CancelPipelineErrors];
260
+ export type CancelPipelineResponses = {
261
+ /**
262
+ * Accepted
263
+ */
264
+ 202: unknown;
265
+ };
149
266
  export type ClearPipelineData = {
150
267
  body?: never;
151
268
  path: {
@@ -190,6 +307,10 @@ export type CreatePipelineErrors = {
190
307
  * Not Found
191
308
  */
192
309
  404: unknown;
310
+ /**
311
+ * Conflict
312
+ */
313
+ 409: PipelineConflictProblemDetails;
193
314
  };
194
315
  export type CreatePipelineError = CreatePipelineErrors[keyof CreatePipelineErrors];
195
316
  export type CreatePipelineResponses = {
@@ -340,6 +461,40 @@ export type ListPipelinesByStrategyResponses = {
340
461
  200: Array<Pipeline>;
341
462
  };
342
463
  export type ListPipelinesByStrategyResponse = ListPipelinesByStrategyResponses[keyof ListPipelinesByStrategyResponses];
464
+ export type PipelineStatusData = {
465
+ body?: never;
466
+ path: {
467
+ id: string;
468
+ };
469
+ query?: never;
470
+ url: '/umbraco/jumoo/api/v1/processing/PipelineStatus/{id}';
471
+ };
472
+ export type PipelineStatusErrors = {
473
+ /**
474
+ * Bad Request
475
+ */
476
+ 400: ProblemDetails;
477
+ /**
478
+ * The resource is protected and requires an authentication token
479
+ */
480
+ 401: unknown;
481
+ /**
482
+ * Forbidden
483
+ */
484
+ 403: ProblemDetails;
485
+ /**
486
+ * Not Found
487
+ */
488
+ 404: unknown;
489
+ };
490
+ export type PipelineStatusError = PipelineStatusErrors[keyof PipelineStatusErrors];
491
+ export type PipelineStatusResponses = {
492
+ /**
493
+ * OK
494
+ */
495
+ 200: PipelineRunStatus;
496
+ };
497
+ export type PipelineStatusResponse = PipelineStatusResponses[keyof PipelineStatusResponses];
343
498
  export type ProcessPipelineData = {
344
499
  body?: never;
345
500
  path: {
@@ -359,6 +514,10 @@ export type ProcessPipelineErrors = {
359
514
  * The resource is protected and requires an authentication token
360
515
  */
361
516
  401: unknown;
517
+ /**
518
+ * Conflict
519
+ */
520
+ 409: PipelineConflictProblemDetails;
362
521
  };
363
522
  export type ProcessPipelineError = ProcessPipelineErrors[keyof ProcessPipelineErrors];
364
523
  export type ProcessPipelineResponses = {
@@ -400,6 +559,38 @@ export type ReattachPipelineResponses = {
400
559
  200: Pipeline;
401
560
  };
402
561
  export type ReattachPipelineResponse = ReattachPipelineResponses[keyof ReattachPipelineResponses];
562
+ export type StartPipelineData = {
563
+ body?: PipelineRunRequest;
564
+ path?: never;
565
+ query?: never;
566
+ url: '/umbraco/jumoo/api/v1/processing/StartPipeline';
567
+ };
568
+ export type StartPipelineErrors = {
569
+ /**
570
+ * Bad Request
571
+ */
572
+ 400: ProblemDetails;
573
+ /**
574
+ * The resource is protected and requires an authentication token
575
+ */
576
+ 401: unknown;
577
+ /**
578
+ * Not Found
579
+ */
580
+ 404: PipelineRunRejected;
581
+ /**
582
+ * Conflict
583
+ */
584
+ 409: PipelineRunRejected;
585
+ };
586
+ export type StartPipelineError = StartPipelineErrors[keyof StartPipelineErrors];
587
+ export type StartPipelineResponses = {
588
+ /**
589
+ * Accepted
590
+ */
591
+ 202: PipelineRunStarted;
592
+ };
593
+ export type StartPipelineResponse = StartPipelineResponses[keyof StartPipelineResponses];
403
594
  export type UpdatePipelineData = {
404
595
  body?: ProcessingOptions;
405
596
  path: {
@@ -417,6 +608,10 @@ export type UpdatePipelineErrors = {
417
608
  * The resource is protected and requires an authentication token
418
609
  */
419
610
  401: unknown;
611
+ /**
612
+ * Conflict
613
+ */
614
+ 409: PipelineConflictProblemDetails;
420
615
  };
421
616
  export type UpdatePipelineError = UpdatePipelineErrors[keyof UpdatePipelineErrors];
422
617
  export type UpdatePipelineResponses = {
@@ -1,4 +1,20 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
+ export var PipelineRunRejectedReason;
3
+ (function (PipelineRunRejectedReason) {
4
+ PipelineRunRejectedReason["NOT_FOUND"] = "NotFound";
5
+ PipelineRunRejectedReason["ALREADY_RUNNING"] = "AlreadyRunning";
6
+ PipelineRunRejectedReason["INVALID"] = "Invalid";
7
+ })(PipelineRunRejectedReason || (PipelineRunRejectedReason = {}));
8
+ export var PipelineRunState;
9
+ (function (PipelineRunState) {
10
+ PipelineRunState["QUEUED"] = "Queued";
11
+ PipelineRunState["RUNNING"] = "Running";
12
+ PipelineRunState["SCHEDULED"] = "Scheduled";
13
+ PipelineRunState["WAITING"] = "Waiting";
14
+ PipelineRunState["COMPLETED"] = "Completed";
15
+ PipelineRunState["FAILED"] = "Failed";
16
+ PipelineRunState["CANCELLED"] = "Cancelled";
17
+ })(PipelineRunState || (PipelineRunState = {}));
2
18
  export var PipelineStatus;
3
19
  (function (PipelineStatus) {
4
20
  PipelineStatus["NOT_STARTED"] = "NotStarted";
@@ -8,6 +24,7 @@ export var PipelineStatus;
8
24
  PipelineStatus["SCHEDULED"] = "Scheduled";
9
25
  PipelineStatus["COMPLETED"] = "Completed";
10
26
  PipelineStatus["FAILED"] = "Failed";
27
+ PipelineStatus["CANCELLED"] = "Cancelled";
11
28
  })(PipelineStatus || (PipelineStatus = {}));
12
29
  export var StepStatus;
13
30
  (function (StepStatus) {
@@ -13,6 +13,14 @@ declare const _default: {
13
13
  method: string;
14
14
  stack: string;
15
15
  };
16
+ jumooProcConflict: {
17
+ headline: string;
18
+ message: string;
19
+ status: string;
20
+ startedBy: string;
21
+ started: string;
22
+ progress: string;
23
+ };
16
24
  jumooProcBackground: {
17
25
  completed: string;
18
26
  error: string;
@@ -13,6 +13,14 @@ export default {
13
13
  method: 'Method',
14
14
  stack: 'Stack',
15
15
  },
16
+ jumooProcConflict: {
17
+ headline: 'Already running',
18
+ message: 'Another process is already running for this target. Wait for it to finish, or cancel it, then try again.',
19
+ status: 'Status',
20
+ startedBy: 'Started by',
21
+ started: 'Started',
22
+ progress: 'Progress',
23
+ },
16
24
  jumooProcBackground: {
17
25
  completed: 'This process has completed in the background',
18
26
  error: 'This process has errored in the background',
@@ -13,6 +13,7 @@ let JumooPipelineBackgroundElement = class JumooPipelineBackgroundElement extend
13
13
  case PipelineStatus.COMPLETED:
14
14
  return this.renderComplete();
15
15
  case PipelineStatus.FAILED:
16
+ case PipelineStatus.CANCELLED:
16
17
  return this.renderError();
17
18
  default:
18
19
  return html `${this.renderBackgroundBanner()} ${this.renderProgress()}`;
@@ -35,6 +35,7 @@ let JumooProcessingPipelineList = class JumooProcessingPipelineList extends UmbL
35
35
  PipelineStatus.RUNNING,
36
36
  PipelineStatus.COMPLETED,
37
37
  PipelineStatus.FAILED,
38
+ PipelineStatus.CANCELLED,
38
39
  ];
39
40
  this._modalPath = '';
40
41
  this.status = PipelineStatus.WAITING;
@@ -5,4 +5,5 @@ export * from './pipeline.element.js';
5
5
  export * from './pipeline.context.js';
6
6
  export * from './pipeline.repository.js';
7
7
  export * from './pipeline.source.js';
8
+ export * from './pipeline-conflict.js';
8
9
  export * from './pipelines.context.js';
@@ -5,4 +5,5 @@ export * from './pipeline.element.js';
5
5
  export * from './pipeline.context.js';
6
6
  export * from './pipeline.repository.js';
7
7
  export * from './pipeline.source.js';
8
+ export * from './pipeline-conflict.js';
8
9
  export * from './pipelines.context.js';
@@ -0,0 +1,31 @@
1
+ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
2
+ import type { PipelineRunStatus } from '../api';
3
+ /**
4
+ * @description a pipeline that couldn't be created or resumed because another one holds its
5
+ * concurrency key (the server's 409 `PipelineConflictProblemDetails`).
6
+ */
7
+ export interface PipelineConflict {
8
+ /** the pipeline holding the key */
9
+ runningPipelineId: string;
10
+ /** the key that is held */
11
+ concurrencyKey: string;
12
+ /** the server's message */
13
+ detail?: string | null;
14
+ /** the holder's status, when the current user can see it */
15
+ holder?: PipelineRunStatus;
16
+ }
17
+ /**
18
+ * @description reads the 409 "already running" body off an error, whether it is the raw
19
+ * problem details the generated client throws or the `UmbApiError` tryExecute wraps it in.
20
+ * @param error the error from a request.
21
+ * @returns the conflict, or undefined for any other error.
22
+ */
23
+ export declare function getPipelineConflict(error: unknown): PipelineConflict | undefined;
24
+ /**
25
+ * @description tryExecute, except a 409 "already running" comes back as the error without a
26
+ * notification, so the caller can show it inline. Every other error notifies as normal.
27
+ * @param host the host the request (and any notification) belongs to.
28
+ * @param promise the request.
29
+ * @returns the response, as tryExecute returns it.
30
+ */
31
+ export declare function tryExecuteAllowingConflict<T>(host: UmbControllerHost, promise: Promise<T>): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<T>>;
@@ -0,0 +1,42 @@
1
+ import { tryExecute, UmbApiError } from '@umbraco-cms/backoffice/resources';
2
+ /**
3
+ * @description reads the 409 "already running" body off an error, whether it is the raw
4
+ * problem details the generated client throws or the `UmbApiError` tryExecute wraps it in.
5
+ * @param error the error from a request.
6
+ * @returns the conflict, or undefined for any other error.
7
+ */
8
+ export function getPipelineConflict(error) {
9
+ const body = UmbApiError.isUmbApiError(error) ? error.problemDetails : error;
10
+ if (!body || typeof body !== 'object')
11
+ return undefined;
12
+ const problem = body;
13
+ if (problem.status !== 409 || typeof problem.runningPipelineId !== 'string')
14
+ return undefined;
15
+ return {
16
+ runningPipelineId: problem.runningPipelineId,
17
+ concurrencyKey: typeof problem.concurrencyKey === 'string' ? problem.concurrencyKey : '',
18
+ detail: typeof problem.detail === 'string' ? problem.detail : undefined,
19
+ };
20
+ }
21
+ /**
22
+ * @description tryExecute, except a 409 "already running" comes back as the error without a
23
+ * notification, so the caller can show it inline. Every other error notifies as normal.
24
+ * @param host the host the request (and any notification) belongs to.
25
+ * @param promise the request.
26
+ * @returns the response, as tryExecute returns it.
27
+ */
28
+ export async function tryExecuteAllowingConflict(host, promise) {
29
+ let conflict;
30
+ const response = await tryExecute(host, promise.catch((error) => {
31
+ if (!getPipelineConflict(error))
32
+ throw error;
33
+ conflict = error;
34
+ return undefined;
35
+ }));
36
+ if (!conflict)
37
+ return response;
38
+ const problem = conflict;
39
+ return {
40
+ error: new UmbApiError(problem.detail ?? problem.title ?? 'Conflict', 409, null, problem),
41
+ };
42
+ }
@@ -1,7 +1,7 @@
1
1
  import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
2
2
  import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
3
3
  import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
4
- import { PipelineState, ProcessingMessage, ProcessingOptions, ProcessingResults } from '@jumoo/processing';
4
+ import { PipelineState, ProcessingMessage, ProcessingOptions, ProcessingResults, PipelineConflict } from '@jumoo/processing';
5
5
  /**
6
6
  * @description context for keeping pipeline status and progress as we do things.
7
7
  */
@@ -13,6 +13,11 @@ export declare class PipelineContext extends UmbControllerBase {
13
13
  readonly results: import("rxjs").Observable<ProcessingResults | undefined>;
14
14
  readonly message: import("rxjs").Observable<ProcessingMessage | undefined>;
15
15
  readonly backgroundState: import("rxjs").Observable<PipelineState | undefined>;
16
+ /**
17
+ * @description set when the pipeline couldn't be created or resumed because another one
18
+ * holds its concurrency key - "already running".
19
+ */
20
+ readonly conflict: import("rxjs").Observable<PipelineConflict | undefined>;
16
21
  constructor(host: UmbControllerHost);
17
22
  private isMessage;
18
23
  private isState;
@@ -9,11 +9,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _PipelineContext_instances, _PipelineContext_repository, _PipelineContext_hubContext, _PipelineContext_pipeline, _PipelineContext_state, _PipelineContext_options, _PipelineContext_results, _PipelineContext_message, _PipelineContext_backgroundState, _PipelineContext_clientId, _PipelineContext_hasConnectedBefore, _PipelineContext_onClientIdChanged, _PipelineContext_isInFlight, _PipelineContext_trigger, _PipelineContext_close, _PipelineContext_finalized, _PipelineContext_valid, _PipelineContext_pending;
12
+ var _PipelineContext_instances, _PipelineContext_repository, _PipelineContext_hubContext, _PipelineContext_pipeline, _PipelineContext_state, _PipelineContext_options, _PipelineContext_results, _PipelineContext_message, _PipelineContext_backgroundState, _PipelineContext_conflict, _PipelineContext_clientId, _PipelineContext_hasConnectedBefore, _PipelineContext_onClientIdChanged, _PipelineContext_isInFlight, _PipelineContext_setConflict, _PipelineContext_trigger, _PipelineContext_close, _PipelineContext_finalized, _PipelineContext_valid, _PipelineContext_pending;
13
13
  import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
14
14
  import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
15
15
  import { UmbBooleanState, UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
16
- import { PipelineStatus, PipelineRepository, ProcessingSignalRContext, } from '@jumoo/processing';
16
+ import { PipelineStatus, PipelineRepository, ProcessingSignalRContext, getPipelineConflict, } from '@jumoo/processing';
17
17
  /**
18
18
  * @description context for keeping pipeline status and progress as we do things.
19
19
  */
@@ -35,6 +35,12 @@ export class PipelineContext extends UmbControllerBase {
35
35
  this.message = __classPrivateFieldGet(this, _PipelineContext_message, "f").asObservable();
36
36
  _PipelineContext_backgroundState.set(this, new UmbObjectState(undefined));
37
37
  this.backgroundState = __classPrivateFieldGet(this, _PipelineContext_backgroundState, "f").asObservable();
38
+ _PipelineContext_conflict.set(this, new UmbObjectState(undefined));
39
+ /**
40
+ * @description set when the pipeline couldn't be created or resumed because another one
41
+ * holds its concurrency key - "already running".
42
+ */
43
+ this.conflict = __classPrivateFieldGet(this, _PipelineContext_conflict, "f").asObservable();
38
44
  // tracks the SignalR connection id ourselves, alongside the hub context's own clientId
39
45
  // observable, so #onClientIdChanged can tell "first connect" (nothing to reattach - there's
40
46
  // no prior, now-dead connection) apart from "changed after already having one" (a genuine
@@ -86,8 +92,13 @@ export class PipelineContext extends UmbControllerBase {
86
92
  return message !== undefined;
87
93
  }
88
94
  async createPipeline(processor, strategy, options) {
89
- const pipeline = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").create(processor, strategy, options);
90
- __classPrivateFieldGet(this, _PipelineContext_pipeline, "f").setValue(pipeline);
95
+ __classPrivateFieldGet(this, _PipelineContext_conflict, "f").setValue(undefined);
96
+ const { data, error } = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").tryCreate(processor, strategy, options);
97
+ if (error) {
98
+ await __classPrivateFieldGet(this, _PipelineContext_instances, "m", _PipelineContext_setConflict).call(this, error);
99
+ return;
100
+ }
101
+ __classPrivateFieldGet(this, _PipelineContext_pipeline, "f").setValue(data);
91
102
  }
92
103
  async loadPipeline(id) {
93
104
  const pipeline = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").Get(id);
@@ -113,7 +124,11 @@ export class PipelineContext extends UmbControllerBase {
113
124
  if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
114
125
  return;
115
126
  const clientId = __classPrivateFieldGet(this, _PipelineContext_hubContext, "f")?.getClientId() ?? null;
116
- const response = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").process(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, clientId);
127
+ const { data: response, error } = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").tryProcess(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, clientId);
128
+ if (error) {
129
+ await __classPrivateFieldGet(this, _PipelineContext_instances, "m", _PipelineContext_setConflict).call(this, error);
130
+ return undefined;
131
+ }
117
132
  if (response?.state) {
118
133
  __classPrivateFieldGet(this, _PipelineContext_state, "f").setValue(response.state);
119
134
  }
@@ -128,7 +143,9 @@ export class PipelineContext extends UmbControllerBase {
128
143
  async updateOptions(options) {
129
144
  if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
130
145
  return;
131
- const response = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").update(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, options);
146
+ const { data: response, error } = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").tryUpdate(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, options);
147
+ if (error)
148
+ await __classPrivateFieldGet(this, _PipelineContext_instances, "m", _PipelineContext_setConflict).call(this, error);
132
149
  if (response?.options) {
133
150
  console.debug('update: pipeline.options', response);
134
151
  __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(response.options);
@@ -140,7 +157,9 @@ export class PipelineContext extends UmbControllerBase {
140
157
  async saveOptions() {
141
158
  if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
142
159
  return;
143
- const response = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").update(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, __classPrivateFieldGet(this, _PipelineContext_options, "f").value);
160
+ const { data: response, error } = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").tryUpdate(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, __classPrivateFieldGet(this, _PipelineContext_options, "f").value);
161
+ if (error)
162
+ await __classPrivateFieldGet(this, _PipelineContext_instances, "m", _PipelineContext_setConflict).call(this, error);
144
163
  if (response?.options) {
145
164
  console.debug('save:pipeline.options', response);
146
165
  __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(response.options);
@@ -217,7 +236,7 @@ export class PipelineContext extends UmbControllerBase {
217
236
  __classPrivateFieldGet(this, _PipelineContext_pending, "f").setValue(__classPrivateFieldGet(this, _PipelineContext_options, "f").value);
218
237
  }
219
238
  }
220
- _PipelineContext_repository = new WeakMap(), _PipelineContext_hubContext = new WeakMap(), _PipelineContext_pipeline = new WeakMap(), _PipelineContext_state = new WeakMap(), _PipelineContext_options = new WeakMap(), _PipelineContext_results = new WeakMap(), _PipelineContext_message = new WeakMap(), _PipelineContext_backgroundState = new WeakMap(), _PipelineContext_clientId = new WeakMap(), _PipelineContext_hasConnectedBefore = new WeakMap(), _PipelineContext_trigger = new WeakMap(), _PipelineContext_close = new WeakMap(), _PipelineContext_finalized = new WeakMap(), _PipelineContext_valid = new WeakMap(), _PipelineContext_pending = new WeakMap(), _PipelineContext_instances = new WeakSet(), _PipelineContext_onClientIdChanged =
239
+ _PipelineContext_repository = new WeakMap(), _PipelineContext_hubContext = new WeakMap(), _PipelineContext_pipeline = new WeakMap(), _PipelineContext_state = new WeakMap(), _PipelineContext_options = new WeakMap(), _PipelineContext_results = new WeakMap(), _PipelineContext_message = new WeakMap(), _PipelineContext_backgroundState = new WeakMap(), _PipelineContext_conflict = new WeakMap(), _PipelineContext_clientId = new WeakMap(), _PipelineContext_hasConnectedBefore = new WeakMap(), _PipelineContext_trigger = new WeakMap(), _PipelineContext_close = new WeakMap(), _PipelineContext_finalized = new WeakMap(), _PipelineContext_valid = new WeakMap(), _PipelineContext_pending = new WeakMap(), _PipelineContext_instances = new WeakSet(), _PipelineContext_onClientIdChanged =
221
240
  /**
222
241
  * @description called whenever the SignalR connection id changes - which includes the very
223
242
  * first connect, where there's nothing to reattach yet, and a reconnect, where a pipeline
@@ -255,6 +274,22 @@ async function _PipelineContext_onClientIdChanged(clientId) {
255
274
  default:
256
275
  return false;
257
276
  }
277
+ }, _PipelineContext_setConflict =
278
+ /**
279
+ * @description records a 409 "already running", with the holder's status when the user can
280
+ * see it.
281
+ * @param error the error from a create, process or update.
282
+ * @returns true when it was a conflict.
283
+ */
284
+ async function _PipelineContext_setConflict(error) {
285
+ const conflict = getPipelineConflict(error);
286
+ if (!conflict)
287
+ return false;
288
+ __classPrivateFieldGet(this, _PipelineContext_conflict, "f").setValue(conflict);
289
+ const holder = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").getRunStatus(conflict.runningPipelineId);
290
+ if (holder)
291
+ __classPrivateFieldGet(this, _PipelineContext_conflict, "f").setValue({ ...conflict, holder });
292
+ return true;
258
293
  };
259
294
  export default PipelineContext;
260
295
  export const JUMOO_PROCESSING_CONTEXT = new UmbContextToken('JumooPipelineContext');
@@ -9,6 +9,8 @@ import { ProcessingOptions } from '@jumoo/processing';
9
9
  * @fires pipeline-waiting - when the pipeline is waiting for user input
10
10
  * @fires pipeline-last-action - when the pipeline is on the last action
11
11
  * @fires pipeline-status - the current status of the pipeline.
12
+ * @fires pipeline-conflict - when the pipeline can't be created or resumed because another
13
+ * process is already running for the same target (detail is the PipelineConflict).
12
14
  */
13
15
  export declare class JumooPipelineElement extends UmbLitElement {
14
16
  private context?;
@@ -35,6 +37,7 @@ export declare class JumooPipelineElement extends UmbLitElement {
35
37
  private results;
36
38
  private message;
37
39
  private backgroundState;
40
+ private conflict;
38
41
  constructor();
39
42
  connectedCallback(): void;
40
43
  private process;
@@ -57,6 +60,7 @@ export declare class JumooPipelineElement extends UmbLitElement {
57
60
  */
58
61
  private onLastAction;
59
62
  render(): import("lit-html").TemplateResult<1>;
63
+ private renderConflict;
60
64
  private renderDebug;
61
65
  private renderStatus;
62
66
  private renderBackground;
@@ -16,6 +16,8 @@ import { PipelineStatus, JUMOO_PROCESSING_CONTEXT, } from '@jumoo/processing';
16
16
  * @fires pipeline-waiting - when the pipeline is waiting for user input
17
17
  * @fires pipeline-last-action - when the pipeline is on the last action
18
18
  * @fires pipeline-status - the current status of the pipeline.
19
+ * @fires pipeline-conflict - when the pipeline can't be created or resumed because another
20
+ * process is already running for the same target (detail is the PipelineConflict).
19
21
  */
20
22
  let JumooPipelineElement = class JumooPipelineElement extends UmbLitElement {
21
23
  constructor() {
@@ -73,6 +75,17 @@ let JumooPipelineElement = class JumooPipelineElement extends UmbLitElement {
73
75
  this.observe(this.context.results, (results) => {
74
76
  this.results = results;
75
77
  });
78
+ this.observe(this.context.conflict, (conflict) => {
79
+ const isNew = conflict && !this.conflict;
80
+ this.conflict = conflict;
81
+ if (isNew) {
82
+ this.dispatchEvent(new CustomEvent('pipeline-conflict', {
83
+ bubbles: true,
84
+ composed: true,
85
+ detail: conflict,
86
+ }));
87
+ }
88
+ });
76
89
  });
77
90
  }
78
91
  connectedCallback() {
@@ -139,7 +152,52 @@ let JumooPipelineElement = class JumooPipelineElement extends UmbLitElement {
139
152
  this.fireEvent('pipeline-last-action');
140
153
  }
141
154
  render() {
142
- return html `${this.renderStatus()}${this.renderDebug()}`;
155
+ return html `${this.conflict ? this.renderConflict(this.conflict) : this.renderStatus()}${this.renderDebug()}`;
156
+ }
157
+ renderConflict(conflict) {
158
+ const holder = conflict.holder;
159
+ return html `<div class="conflict">
160
+ <div class="header">
161
+ <uui-icon name="icon-alert"></uui-icon>
162
+ <h3>
163
+ <umb-localize key="jumooProcConflict_headline">Already running</umb-localize>
164
+ </h3>
165
+ </div>
166
+ <p>
167
+ <umb-localize key="jumooProcConflict_message">
168
+ Another process is already running for this target. Wait for it to finish, or
169
+ cancel it, then try again.
170
+ </umb-localize>
171
+ </p>
172
+ ${holder
173
+ ? html `<dl>
174
+ <dt><umb-localize key="jumooProcConflict_status">Status</umb-localize></dt>
175
+ <dd>${holder.status}</dd>
176
+ ${holder.startedBy
177
+ ? html `<dt>
178
+ <umb-localize key="jumooProcConflict_startedBy"
179
+ >Started by</umb-localize
180
+ >
181
+ </dt>
182
+ <dd>${holder.startedBy}</dd>`
183
+ : nothing}
184
+ ${holder.created
185
+ ? html `<dt>
186
+ <umb-localize key="jumooProcConflict_started"
187
+ >Started</umb-localize
188
+ >
189
+ </dt>
190
+ <dd>
191
+ ${this.localize.date(holder.created, { dateStyle: 'medium', timeStyle: 'short' })}
192
+ </dd>`
193
+ : nothing}
194
+ <dt>
195
+ <umb-localize key="jumooProcConflict_progress">Progress</umb-localize>
196
+ </dt>
197
+ <dd>${Math.round(holder.progress.percentage)}%</dd>
198
+ </dl>`
199
+ : nothing}
200
+ </div>`;
143
201
  }
144
202
  renderDebug() {
145
203
  return this.debug
@@ -155,6 +213,7 @@ let JumooPipelineElement = class JumooPipelineElement extends UmbLitElement {
155
213
  case PipelineStatus.RUNNING:
156
214
  return this.renderSteps();
157
215
  case PipelineStatus.FAILED:
216
+ case PipelineStatus.CANCELLED:
158
217
  return this.renderFail();
159
218
  case PipelineStatus.BACKGROUND:
160
219
  return this.renderBackground();
@@ -219,6 +278,40 @@ JumooPipelineElement.styles = css `
219
278
  umb-extension-slot {
220
279
  height: 100%;
221
280
  }
281
+
282
+ .conflict {
283
+ padding: var(--uui-size-space-5);
284
+ border: 1px solid var(--uui-color-warning-standalone);
285
+ border-left-width: 4px;
286
+ border-radius: var(--uui-border-radius);
287
+ background-color: var(--uui-color-surface);
288
+ }
289
+
290
+ .conflict .header {
291
+ display: flex;
292
+ align-items: center;
293
+ gap: var(--uui-size-space-3);
294
+ color: var(--uui-color-warning-standalone);
295
+ }
296
+
297
+ .conflict h3 {
298
+ margin: 0;
299
+ }
300
+
301
+ .conflict dl {
302
+ display: grid;
303
+ grid-template-columns: max-content 1fr;
304
+ gap: var(--uui-size-space-2) var(--uui-size-space-5);
305
+ margin: var(--uui-size-space-4) 0;
306
+ }
307
+
308
+ .conflict dt {
309
+ font-weight: bold;
310
+ }
311
+
312
+ .conflict dd {
313
+ margin: 0;
314
+ }
222
315
  `;
223
316
  __decorate([
224
317
  property({ type: String })
@@ -253,6 +346,9 @@ __decorate([
253
346
  __decorate([
254
347
  state()
255
348
  ], JumooPipelineElement.prototype, "backgroundState", void 0);
349
+ __decorate([
350
+ state()
351
+ ], JumooPipelineElement.prototype, "conflict", void 0);
256
352
  JumooPipelineElement = __decorate([
257
353
  customElement('jumoo-pipeline')
258
354
  ], JumooPipelineElement);
@@ -14,6 +14,32 @@ export declare class PipelineRepository extends UmbControllerBase {
14
14
  getProcessors(): Promise<string[]>;
15
15
  Get(id: string): Promise<import("@jumoo/processing").Pipeline>;
16
16
  create(processor: string, strategy: string, options: ProcessingOptions | undefined): Promise<string>;
17
+ /**
18
+ * @description create, returning the whole response rather than just the id, so the caller
19
+ * can tell a 409 "already running" (see getPipelineConflict) from any other failure.
20
+ */
21
+ tryCreate(processor: string, strategy: string, options: ProcessingOptions | undefined): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
22
+ data: string;
23
+ request: Request;
24
+ response: Response;
25
+ }>>;
26
+ /**
27
+ * @description process, returning the whole response - see tryCreate.
28
+ */
29
+ tryProcess(id: string, clientId: string | null): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
30
+ data: import("@jumoo/processing").Pipeline;
31
+ request: Request;
32
+ response: Response;
33
+ }>>;
34
+ /**
35
+ * @description update, returning the whole response - see tryCreate.
36
+ */
37
+ tryUpdate(id: string, body: ProcessingOptions | undefined): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
38
+ data: import("@jumoo/processing").ProcessingOptionsResults;
39
+ request: Request;
40
+ response: Response;
41
+ }>>;
42
+ getRunStatus(id: string): Promise<import("@jumoo/processing").PipelineRunStatus>;
17
43
  complete(id: string): Promise<void>;
18
44
  getResults(id: string): Promise<import("@jumoo/processing").ProcessingResults>;
19
45
  listPipelines(status: PipelineStatus): Promise<import("@jumoo/processing").Pipeline[]>;
@@ -29,6 +29,28 @@ export class PipelineRepository extends UmbControllerBase {
29
29
  async create(processor, strategy, options) {
30
30
  return (await this.source.create(processor, strategy, options)).data;
31
31
  }
32
+ /**
33
+ * @description create, returning the whole response rather than just the id, so the caller
34
+ * can tell a 409 "already running" (see getPipelineConflict) from any other failure.
35
+ */
36
+ async tryCreate(processor, strategy, options) {
37
+ return await this.source.create(processor, strategy, options);
38
+ }
39
+ /**
40
+ * @description process, returning the whole response - see tryCreate.
41
+ */
42
+ async tryProcess(id, clientId) {
43
+ return await this.source.process(id, clientId);
44
+ }
45
+ /**
46
+ * @description update, returning the whole response - see tryCreate.
47
+ */
48
+ async tryUpdate(id, body) {
49
+ return await this.source.update(id, body);
50
+ }
51
+ async getRunStatus(id) {
52
+ return (await this.source.getRunStatus(id)).data;
53
+ }
32
54
  async complete(id) {
33
55
  console.debug('complete', id);
34
56
  }
@@ -3,6 +3,10 @@ import { PipelineStatus } from '../api';
3
3
  export declare class PipelineSource {
4
4
  private readonly host;
5
5
  constructor(host: UmbControllerHost);
6
+ /**
7
+ * @description a 409 (another pipeline holds this one's concurrency key, so it can't resume)
8
+ * is returned as the error without a notification - see getPipelineConflict.
9
+ */
6
10
  process(id: string, clientId: string | null): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
7
11
  data: import("..").Pipeline;
8
12
  request: Request;
@@ -19,6 +23,10 @@ export declare class PipelineSource {
19
23
  request: Request;
20
24
  response: Response;
21
25
  }>>;
26
+ /**
27
+ * @description a 409 (the new options' concurrency key is held) is returned as the error
28
+ * without a notification - see getPipelineConflict.
29
+ */
22
30
  update(id: string, body: any): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
23
31
  data: import("..").ProcessingOptionsResults;
24
32
  request: Request;
@@ -42,7 +50,8 @@ export declare class PipelineSource {
42
50
  /**
43
51
  *
44
52
  * @param strategy alias of the strategy to use for the pipeline
45
- * @returns
53
+ * @returns the new pipeline's id. A 409 (another pipeline holds its concurrency key) is
54
+ * returned as the error without a notification - see getPipelineConflict.
46
55
  */
47
56
  create(processor: string, strategy: string, options: any): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
48
57
  data: string;
@@ -68,6 +77,15 @@ export declare class PipelineSource {
68
77
  request: Request;
69
78
  response: Response;
70
79
  }>>;
80
+ /**
81
+ * @param id guid id of the pipeline
82
+ * @returns its run status, or an error (without a notification) if the user can't see it.
83
+ */
84
+ getRunStatus(id: string): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
85
+ data: import("..").PipelineRunStatus;
86
+ request: Request;
87
+ response: Response;
88
+ }>>;
71
89
  listPiplelines(status: PipelineStatus): Promise<import("@umbraco-cms/backoffice/resources").UmbApiResponse<{
72
90
  data: import("..").Pipeline[];
73
91
  request: Request;
@@ -1,11 +1,16 @@
1
1
  import { tryExecute } from '@umbraco-cms/backoffice/resources';
2
2
  import { PipelinesService } from '../api';
3
+ import { tryExecuteAllowingConflict } from './pipeline-conflict.js';
3
4
  export class PipelineSource {
4
5
  constructor(host) {
5
6
  this.host = host;
6
7
  }
8
+ /**
9
+ * @description a 409 (another pipeline holds this one's concurrency key, so it can't resume)
10
+ * is returned as the error without a notification - see getPipelineConflict.
11
+ */
7
12
  async process(id, clientId) {
8
- const result = await tryExecute(this.host, PipelinesService.processPipeline({
13
+ const result = await tryExecuteAllowingConflict(this.host, PipelinesService.processPipeline({
9
14
  path: { id: id },
10
15
  query: { clientId: clientId ?? undefined },
11
16
  }));
@@ -24,8 +29,12 @@ export class PipelineSource {
24
29
  }));
25
30
  return result;
26
31
  }
32
+ /**
33
+ * @description a 409 (the new options' concurrency key is held) is returned as the error
34
+ * without a notification - see getPipelineConflict.
35
+ */
27
36
  async update(id, body) {
28
- return await tryExecute(this.host, PipelinesService.updatePipeline({
37
+ return await tryExecuteAllowingConflict(this.host, PipelinesService.updatePipeline({
29
38
  path: { id: id },
30
39
  body: body,
31
40
  }));
@@ -44,10 +53,11 @@ export class PipelineSource {
44
53
  /**
45
54
  *
46
55
  * @param strategy alias of the strategy to use for the pipeline
47
- * @returns
56
+ * @returns the new pipeline's id. A 409 (another pipeline holds its concurrency key) is
57
+ * returned as the error without a notification - see getPipelineConflict.
48
58
  */
49
59
  async create(processor, strategy, options) {
50
- return await tryExecute(this.host, PipelinesService.createPipeline({
60
+ return await tryExecuteAllowingConflict(this.host, PipelinesService.createPipeline({
51
61
  body: {
52
62
  alias: processor,
53
63
  strategy: strategy,
@@ -73,6 +83,15 @@ export class PipelineSource {
73
83
  path: { id: id },
74
84
  }));
75
85
  }
86
+ /**
87
+ * @param id guid id of the pipeline
88
+ * @returns its run status, or an error (without a notification) if the user can't see it.
89
+ */
90
+ async getRunStatus(id) {
91
+ return await tryExecute(this.host, PipelinesService.pipelineStatus({ path: { id: id } }), {
92
+ disableNotifications: true,
93
+ });
94
+ }
76
95
  async listPiplelines(status) {
77
96
  return await tryExecute(this.host, PipelinesService.listPipelines({ path: { status: status } }));
78
97
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jumoo/processing",
3
3
  "licence": "custom",
4
- "version": "17.4.3-prerelease.2",
4
+ "version": "17.4.3-prerelease.4",
5
5
  "type": "module",
6
6
  "description": "Jumoo processing library",
7
7
  "exports": {