@jumoo/processing 17.4.2

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 (121) hide show
  1. package/dist/api/client/client.gen.d.ts +2 -0
  2. package/dist/api/client/client.gen.js +235 -0
  3. package/dist/api/client/index.d.ts +8 -0
  4. package/dist/api/client/index.js +6 -0
  5. package/dist/api/client/types.gen.d.ts +117 -0
  6. package/dist/api/client/types.gen.js +2 -0
  7. package/dist/api/client/utils.gen.d.ts +33 -0
  8. package/dist/api/client/utils.gen.js +230 -0
  9. package/dist/api/client.gen.d.ts +12 -0
  10. package/dist/api/client.gen.js +4 -0
  11. package/dist/api/core/auth.gen.d.ts +18 -0
  12. package/dist/api/core/auth.gen.js +14 -0
  13. package/dist/api/core/bodySerializer.gen.d.ts +25 -0
  14. package/dist/api/core/bodySerializer.gen.js +57 -0
  15. package/dist/api/core/params.gen.d.ts +43 -0
  16. package/dist/api/core/params.gen.js +100 -0
  17. package/dist/api/core/pathSerializer.gen.d.ts +33 -0
  18. package/dist/api/core/pathSerializer.gen.js +106 -0
  19. package/dist/api/core/queryKeySerializer.gen.d.ts +18 -0
  20. package/dist/api/core/queryKeySerializer.gen.js +92 -0
  21. package/dist/api/core/serverSentEvents.gen.d.ts +71 -0
  22. package/dist/api/core/serverSentEvents.gen.js +133 -0
  23. package/dist/api/core/types.gen.d.ts +78 -0
  24. package/dist/api/core/types.gen.js +2 -0
  25. package/dist/api/core/utils.gen.d.ts +19 -0
  26. package/dist/api/core/utils.gen.js +87 -0
  27. package/dist/api/index.d.ts +3 -0
  28. package/dist/api/index.js +4 -0
  29. package/dist/api/sdk.gen.d.ts +39 -0
  30. package/dist/api/sdk.gen.js +118 -0
  31. package/dist/api/types.gen.d.ts +547 -0
  32. package/dist/api/types.gen.js +18 -0
  33. package/dist/constants.d.ts +1 -0
  34. package/dist/constants.js +8 -0
  35. package/dist/exports.d.ts +6 -0
  36. package/dist/exports.js +6 -0
  37. package/dist/external/signalr/index.d.ts +4 -0
  38. package/dist/external/signalr/index.js +4 -0
  39. package/dist/hey-api.d.ts +11 -0
  40. package/dist/hey-api.js +14 -0
  41. package/dist/index.d.ts +8 -0
  42. package/dist/index.js +12 -0
  43. package/dist/lang/files/en.d.ts +22 -0
  44. package/dist/lang/files/en.js +21 -0
  45. package/dist/lang/manifest.d.ts +1 -0
  46. package/dist/lang/manifest.js +11 -0
  47. package/dist/pipeline/components/background.element.d.ts +23 -0
  48. package/dist/pipeline/components/background.element.js +88 -0
  49. package/dist/pipeline/components/index.d.ts +6 -0
  50. package/dist/pipeline/components/index.js +6 -0
  51. package/dist/pipeline/components/pipeline-list.element.d.ts +32 -0
  52. package/dist/pipeline/components/pipeline-list.element.js +178 -0
  53. package/dist/pipeline/components/pipeline-table.element.d.ts +19 -0
  54. package/dist/pipeline/components/pipeline-table.element.js +149 -0
  55. package/dist/pipeline/components/process-error.element.d.ts +16 -0
  56. package/dist/pipeline/components/process-error.element.js +93 -0
  57. package/dist/pipeline/components/progress.element.d.ts +14 -0
  58. package/dist/pipeline/components/progress.element.js +177 -0
  59. package/dist/pipeline/components/progress.step.element.d.ts +15 -0
  60. package/dist/pipeline/components/progress.step.element.js +48 -0
  61. package/dist/pipeline/index.d.ts +8 -0
  62. package/dist/pipeline/index.js +8 -0
  63. package/dist/pipeline/modal/errors/error-modal.element.d.ts +13 -0
  64. package/dist/pipeline/modal/errors/error-modal.element.js +129 -0
  65. package/dist/pipeline/modal/errors/error-modal.token.d.ts +10 -0
  66. package/dist/pipeline/modal/errors/error-modal.token.js +8 -0
  67. package/dist/pipeline/modal/errors/index.d.ts +1 -0
  68. package/dist/pipeline/modal/errors/index.js +2 -0
  69. package/dist/pipeline/modal/errors/manifest.d.ts +1 -0
  70. package/dist/pipeline/modal/errors/manifest.js +7 -0
  71. package/dist/pipeline/modal/index.d.ts +2 -0
  72. package/dist/pipeline/modal/index.js +3 -0
  73. package/dist/pipeline/modal/manifest.d.ts +1 -0
  74. package/dist/pipeline/modal/manifest.js +8 -0
  75. package/dist/pipeline/modal/pipeline-modal.element.d.ts +20 -0
  76. package/dist/pipeline/modal/pipeline-modal.element.js +151 -0
  77. package/dist/pipeline/modal/pipeline-modal.token.d.ts +39 -0
  78. package/dist/pipeline/modal/pipeline-modal.token.js +38 -0
  79. package/dist/pipeline/pipeline.context.d.ts +53 -0
  80. package/dist/pipeline/pipeline.context.js +260 -0
  81. package/dist/pipeline/pipeline.element.d.ts +74 -0
  82. package/dist/pipeline/pipeline.element.js +260 -0
  83. package/dist/pipeline/pipeline.repository.d.ts +20 -0
  84. package/dist/pipeline/pipeline.repository.js +41 -0
  85. package/dist/pipeline/pipeline.source.d.ts +76 -0
  86. package/dist/pipeline/pipeline.source.js +79 -0
  87. package/dist/pipeline/pipelines.context.d.ts +12 -0
  88. package/dist/pipeline/pipelines.context.js +33 -0
  89. package/dist/pipeline/steps/index.d.ts +2 -0
  90. package/dist/pipeline/steps/index.js +2 -0
  91. package/dist/pipeline/steps/interfaces.d.ts +10 -0
  92. package/dist/pipeline/steps/interfaces.js +1 -0
  93. package/dist/pipeline/steps/models.d.ts +14 -0
  94. package/dist/pipeline/steps/models.js +24 -0
  95. package/dist/pipeline/workspace/manifest.d.ts +1 -0
  96. package/dist/pipeline/workspace/manifest.js +33 -0
  97. package/dist/pipeline/workspace/pipeline-workspace.context.d.ts +17 -0
  98. package/dist/pipeline/workspace/pipeline-workspace.context.js +58 -0
  99. package/dist/pipeline/workspace/pipeline-workspace.element.d.ts +6 -0
  100. package/dist/pipeline/workspace/pipeline-workspace.element.js +21 -0
  101. package/dist/pipeline/workspace/types.d.ts +6 -0
  102. package/dist/pipeline/workspace/types.js +10 -0
  103. package/dist/pipeline/workspace/views/default-pipeline-view.d.ts +20 -0
  104. package/dist/pipeline/workspace/views/default-pipeline-view.js +140 -0
  105. package/dist/queue/components/queue-list.element.d.ts +21 -0
  106. package/dist/queue/components/queue-list.element.js +72 -0
  107. package/dist/queue/components/queue-table.element.d.ts +24 -0
  108. package/dist/queue/components/queue-table.element.js +156 -0
  109. package/dist/queue/index.d.ts +3 -0
  110. package/dist/queue/index.js +3 -0
  111. package/dist/queue/queue.context.d.ts +13 -0
  112. package/dist/queue/queue.context.js +37 -0
  113. package/dist/queue/queue.repository.d.ts +10 -0
  114. package/dist/queue/queue.repository.js +32 -0
  115. package/dist/signalr/index.d.ts +2 -0
  116. package/dist/signalr/index.js +2 -0
  117. package/dist/signalr/signalr.context.d.ts +24 -0
  118. package/dist/signalr/signalr.context.js +99 -0
  119. package/dist/signalr/types.d.ts +12 -0
  120. package/dist/signalr/types.js +1 -0
  121. package/package.json +51 -0
