@configura/web-api 2.0.0-alpha.0 → 2.0.0-alpha.1

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 (98) hide show
  1. package/.eslintrc.json +18 -18
  2. package/LICENSE +201 -201
  3. package/README.md +1 -1
  4. package/dist/CatalogueAPI.d.ts +551 -551
  5. package/dist/CatalogueAPI.js +293 -293
  6. package/dist/CfgMeasure.d.ts +32 -32
  7. package/dist/CfgMeasure.js +30 -30
  8. package/dist/CfgProduct.d.ts +268 -268
  9. package/dist/CfgProduct.js +778 -778
  10. package/dist/CfgReferencePathHelper.d.ts +13 -13
  11. package/dist/CfgReferencePathHelper.js +13 -13
  12. package/dist/ConfigurationConverter.d.ts +4 -4
  13. package/dist/ConfigurationConverter.js +72 -72
  14. package/dist/index.d.ts +23 -23
  15. package/dist/index.js +23 -23
  16. package/dist/io/CfgHistoryManager.d.ts +50 -50
  17. package/dist/io/CfgHistoryManager.js +82 -82
  18. package/dist/io/CfgHistoryToProdConfConnector.d.ts +20 -20
  19. package/dist/io/CfgHistoryToProdConfConnector.js +56 -56
  20. package/dist/io/CfgIOManager.d.ts +48 -48
  21. package/dist/io/CfgIOManager.js +115 -115
  22. package/dist/io/CfgIOProdConfConnector.d.ts +52 -52
  23. package/dist/io/CfgIOProdConfConnector.js +141 -141
  24. package/dist/io/CfgObservableStateManager.d.ts +21 -21
  25. package/dist/io/CfgObservableStateManager.js +65 -65
  26. package/dist/io/CfgObservableStateToProdConfConnector.d.ts +14 -14
  27. package/dist/io/CfgObservableStateToProdConfConnector.js +16 -16
  28. package/dist/io/CfgWindowEventManager.d.ts +21 -21
  29. package/dist/io/CfgWindowEventManager.js +38 -38
  30. package/dist/io/CfgWindowMessageManager.d.ts +40 -40
  31. package/dist/io/CfgWindowMessageManager.js +84 -84
  32. package/dist/io/CfgWindowMessageToProdConfConnector.d.ts +16 -16
  33. package/dist/io/CfgWindowMessageToProdConfConnector.js +18 -18
  34. package/dist/io/index.d.ts +8 -8
  35. package/dist/io/index.js +8 -8
  36. package/dist/material/CfgMaterialMapping.d.ts +7 -7
  37. package/dist/material/CfgMaterialMapping.js +181 -181
  38. package/dist/material/CfgMtrlApplication.d.ts +18 -18
  39. package/dist/material/CfgMtrlApplication.js +43 -43
  40. package/dist/material/CfgMtrlApplicationSource.d.ts +7 -7
  41. package/dist/material/CfgMtrlApplicationSource.js +8 -8
  42. package/dist/material/CfgMtrlSource.d.ts +19 -19
  43. package/dist/material/CfgMtrlSource.js +40 -40
  44. package/dist/material/CfgMtrlSourceWithMetaData.d.ts +7 -7
  45. package/dist/material/CfgMtrlSourceWithMetaData.js +1 -1
  46. package/dist/productConfiguration/CfgFeature.d.ts +187 -187
  47. package/dist/productConfiguration/CfgFeature.js +645 -645
  48. package/dist/productConfiguration/CfgOption.d.ts +151 -151
  49. package/dist/productConfiguration/CfgOption.js +416 -416
  50. package/dist/productConfiguration/CfgProductConfiguration.d.ts +117 -117
  51. package/dist/productConfiguration/CfgProductConfiguration.js +307 -307
  52. package/dist/productConfiguration/filters.d.ts +15 -15
  53. package/dist/productConfiguration/filters.js +70 -70
  54. package/dist/productConfiguration/productParamsGenerator.d.ts +15 -15
  55. package/dist/productConfiguration/productParamsGenerator.js +51 -51
  56. package/dist/productConfiguration/utilitiesProductConfiguration.d.ts +17 -17
  57. package/dist/productConfiguration/utilitiesProductConfiguration.js +80 -80
  58. package/dist/productLoader.d.ts +33 -33
  59. package/dist/productLoader.js +49 -49
  60. package/dist/syncGroups/SyncGroupsApplyMode.d.ts +20 -20
  61. package/dist/syncGroups/SyncGroupsApplyMode.js +21 -21
  62. package/dist/syncGroups/SyncGroupsHandler.d.ts +40 -40
  63. package/dist/syncGroups/SyncGroupsHandler.js +359 -359
  64. package/dist/syncGroups/SyncGroupsPathHelper.d.ts +26 -26
  65. package/dist/syncGroups/SyncGroupsPathHelper.js +90 -90
  66. package/dist/syncGroups/SyncGroupsState.d.ts +35 -35
  67. package/dist/syncGroups/SyncGroupsState.js +125 -125
  68. package/dist/syncGroups/SyncGroupsTransaction.d.ts +154 -154
  69. package/dist/syncGroups/SyncGroupsTransaction.js +576 -576
  70. package/dist/tasks/TaskHandler.d.ts +77 -77
  71. package/dist/tasks/TaskHandler.js +275 -275
  72. package/dist/tasks/formats.d.ts +4 -4
  73. package/dist/tasks/formats.js +7 -7
  74. package/dist/tests/testData/collectorForTest.d.ts +73 -73
  75. package/dist/tests/testData/collectorForTest.js +194 -194
  76. package/dist/tests/testData/dummyProductForTest.d.ts +4 -4
  77. package/dist/tests/testData/dummyProductForTest.js +32 -32
  78. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.d.ts +11 -11
  79. package/dist/tests/testData/testDataAdditionalProductInAdditionalProductInProductForTest.js +277 -277
  80. package/dist/tests/testData/testDataCachedGetProduct.d.ts +5 -5
  81. package/dist/tests/testData/testDataCachedGetProduct.js +185 -185
  82. package/dist/tests/testData/testDataCachedPostValidate.d.ts +7 -7
  83. package/dist/tests/testData/testDataCachedPostValidate.js +183 -183
  84. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.d.ts +3 -3
  85. package/dist/tests/testData/testDataNoAdditionalProductNoPropagateForTest.js +1099 -1099
  86. package/dist/tests/testData/testDataOptions.d.ts +12 -12
  87. package/dist/tests/testData/testDataOptions.js +60 -60
  88. package/dist/tests/testData/testDataProductAggregatedPrice.d.ts +6 -6
  89. package/dist/tests/testData/testDataProductAggregatedPrice.js +187 -187
  90. package/dist/tests/testData/testDataUpcharge.d.ts +8 -8
  91. package/dist/tests/testData/testDataUpcharge.js +119 -119
  92. package/dist/utilitiesCatalogueData.d.ts +33 -33
  93. package/dist/utilitiesCatalogueData.js +164 -164
  94. package/dist/utilitiesCataloguePermission.d.ts +32 -32
  95. package/dist/utilitiesCataloguePermission.js +76 -76
  96. package/dist/utilitiesNumericValues.d.ts +24 -24
  97. package/dist/utilitiesNumericValues.js +109 -109
  98. package/package.json +3 -3
@@ -1,275 +1,275 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { augmentErrorMessage, Observable } from "@configura/web-utilities";
11
- import { dtoExportFormatNames, dtoRenderFormatNames, } from "../CatalogueAPI.js";
12
- import { isExportFormat, isRenderFormat } from "./formats.js";
13
- export class _TaskHandlerInternal {
14
- constructor(api) {
15
- this.api = api;
16
- this.changeObservable = new Observable();
17
- this.tasks = [];
18
- this._notifyAllOfChange = () => {
19
- const freshRef = TaskHandler._makeNewRefFrom(this);
20
- this.changeObservable.notifyAll({ freshRef });
21
- };
22
- this.destroy = () => {
23
- this.changeObservable.stopAllListen();
24
- for (const task of this.tasks) {
25
- task.abort();
26
- }
27
- };
28
- this.start = (format, product, renderParams, getPreviewUrl) => __awaiter(this, void 0, void 0, function* () {
29
- if (isRenderFormat(format)) {
30
- if (!this.hasRender) {
31
- throw new Error("Render has not been activated for this Catalogue");
32
- }
33
- if (renderParams === undefined) {
34
- throw new Error("renderParams must be set for render");
35
- }
36
- yield TaskRender.make(this, format, product, renderParams, getPreviewUrl);
37
- return;
38
- }
39
- if (isExportFormat(format)) {
40
- if (!this.hasExport) {
41
- throw new Error("Export has not been activated for this Catalogue");
42
- }
43
- yield TaskExport.make(this, format, product, getPreviewUrl);
44
- return;
45
- }
46
- throw new Error("Unknown export format");
47
- });
48
- }
49
- get hasExport() {
50
- return this.api.hasFeature("export");
51
- }
52
- get hasRender() {
53
- return this.api.hasFeature("render");
54
- }
55
- get availableFormats() {
56
- const result = [];
57
- if (this.hasExport) {
58
- result.push(...dtoExportFormatNames);
59
- }
60
- if (this.hasRender) {
61
- result.push(...dtoRenderFormatNames);
62
- }
63
- return result;
64
- }
65
- addTask(task) {
66
- this.tasks.push(task);
67
- this._notifyAllOfChange();
68
- }
69
- removeTask(task) {
70
- const i = this.tasks.indexOf(task);
71
- this.tasks.splice(i, 1);
72
- this._notifyAllOfChange();
73
- }
74
- }
75
- export class TaskHandler {
76
- constructor(_internal) {
77
- this._internal = _internal;
78
- this.destroy = () => this._internal.destroy();
79
- this.start = (format, product, renderParams, getPreviewUrl) => __awaiter(this, void 0, void 0, function* () { return this._internal.start(format, product, renderParams, getPreviewUrl); });
80
- this.listenForChange = (l) => this._internal.changeObservable.listen(l);
81
- this.stopListenForChange = (l) => this._internal.changeObservable.stopListen(l);
82
- }
83
- static make(api) {
84
- return new this(new _TaskHandlerInternal(api));
85
- }
86
- /**
87
- * Makes an object wrapping the passed object. This is not a clone method,
88
- * it is a method to make a new outer reference. Like a shallow copy.
89
- * We use this to help frameworks that are build around using equals to detect change.
90
- */
91
- static _makeNewRefFrom(internal) {
92
- return new this(internal);
93
- }
94
- get tasks() {
95
- return this._internal.tasks;
96
- }
97
- get hasExport() {
98
- return this._internal.hasExport;
99
- }
100
- get hasRender() {
101
- return this._internal.hasRender;
102
- }
103
- get availableFormats() {
104
- return this._internal.availableFormats;
105
- }
106
- }
107
- export class Task {
108
- constructor(taskHandler, format, product, getPreviewUrl) {
109
- this.taskHandler = taskHandler;
110
- this.format = format;
111
- this._status = "pending";
112
- this._start = () => __awaiter(this, void 0, void 0, function* () {
113
- const result = yield this.postInit();
114
- this._uuid = result.uuid;
115
- this._created = result.created;
116
- this._modified = result.modified;
117
- this.setStatus(result.status);
118
- this.scheduleRefresh();
119
- });
120
- this.startAndRegister = () => __awaiter(this, void 0, void 0, function* () {
121
- try {
122
- yield this._start();
123
- this.taskHandler.addTask(this);
124
- }
125
- catch (e) {
126
- this.setStatus("failed");
127
- throw e;
128
- }
129
- });
130
- this.restart = () => __awaiter(this, void 0, void 0, function* () {
131
- try {
132
- this.stop();
133
- this.setStatus("pending");
134
- yield this._start();
135
- }
136
- catch (e) {
137
- this.setStatus("failed");
138
- throw e;
139
- }
140
- });
141
- this.scheduleRefresh = () => {
142
- this._timerId = setTimeout(this.refresh, 1000);
143
- };
144
- this.refresh = () => __awaiter(this, void 0, void 0, function* () {
145
- try {
146
- const result = yield this.pollStatus();
147
- this._modified = result.modified;
148
- const status = result.status;
149
- switch (status) {
150
- case "finished": {
151
- const url = result.url;
152
- if (!url) {
153
- throw new Error("No URL from finished task");
154
- }
155
- this._url = url;
156
- break;
157
- }
158
- case "failed":
159
- break;
160
- case "running":
161
- case "pending":
162
- this.scheduleRefresh();
163
- break;
164
- }
165
- this.setStatus(status);
166
- }
167
- catch (e) {
168
- this.setStatus("failed");
169
- console.error(e);
170
- }
171
- });
172
- this.abort = () => {
173
- this._status = "abandoned";
174
- this.stop();
175
- this.taskHandler.removeTask(this);
176
- };
177
- this._productParams = product.prodParams;
178
- this._apiSelection = product.getApiSelection();
179
- if (getPreviewUrl !== undefined) {
180
- void getPreviewUrl().then((dataUrl) => {
181
- this._previewUrl = dataUrl;
182
- this.taskHandler._notifyAllOfChange();
183
- });
184
- }
185
- }
186
- setStatus(status) {
187
- const isChange = this._status !== status;
188
- this._status = status;
189
- if (isChange) {
190
- this.taskHandler._notifyAllOfChange();
191
- }
192
- }
193
- get status() {
194
- return this._status;
195
- }
196
- get uuid() {
197
- if (this._uuid === undefined) {
198
- throw new Error("Should not happen");
199
- }
200
- return this._uuid;
201
- }
202
- get created() {
203
- if (this._created === undefined) {
204
- throw new Error("Should not happen");
205
- }
206
- return this._created;
207
- }
208
- get modified() {
209
- if (this._modified === undefined) {
210
- throw new Error("Should not happen");
211
- }
212
- return this._modified;
213
- }
214
- get url() {
215
- return this._url;
216
- }
217
- get previewUrl() {
218
- return this._previewUrl;
219
- }
220
- stop() {
221
- clearInterval(this._timerId);
222
- }
223
- }
224
- class TaskRender extends Task {
225
- constructor(taskHandler, format, product, taskParams, getPreviewUrl) {
226
- super(taskHandler, format, product, getPreviewUrl);
227
- this.taskParams = taskParams;
228
- }
229
- static make(taskHandler, format, product, taskParams, getPreviewUrl) {
230
- return __awaiter(this, void 0, void 0, function* () {
231
- const t = new TaskRender(taskHandler, format, product, taskParams, getPreviewUrl);
232
- yield t.startAndRegister();
233
- return t;
234
- });
235
- }
236
- postInit() {
237
- return __awaiter(this, void 0, void 0, function* () {
238
- try {
239
- return (yield this.taskHandler.api.postRender(this._productParams, Object.assign(Object.assign(Object.assign({}, this._apiSelection), this.taskParams), { format: this.format, width: Math.floor(this.taskParams.width), height: Math.floor(this.taskParams.height) }))).renderStatus;
240
- }
241
- catch (e) {
242
- throw augmentErrorMessage(e, "Start render request failure");
243
- }
244
- });
245
- }
246
- pollStatus() {
247
- return __awaiter(this, void 0, void 0, function* () {
248
- return (yield this.taskHandler.api.getRenderById({ uuid: this.uuid })).renderStatus;
249
- });
250
- }
251
- }
252
- class TaskExport extends Task {
253
- static make(taskHandler, format, product, getPreviewUrl) {
254
- return __awaiter(this, void 0, void 0, function* () {
255
- const t = new TaskExport(taskHandler, format, product, getPreviewUrl);
256
- yield t.startAndRegister();
257
- return t;
258
- });
259
- }
260
- postInit() {
261
- return __awaiter(this, void 0, void 0, function* () {
262
- try {
263
- return (yield this.taskHandler.api.postExport(this._productParams, Object.assign(Object.assign({}, this._apiSelection), { format: this.format, preferUnzipped: true }))).exportStatus;
264
- }
265
- catch (e) {
266
- throw augmentErrorMessage(e, "Start export request failure");
267
- }
268
- });
269
- }
270
- pollStatus() {
271
- return __awaiter(this, void 0, void 0, function* () {
272
- return (yield this.taskHandler.api.getExportById({ uuid: this.uuid })).exportStatus;
273
- });
274
- }
275
- }
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { augmentErrorMessage, Observable } from "@configura/web-utilities";
11
+ import { dtoExportFormatNames, dtoRenderFormatNames, } from "../CatalogueAPI.js";
12
+ import { isExportFormat, isRenderFormat } from "./formats.js";
13
+ export class _TaskHandlerInternal {
14
+ constructor(api) {
15
+ this.api = api;
16
+ this.changeObservable = new Observable();
17
+ this.tasks = [];
18
+ this._notifyAllOfChange = () => {
19
+ const freshRef = TaskHandler._makeNewRefFrom(this);
20
+ this.changeObservable.notifyAll({ freshRef });
21
+ };
22
+ this.destroy = () => {
23
+ this.changeObservable.stopAllListen();
24
+ for (const task of this.tasks) {
25
+ task.abort();
26
+ }
27
+ };
28
+ this.start = (format, product, renderParams, getPreviewUrl) => __awaiter(this, void 0, void 0, function* () {
29
+ if (isRenderFormat(format)) {
30
+ if (!this.hasRender) {
31
+ throw new Error("Render has not been activated for this Catalogue");
32
+ }
33
+ if (renderParams === undefined) {
34
+ throw new Error("renderParams must be set for render");
35
+ }
36
+ yield TaskRender.make(this, format, product, renderParams, getPreviewUrl);
37
+ return;
38
+ }
39
+ if (isExportFormat(format)) {
40
+ if (!this.hasExport) {
41
+ throw new Error("Export has not been activated for this Catalogue");
42
+ }
43
+ yield TaskExport.make(this, format, product, getPreviewUrl);
44
+ return;
45
+ }
46
+ throw new Error("Unknown export format");
47
+ });
48
+ }
49
+ get hasExport() {
50
+ return this.api.hasFeature("export");
51
+ }
52
+ get hasRender() {
53
+ return this.api.hasFeature("render");
54
+ }
55
+ get availableFormats() {
56
+ const result = [];
57
+ if (this.hasExport) {
58
+ result.push(...dtoExportFormatNames);
59
+ }
60
+ if (this.hasRender) {
61
+ result.push(...dtoRenderFormatNames);
62
+ }
63
+ return result;
64
+ }
65
+ addTask(task) {
66
+ this.tasks.push(task);
67
+ this._notifyAllOfChange();
68
+ }
69
+ removeTask(task) {
70
+ const i = this.tasks.indexOf(task);
71
+ this.tasks.splice(i, 1);
72
+ this._notifyAllOfChange();
73
+ }
74
+ }
75
+ export class TaskHandler {
76
+ constructor(_internal) {
77
+ this._internal = _internal;
78
+ this.destroy = () => this._internal.destroy();
79
+ this.start = (format, product, renderParams, getPreviewUrl) => __awaiter(this, void 0, void 0, function* () { return this._internal.start(format, product, renderParams, getPreviewUrl); });
80
+ this.listenForChange = (l) => this._internal.changeObservable.listen(l);
81
+ this.stopListenForChange = (l) => this._internal.changeObservable.stopListen(l);
82
+ }
83
+ static make(api) {
84
+ return new this(new _TaskHandlerInternal(api));
85
+ }
86
+ /**
87
+ * Makes an object wrapping the passed object. This is not a clone method,
88
+ * it is a method to make a new outer reference. Like a shallow copy.
89
+ * We use this to help frameworks that are build around using equals to detect change.
90
+ */
91
+ static _makeNewRefFrom(internal) {
92
+ return new this(internal);
93
+ }
94
+ get tasks() {
95
+ return this._internal.tasks;
96
+ }
97
+ get hasExport() {
98
+ return this._internal.hasExport;
99
+ }
100
+ get hasRender() {
101
+ return this._internal.hasRender;
102
+ }
103
+ get availableFormats() {
104
+ return this._internal.availableFormats;
105
+ }
106
+ }
107
+ export class Task {
108
+ constructor(taskHandler, format, product, getPreviewUrl) {
109
+ this.taskHandler = taskHandler;
110
+ this.format = format;
111
+ this._status = "pending";
112
+ this._start = () => __awaiter(this, void 0, void 0, function* () {
113
+ const result = yield this.postInit();
114
+ this._uuid = result.uuid;
115
+ this._created = result.created;
116
+ this._modified = result.modified;
117
+ this.setStatus(result.status);
118
+ this.scheduleRefresh();
119
+ });
120
+ this.startAndRegister = () => __awaiter(this, void 0, void 0, function* () {
121
+ try {
122
+ yield this._start();
123
+ this.taskHandler.addTask(this);
124
+ }
125
+ catch (e) {
126
+ this.setStatus("failed");
127
+ throw e;
128
+ }
129
+ });
130
+ this.restart = () => __awaiter(this, void 0, void 0, function* () {
131
+ try {
132
+ this.stop();
133
+ this.setStatus("pending");
134
+ yield this._start();
135
+ }
136
+ catch (e) {
137
+ this.setStatus("failed");
138
+ throw e;
139
+ }
140
+ });
141
+ this.scheduleRefresh = () => {
142
+ this._timerId = setTimeout(this.refresh, 1000);
143
+ };
144
+ this.refresh = () => __awaiter(this, void 0, void 0, function* () {
145
+ try {
146
+ const result = yield this.pollStatus();
147
+ this._modified = result.modified;
148
+ const status = result.status;
149
+ switch (status) {
150
+ case "finished": {
151
+ const url = result.url;
152
+ if (!url) {
153
+ throw new Error("No URL from finished task");
154
+ }
155
+ this._url = url;
156
+ break;
157
+ }
158
+ case "failed":
159
+ break;
160
+ case "running":
161
+ case "pending":
162
+ this.scheduleRefresh();
163
+ break;
164
+ }
165
+ this.setStatus(status);
166
+ }
167
+ catch (e) {
168
+ this.setStatus("failed");
169
+ console.error(e);
170
+ }
171
+ });
172
+ this.abort = () => {
173
+ this._status = "abandoned";
174
+ this.stop();
175
+ this.taskHandler.removeTask(this);
176
+ };
177
+ this._productParams = product.prodParams;
178
+ this._apiSelection = product.getApiSelection();
179
+ if (getPreviewUrl !== undefined) {
180
+ void getPreviewUrl().then((dataUrl) => {
181
+ this._previewUrl = dataUrl;
182
+ this.taskHandler._notifyAllOfChange();
183
+ });
184
+ }
185
+ }
186
+ setStatus(status) {
187
+ const isChange = this._status !== status;
188
+ this._status = status;
189
+ if (isChange) {
190
+ this.taskHandler._notifyAllOfChange();
191
+ }
192
+ }
193
+ get status() {
194
+ return this._status;
195
+ }
196
+ get uuid() {
197
+ if (this._uuid === undefined) {
198
+ throw new Error("Should not happen");
199
+ }
200
+ return this._uuid;
201
+ }
202
+ get created() {
203
+ if (this._created === undefined) {
204
+ throw new Error("Should not happen");
205
+ }
206
+ return this._created;
207
+ }
208
+ get modified() {
209
+ if (this._modified === undefined) {
210
+ throw new Error("Should not happen");
211
+ }
212
+ return this._modified;
213
+ }
214
+ get url() {
215
+ return this._url;
216
+ }
217
+ get previewUrl() {
218
+ return this._previewUrl;
219
+ }
220
+ stop() {
221
+ clearInterval(this._timerId);
222
+ }
223
+ }
224
+ class TaskRender extends Task {
225
+ constructor(taskHandler, format, product, taskParams, getPreviewUrl) {
226
+ super(taskHandler, format, product, getPreviewUrl);
227
+ this.taskParams = taskParams;
228
+ }
229
+ static make(taskHandler, format, product, taskParams, getPreviewUrl) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ const t = new TaskRender(taskHandler, format, product, taskParams, getPreviewUrl);
232
+ yield t.startAndRegister();
233
+ return t;
234
+ });
235
+ }
236
+ postInit() {
237
+ return __awaiter(this, void 0, void 0, function* () {
238
+ try {
239
+ return (yield this.taskHandler.api.postRender(this._productParams, Object.assign(Object.assign(Object.assign({}, this._apiSelection), this.taskParams), { format: this.format, width: Math.floor(this.taskParams.width), height: Math.floor(this.taskParams.height) }))).renderStatus;
240
+ }
241
+ catch (e) {
242
+ throw augmentErrorMessage(e, "Start render request failure");
243
+ }
244
+ });
245
+ }
246
+ pollStatus() {
247
+ return __awaiter(this, void 0, void 0, function* () {
248
+ return (yield this.taskHandler.api.getRenderById({ uuid: this.uuid })).renderStatus;
249
+ });
250
+ }
251
+ }
252
+ class TaskExport extends Task {
253
+ static make(taskHandler, format, product, getPreviewUrl) {
254
+ return __awaiter(this, void 0, void 0, function* () {
255
+ const t = new TaskExport(taskHandler, format, product, getPreviewUrl);
256
+ yield t.startAndRegister();
257
+ return t;
258
+ });
259
+ }
260
+ postInit() {
261
+ return __awaiter(this, void 0, void 0, function* () {
262
+ try {
263
+ return (yield this.taskHandler.api.postExport(this._productParams, Object.assign(Object.assign({}, this._apiSelection), { format: this.format, preferUnzipped: true }))).exportStatus;
264
+ }
265
+ catch (e) {
266
+ throw augmentErrorMessage(e, "Start export request failure");
267
+ }
268
+ });
269
+ }
270
+ pollStatus() {
271
+ return __awaiter(this, void 0, void 0, function* () {
272
+ return (yield this.taskHandler.api.getExportById({ uuid: this.uuid })).exportStatus;
273
+ });
274
+ }
275
+ }
@@ -1,5 +1,5 @@
1
- import { DtoExportFormat, DtoRenderFormat } from "../CatalogueAPI.js";
2
- export declare type RenderOrExportFormat = DtoRenderFormat | DtoExportFormat;
3
- export declare function isRenderFormat(type: unknown): type is DtoRenderFormat;
4
- export declare function isExportFormat(type: unknown): type is DtoExportFormat;
1
+ import { DtoExportFormat, DtoRenderFormat } from "../CatalogueAPI.js";
2
+ export declare type RenderOrExportFormat = DtoRenderFormat | DtoExportFormat;
3
+ export declare function isRenderFormat(type: unknown): type is DtoRenderFormat;
4
+ export declare function isExportFormat(type: unknown): type is DtoExportFormat;
5
5
  //# sourceMappingURL=formats.d.ts.map
@@ -1,7 +1,7 @@
1
- import { dtoExportFormatNames, dtoRenderFormatNames, } from "../CatalogueAPI.js";
2
- export function isRenderFormat(type) {
3
- return dtoRenderFormatNames.some((f) => type === f);
4
- }
5
- export function isExportFormat(type) {
6
- return dtoExportFormatNames.some((f) => type === f);
7
- }
1
+ import { dtoExportFormatNames, dtoRenderFormatNames, } from "../CatalogueAPI.js";
2
+ export function isRenderFormat(type) {
3
+ return dtoRenderFormatNames.some((f) => type === f);
4
+ }
5
+ export function isExportFormat(type) {
6
+ return dtoExportFormatNames.some((f) => type === f);
7
+ }