@@ -0,0 +1,39 @@
1
+ import { ProcessingOptions } from '@jumoo/processing';
2
+ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
3
+ export type JumooProcessingModalData = {
4
+ headline: string;
5
+ description?: string;
6
+ progressLabel?: string;
7
+ closeLabel?: string;
8
+ processor: string;
9
+ strategy: string;
10
+ options: ProcessingOptions;
11
+ debug?: boolean;
12
+ width?: number;
13
+ height?: number;
14
+ };
15
+ export type JumooProcessingModalResult = {
16
+ success: boolean;
17
+ };
18
+ export type JumooProcessingModalInfo = {
19
+ headline: string;
20
+ progressLabel?: string;
21
+ closeLabel?: string;
22
+ };
23
+ export declare const JUMOO_PROCESSING_MODAL_ALIAS = "jumoo-processing-modal";
24
+ /**
25
+ * @description simple process modal open as a dialog
26
+ */
27
+ export declare const JUMOO_PROCESSING_DIALOG_MODAL: UmbModalToken<JumooProcessingModalData, JumooProcessingModalResult>;
28
+ /**
29
+ * @description simple process modal open as a sidebar
30
+ */
31
+ export declare const JUMOO_PROCESSING_SIDEBAR_MODAL: UmbModalToken<JumooProcessingModalData, JumooProcessingModalResult>;
32
+ /**
33
+ * @description simple process modal open as a sidebar
34
+ */
35
+ export declare const JUMOO_PROCESSING_SIDEBAR_MEDIUM_MODAL: UmbModalToken<JumooProcessingModalData, JumooProcessingModalResult>;
36
+ /**
37
+ * @description simple process modal open as a sidebar
38
+ */
39
+ export declare const JUMOO_PROCESSING_SIDEBAR_LARGE_MODAL: UmbModalToken<JumooProcessingModalData, JumooProcessingModalResult>;
@@ -0,0 +1,38 @@
1
+ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
2
+ export const JUMOO_PROCESSING_MODAL_ALIAS = 'jumoo-processing-modal';
3
+ /**
4
+ * @description simple process modal open as a dialog
5
+ */
6
+ export const JUMOO_PROCESSING_DIALOG_MODAL = new UmbModalToken(JUMOO_PROCESSING_MODAL_ALIAS, {
7
+ modal: {
8
+ size: 'small',
9
+ type: 'dialog',
10
+ },
11
+ });
12
+ /**
13
+ * @description simple process modal open as a sidebar
14
+ */
15
+ export const JUMOO_PROCESSING_SIDEBAR_MODAL = new UmbModalToken(JUMOO_PROCESSING_MODAL_ALIAS, {
16
+ modal: {
17
+ size: 'small',
18
+ type: 'sidebar',
19
+ },
20
+ });
21
+ /**
22
+ * @description simple process modal open as a sidebar
23
+ */
24
+ export const JUMOO_PROCESSING_SIDEBAR_MEDIUM_MODAL = new UmbModalToken(JUMOO_PROCESSING_MODAL_ALIAS, {
25
+ modal: {
26
+ size: 'medium',
27
+ type: 'sidebar',
28
+ },
29
+ });
30
+ /**
31
+ * @description simple process modal open as a sidebar
32
+ */
33
+ export const JUMOO_PROCESSING_SIDEBAR_LARGE_MODAL = new UmbModalToken(JUMOO_PROCESSING_MODAL_ALIAS, {
34
+ modal: {
35
+ size: 'large',
36
+ type: 'sidebar',
37
+ },
38
+ });
@@ -0,0 +1,53 @@
1
+ import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
2
+ import { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
3
+ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
4
+ import { PipelineState, ProcessingMessage, ProcessingOptions, ProcessingResults } from '@jumoo/processing';
5
+ /**
6
+ * @description context for keeping pipeline status and progress as we do things.
7
+ */
8
+ export declare class PipelineContext extends UmbControllerBase {
9
+ #private;
10
+ readonly pipeline: import("rxjs").Observable<string | undefined>;
11
+ readonly state: import("rxjs").Observable<PipelineState | undefined>;
12
+ readonly options: import("rxjs").Observable<ProcessingOptions | undefined>;
13
+ readonly results: import("rxjs").Observable<ProcessingResults | undefined>;
14
+ readonly message: import("rxjs").Observable<ProcessingMessage | undefined>;
15
+ readonly backgroundState: import("rxjs").Observable<PipelineState | undefined>;
16
+ constructor(host: UmbControllerHost);
17
+ private isMessage;
18
+ private isState;
19
+ createPipeline(processor: string, strategy: string, options: ProcessingOptions | undefined): Promise<void>;
20
+ loadPipeline(id: string): Promise<void>;
21
+ getPipeline(id: string): Promise<import("@jumoo/processing").Pipeline>;
22
+ fetchPipeline(id: string): Promise<import("@jumoo/processing").Pipeline>;
23
+ process(): Promise<import("@jumoo/processing").Pipeline | undefined>;
24
+ updateOptions(options: ProcessingOptions): Promise<void>;
25
+ setOption(value: Record<string, unknown>): Promise<void>;
26
+ saveOptions(): Promise<void>;
27
+ UpdateAndSaveOptions(options: ProcessingOptions): Promise<void>;
28
+ clearPipeline(): Promise<void>;
29
+ completePipeline(): Promise<void>;
30
+ getResults(): Promise<ProcessingResults | undefined>;
31
+ readonly trigger: import("rxjs").Observable<boolean>;
32
+ readonly close: import("rxjs").Observable<boolean>;
33
+ readonly finalized: import("rxjs").Observable<boolean>;
34
+ readonly valid: import("rxjs").Observable<boolean>;
35
+ /**
36
+ * sets the validity of the state used to turn on next buttons etc.
37
+ * @param valid is the current state valid
38
+ */
39
+ setValid(valid: boolean): void;
40
+ /**
41
+ * trigger the next action in the pipeline
42
+ */
43
+ triggerNext(): Promise<void>;
44
+ clearNext(): void;
45
+ triggerClose(): Promise<void>;
46
+ triggerFinalized(): void;
47
+ readonly pending: import("rxjs").Observable<ProcessingOptions | undefined>;
48
+ setPending(value: Record<string, unknown>): Promise<void>;
49
+ private clearPending;
50
+ primePending(): Promise<void>;
51
+ }
52
+ export default PipelineContext;
53
+ export declare const JUMOO_PROCESSING_CONTEXT: UmbContextToken<PipelineContext, PipelineContext>;
@@ -0,0 +1,260 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
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
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
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;
13
+ import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
14
+ import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
15
+ import { UmbBooleanState, UmbObjectState } from '@umbraco-cms/backoffice/observable-api';
16
+ import { PipelineStatus, PipelineRepository, ProcessingSignalRContext, } from '@jumoo/processing';
17
+ /**
18
+ * @description context for keeping pipeline status and progress as we do things.
19
+ */
20
+ export class PipelineContext extends UmbControllerBase {
21
+ constructor(host) {
22
+ super(host);
23
+ _PipelineContext_instances.add(this);
24
+ _PipelineContext_repository.set(this, void 0);
25
+ _PipelineContext_hubContext.set(this, void 0);
26
+ _PipelineContext_pipeline.set(this, new UmbObjectState(undefined));
27
+ this.pipeline = __classPrivateFieldGet(this, _PipelineContext_pipeline, "f").asObservable();
28
+ _PipelineContext_state.set(this, new UmbObjectState(undefined));
29
+ this.state = __classPrivateFieldGet(this, _PipelineContext_state, "f").asObservable();
30
+ _PipelineContext_options.set(this, new UmbObjectState(undefined));
31
+ this.options = __classPrivateFieldGet(this, _PipelineContext_options, "f").asObservable();
32
+ _PipelineContext_results.set(this, new UmbObjectState(undefined));
33
+ this.results = __classPrivateFieldGet(this, _PipelineContext_results, "f").asObservable();
34
+ _PipelineContext_message.set(this, new UmbObjectState(undefined));
35
+ this.message = __classPrivateFieldGet(this, _PipelineContext_message, "f").asObservable();
36
+ _PipelineContext_backgroundState.set(this, new UmbObjectState(undefined));
37
+ this.backgroundState = __classPrivateFieldGet(this, _PipelineContext_backgroundState, "f").asObservable();
38
+ // tracks the SignalR connection id ourselves, alongside the hub context's own clientId
39
+ // observable, so #onClientIdChanged can tell "first connect" (nothing to reattach - there's
40
+ // no prior, now-dead connection) apart from "changed after already having one" (a genuine
41
+ // reconnect, where a pipeline in flight needs to move over to the new connection).
42
+ _PipelineContext_clientId.set(this, null);
43
+ _PipelineContext_hasConnectedBefore.set(this, false);
44
+ // if trigger is fired, then the element moves to the next thing.
45
+ _PipelineContext_trigger.set(this, new UmbBooleanState(false));
46
+ this.trigger = __classPrivateFieldGet(this, _PipelineContext_trigger, "f").asObservable();
47
+ _PipelineContext_close.set(this, new UmbBooleanState(false));
48
+ this.close = __classPrivateFieldGet(this, _PipelineContext_close, "f").asObservable();
49
+ _PipelineContext_finalized.set(this, new UmbBooleanState(false));
50
+ this.finalized = __classPrivateFieldGet(this, _PipelineContext_finalized, "f").asObservable();
51
+ _PipelineContext_valid.set(this, new UmbBooleanState(true));
52
+ this.valid = __classPrivateFieldGet(this, _PipelineContext_valid, "f").asObservable();
53
+ /**
54
+ * pending changes, these can be set here, but not updated until
55
+ * trigger next is fired. that way we can stop the refresh of things.
56
+ */
57
+ _PipelineContext_pending.set(this, new UmbObjectState(undefined));
58
+ this.pending = __classPrivateFieldGet(this, _PipelineContext_pending, "f").asObservable();
59
+ __classPrivateFieldSet(this, _PipelineContext_repository, new PipelineRepository(this), "f");
60
+ this.provideContext(JUMOO_PROCESSING_CONTEXT, this);
61
+ __classPrivateFieldSet(this, _PipelineContext_hubContext, new ProcessingSignalRContext(this), "f");
62
+ const token = '[redacted]';
63
+ __classPrivateFieldGet(this, _PipelineContext_hubContext, "f").startHub(token, ['message', 'state']);
64
+ this.observe(__classPrivateFieldGet(this, _PipelineContext_hubContext, "f").messagesOf('message'), (message) => {
65
+ if (!message?.message)
66
+ return;
67
+ if (this.isMessage(message.message)) {
68
+ __classPrivateFieldGet(this, _PipelineContext_message, "f").setValue(message.message);
69
+ }
70
+ });
71
+ this.observe(__classPrivateFieldGet(this, _PipelineContext_hubContext, "f").messagesOf('state'), (state) => {
72
+ if (!state?.message)
73
+ return;
74
+ if (this.isState(state.message)) {
75
+ __classPrivateFieldGet(this, _PipelineContext_backgroundState, "f").setValue(state.message);
76
+ }
77
+ });
78
+ this.observe(__classPrivateFieldGet(this, _PipelineContext_hubContext, "f").clientId, (clientId) => {
79
+ void __classPrivateFieldGet(this, _PipelineContext_instances, "m", _PipelineContext_onClientIdChanged).call(this, clientId);
80
+ });
81
+ }
82
+ isMessage(message) {
83
+ return message !== undefined;
84
+ }
85
+ isState(message) {
86
+ return message !== undefined;
87
+ }
88
+ 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);
91
+ }
92
+ async loadPipeline(id) {
93
+ const pipeline = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").Get(id);
94
+ if (!pipeline)
95
+ return;
96
+ __classPrivateFieldGet(this, _PipelineContext_pipeline, "f").setValue(pipeline.id);
97
+ }
98
+ async getPipeline(id) {
99
+ const pipeline = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").Get(id);
100
+ if (pipeline?.state)
101
+ __classPrivateFieldGet(this, _PipelineContext_state, "f").setValue(pipeline.state);
102
+ if (pipeline?.options)
103
+ __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(pipeline.options);
104
+ if (pipeline?.results)
105
+ __classPrivateFieldGet(this, _PipelineContext_results, "f").setValue(pipeline.results);
106
+ return pipeline;
107
+ }
108
+ async fetchPipeline(id) {
109
+ const pipeline = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").Get(id);
110
+ return pipeline;
111
+ }
112
+ async process() {
113
+ if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
114
+ return;
115
+ 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);
117
+ if (response?.state) {
118
+ __classPrivateFieldGet(this, _PipelineContext_state, "f").setValue(response.state);
119
+ }
120
+ if (response?.options) {
121
+ __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(response.options);
122
+ }
123
+ if (response?.results) {
124
+ __classPrivateFieldGet(this, _PipelineContext_results, "f").setValue(response.results);
125
+ }
126
+ return response;
127
+ }
128
+ async updateOptions(options) {
129
+ if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
130
+ return;
131
+ const response = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").update(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, options);
132
+ if (response?.options) {
133
+ console.debug('update: pipeline.options', response);
134
+ __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(response.options);
135
+ }
136
+ }
137
+ async setOption(value) {
138
+ __classPrivateFieldGet(this, _PipelineContext_options, "f").update(value);
139
+ }
140
+ async saveOptions() {
141
+ if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
142
+ return;
143
+ const response = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").update(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, __classPrivateFieldGet(this, _PipelineContext_options, "f").value);
144
+ if (response?.options) {
145
+ console.debug('save:pipeline.options', response);
146
+ __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(response.options);
147
+ }
148
+ }
149
+ async UpdateAndSaveOptions(options) {
150
+ await this.updateOptions(options);
151
+ await this.saveOptions();
152
+ }
153
+ async clearPipeline() {
154
+ if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
155
+ return;
156
+ await __classPrivateFieldGet(this, _PipelineContext_repository, "f").clear(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value);
157
+ __classPrivateFieldGet(this, _PipelineContext_pipeline, "f").setValue(undefined);
158
+ __classPrivateFieldGet(this, _PipelineContext_state, "f").setValue(undefined);
159
+ __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(undefined);
160
+ }
161
+ async completePipeline() {
162
+ if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
163
+ return;
164
+ // this.#repository.clear(this.#pipeline.value);
165
+ // this.#repository.complete(this.#pipeline.value);
166
+ }
167
+ async getResults() {
168
+ if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value)
169
+ return;
170
+ const results = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").getResults(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value);
171
+ if (results)
172
+ __classPrivateFieldGet(this, _PipelineContext_results, "f").setValue(results);
173
+ return results;
174
+ }
175
+ /**
176
+ * sets the validity of the state used to turn on next buttons etc.
177
+ * @param valid is the current state valid
178
+ */
179
+ setValid(valid) {
180
+ __classPrivateFieldGet(this, _PipelineContext_valid, "f").setValue(valid);
181
+ }
182
+ /**
183
+ * trigger the next action in the pipeline
184
+ */
185
+ async triggerNext() {
186
+ const pending = __classPrivateFieldGet(this, _PipelineContext_pending, "f").getValue();
187
+ if (pending) {
188
+ await this.UpdateAndSaveOptions(pending);
189
+ }
190
+ this.clearPending();
191
+ __classPrivateFieldGet(this, _PipelineContext_trigger, "f").setValue(true);
192
+ }
193
+ clearNext() {
194
+ __classPrivateFieldGet(this, _PipelineContext_trigger, "f").setValue(false);
195
+ }
196
+ async triggerClose() {
197
+ if (__classPrivateFieldGet(this, _PipelineContext_state, "f").value?.progress.isLastAction === true ||
198
+ __classPrivateFieldGet(this, _PipelineContext_state, "f").value?.backgroundState?.isBackgroundRequest !== true) {
199
+ await this.clearPipeline();
200
+ }
201
+ __classPrivateFieldGet(this, _PipelineContext_close, "f").setValue(true);
202
+ }
203
+ triggerFinalized() {
204
+ __classPrivateFieldGet(this, _PipelineContext_finalized, "f").setValue(true);
205
+ }
206
+ async setPending(value) {
207
+ const pending = __classPrivateFieldGet(this, _PipelineContext_pending, "f").getValue();
208
+ if (!pending) {
209
+ this.primePending();
210
+ }
211
+ __classPrivateFieldGet(this, _PipelineContext_pending, "f").update(value);
212
+ }
213
+ async clearPending() {
214
+ __classPrivateFieldGet(this, _PipelineContext_pending, "f").setValue(undefined);
215
+ }
216
+ async primePending() {
217
+ __classPrivateFieldGet(this, _PipelineContext_pending, "f").setValue(__classPrivateFieldGet(this, _PipelineContext_options, "f").value);
218
+ }
219
+ }
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 =
221
+ /**
222
+ * @description called whenever the SignalR connection id changes - which includes the very
223
+ * first connect, where there's nothing to reattach yet, and a reconnect, where a pipeline
224
+ * already running in the background needs to be told about the new connection so progress
225
+ * keeps flowing to it rather than to the dead one.
226
+ */
227
+ async function _PipelineContext_onClientIdChanged(clientId) {
228
+ const previous = __classPrivateFieldGet(this, _PipelineContext_clientId, "f");
229
+ __classPrivateFieldSet(this, _PipelineContext_clientId, clientId, "f");
230
+ if (!__classPrivateFieldGet(this, _PipelineContext_hasConnectedBefore, "f")) {
231
+ // the first value we ever see (typically right after startHub's initial start())
232
+ // isn't a reconnect - there's no earlier connection a pipeline could be attached to.
233
+ if (clientId)
234
+ __classPrivateFieldSet(this, _PipelineContext_hasConnectedBefore, true, "f");
235
+ return;
236
+ }
237
+ if (clientId === previous || !clientId)
238
+ return;
239
+ if (!__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value || !__classPrivateFieldGet(this, _PipelineContext_instances, "m", _PipelineContext_isInFlight).call(this))
240
+ return;
241
+ const response = await __classPrivateFieldGet(this, _PipelineContext_repository, "f").reattach(__classPrivateFieldGet(this, _PipelineContext_pipeline, "f").value, clientId);
242
+ if (response?.state)
243
+ __classPrivateFieldGet(this, _PipelineContext_state, "f").setValue(response.state);
244
+ if (response?.options)
245
+ __classPrivateFieldGet(this, _PipelineContext_options, "f").setValue(response.options);
246
+ if (response?.results)
247
+ __classPrivateFieldGet(this, _PipelineContext_results, "f").setValue(response.results);
248
+ }, _PipelineContext_isInFlight = function _PipelineContext_isInFlight() {
249
+ switch (__classPrivateFieldGet(this, _PipelineContext_state, "f").value?.status) {
250
+ case PipelineStatus.RUNNING:
251
+ case PipelineStatus.BACKGROUND:
252
+ case PipelineStatus.WAITING:
253
+ case PipelineStatus.SCHEDULED:
254
+ return true;
255
+ default:
256
+ return false;
257
+ }
258
+ };
259
+ export default PipelineContext;
260
+ export const JUMOO_PROCESSING_CONTEXT = new UmbContextToken('JumooPipelineContext');
@@ -0,0 +1,74 @@
1
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
2
+ import { ProcessingOptions } from '@jumoo/processing';
3
+ /**
4
+ * @property {string} processor - the processor to use for the pipeline
5
+ * @property {string} strategy - the strategy to use for the pipeline
6
+ * @property {ProcessingOptions} options - the options to see the pipeline with
7
+ *
8
+ * @fires pipeline-complete - when the pipeline is complete
9
+ * @fires pipeline-waiting - when the pipeline is waiting for user input
10
+ * @fires pipeline-last-action - when the pipeline is on the last action
11
+ * @fires pipeline-status - the current status of the pipeline.
12
+ */
13
+ export declare class JumooPipelineElement extends UmbLitElement {
14
+ private context?;
15
+ /**
16
+ * @description The processor to use for the pipeline
17
+ */
18
+ processor?: string;
19
+ /**
20
+ * @description The strategy to use for the pipeline
21
+ */
22
+ strategy?: string;
23
+ /**
24
+ * @description The setup options for the pipeline
25
+ */
26
+ setup: ProcessingOptions | undefined;
27
+ pipelineId: string | undefined;
28
+ /**
29
+ * @description - show debug information
30
+ */
31
+ debug: boolean;
32
+ private _pipelineId;
33
+ private options;
34
+ private state;
35
+ private results;
36
+ private message;
37
+ private backgroundState;
38
+ constructor();
39
+ connectedCallback(): void;
40
+ private process;
41
+ /**
42
+ * @description dispatches a named custom event, with the pipelineId and state,
43
+ * @param name name of event to file
44
+ */
45
+ private fireEvent;
46
+ private onBackground;
47
+ /**
48
+ * @description when the pipeline is complete
49
+ */
50
+ private onComplete;
51
+ /**
52
+ * @description when the pipeline is waiting for user input (via an element.)
53
+ */
54
+ private onWaiting;
55
+ /**
56
+ * @description when the pipeline is on its last action
57
+ */
58
+ private onLastAction;
59
+ render(): import("lit-html").TemplateResult<1>;
60
+ private renderDebug;
61
+ private renderStatus;
62
+ private renderBackground;
63
+ private renderComplete;
64
+ private renderSteps;
65
+ private renderElement;
66
+ private renderFail;
67
+ static styles: import("lit").CSSResult;
68
+ }
69
+ export default JumooPipelineElement;
70
+ declare global {
71
+ interface HTMLElementTagNameMap {
72
+ 'jumoo-pipeline': JumooPipelineElement;
73
+ }
74
+ }