@valtimo/resource 4.15.2-next-main.15 → 4.15.3-next-main.16

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.
@@ -6,391 +6,403 @@ import { S3Resource, UploadProvider } from '@valtimo/contract';
6
6
  import { v4 } from 'uuid';
7
7
  import { NGXLogger } from 'ngx-logger';
8
8
 
9
- /*
10
- * Copyright 2020 Dimpact.
11
- *
12
- * Licensed under EUPL, Version 1.2 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" basis,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- class OpenZaakService {
25
- constructor(http, configService) {
26
- this.http = http;
27
- this.configService = configService;
28
- this.valtimoApiConfig = configService.config.valtimoApi;
29
- this.catalogus = configService.config.openZaak.catalogus;
30
- }
31
- getOpenZaakConfig() {
32
- return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/config`);
33
- }
34
- getResource(resourceId) {
35
- return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`);
36
- }
37
- getZaakTypes() {
38
- return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/zaaktype`);
39
- }
40
- getInformatieObjectTypes() {
41
- return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-typen/${this.catalogus}`);
42
- }
43
- getZaakTypeLink(id) {
44
- return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}`);
45
- }
46
- getInformatieObjectTypeLink(id) {
47
- return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link/${id}`);
48
- }
49
- createZaakTypeLink(request) {
50
- return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/link`, request);
51
- }
52
- createInformatieObjectTypeLink(request) {
53
- return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link`, request);
54
- }
55
- deleteZaakTypeLink(id) {
56
- return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}`);
57
- }
58
- deleteInformatieObjectTypeLink(id) {
59
- return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link/${id}`);
60
- }
61
- getZaakTypeLinkListByProcess(processDefinitionKey) {
62
- return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/link/process/${processDefinitionKey}`);
63
- }
64
- getStatusTypes(zaakTypeRequest) {
65
- return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/status`, zaakTypeRequest);
66
- }
67
- getStatusResults(zaakTypeRequest) {
68
- return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/resultaat`, zaakTypeRequest);
69
- }
70
- createServiceTaskHandler(id, request) {
71
- return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler`, request);
72
- }
73
- modifyServiceTaskHandler(id, request) {
74
- return this.http.put(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler`, request);
75
- }
76
- deleteServiceTaskHandler(id, processDefinitionKey, serviceTaskId) {
77
- return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler/${processDefinitionKey}/${serviceTaskId}`);
78
- }
79
- upload(file, documentDefinitionName) {
80
- const formData = new FormData();
81
- formData.append('file', file);
82
- formData.append('documentDefinitionName', documentDefinitionName);
83
- return this.http.post(`${this.valtimoApiConfig.endpointUri}resource/upload-open-zaak`, formData, {
84
- reportProgress: true,
85
- responseType: 'json'
86
- });
87
- }
88
- }
89
- OpenZaakService.ɵprov = ɵɵdefineInjectable({ factory: function OpenZaakService_Factory() { return new OpenZaakService(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: OpenZaakService, providedIn: "root" });
90
- OpenZaakService.decorators = [
91
- { type: Injectable, args: [{
92
- providedIn: 'root'
93
- },] }
94
- ];
95
- OpenZaakService.ctorParameters = () => [
96
- { type: HttpClient },
97
- { type: ConfigService }
9
+ /*
10
+ * Copyright 2020 Dimpact.
11
+ *
12
+ * Licensed under EUPL, Version 1.2 (the "License");
13
+ * you may not use this file except in compliance with the License.
14
+ * You may obtain a copy of the License at
15
+ *
16
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" basis,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ class OpenZaakService {
25
+ constructor(http, configService) {
26
+ this.http = http;
27
+ this.configService = configService;
28
+ this.valtimoApiConfig = configService.config.valtimoApi;
29
+ this.catalogus = configService.config.openZaak.catalogus;
30
+ }
31
+ getOpenZaakConfig() {
32
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/config`);
33
+ }
34
+ getResource(resourceId) {
35
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`);
36
+ }
37
+ getZaakTypes() {
38
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/zaaktype`);
39
+ }
40
+ getInformatieObjectTypes() {
41
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-typen/${this.catalogus}`);
42
+ }
43
+ getZaakTypeLink(id) {
44
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}`);
45
+ }
46
+ getInformatieObjectTypeLink(id) {
47
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link/${id}`);
48
+ }
49
+ createZaakTypeLink(request) {
50
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/link`, request);
51
+ }
52
+ createInformatieObjectTypeLink(request) {
53
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link`, request);
54
+ }
55
+ deleteZaakTypeLink(id) {
56
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}`);
57
+ }
58
+ deleteInformatieObjectTypeLink(id) {
59
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link/${id}`);
60
+ }
61
+ getZaakTypeLinkListByProcess(processDefinitionKey) {
62
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/link/process/${processDefinitionKey}`);
63
+ }
64
+ getStatusTypes(zaakTypeRequest) {
65
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/status`, zaakTypeRequest);
66
+ }
67
+ getStatusResults(zaakTypeRequest) {
68
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/resultaat`, zaakTypeRequest);
69
+ }
70
+ createServiceTaskHandler(id, request) {
71
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler`, request);
72
+ }
73
+ modifyServiceTaskHandler(id, request) {
74
+ return this.http.put(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler`, request);
75
+ }
76
+ deleteServiceTaskHandler(id, processDefinitionKey, serviceTaskId) {
77
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler/${processDefinitionKey}/${serviceTaskId}`);
78
+ }
79
+ upload(file, documentDefinitionName) {
80
+ const formData = new FormData();
81
+ formData.append('file', file);
82
+ formData.append('documentDefinitionName', documentDefinitionName);
83
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}resource/upload-open-zaak`, formData, {
84
+ reportProgress: true,
85
+ responseType: 'json',
86
+ });
87
+ }
88
+ }
89
+ OpenZaakService.ɵprov = ɵɵdefineInjectable({ factory: function OpenZaakService_Factory() { return new OpenZaakService(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: OpenZaakService, providedIn: "root" });
90
+ OpenZaakService.decorators = [
91
+ { type: Injectable, args: [{
92
+ providedIn: 'root',
93
+ },] }
94
+ ];
95
+ OpenZaakService.ctorParameters = () => [
96
+ { type: HttpClient },
97
+ { type: ConfigService }
98
98
  ];
99
99
 
100
- /*
101
- * Copyright 2015-2020 Ritense BV, the Netherlands.
102
- *
103
- * Licensed under EUPL, Version 1.2 (the "License");
104
- * you may not use this file except in compliance with the License.
105
- * You may obtain a copy of the License at
106
- *
107
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
108
- *
109
- * Unless required by applicable law or agreed to in writing, software
110
- * distributed under the License is distributed on an "AS IS" basis,
111
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112
- * See the License for the specific language governing permissions and
113
- * limitations under the License.
114
- */
115
- class OpenZaakUploadService {
116
- constructor(openZaakService, http, configService) {
117
- this.openZaakService = openZaakService;
118
- this.http = http;
119
- this.configService = configService;
120
- this.valtimoApiConfig = configService.config.valtimoApi;
121
- }
122
- uploadFile(file, documentDefinitionName) {
123
- return this.openZaakService.upload(new File([file], file.name, { type: file.type }), documentDefinitionName).pipe(map(result => this.getResourceFile(result)));
124
- }
125
- getResource(resourceId) {
126
- return this.openZaakService.getResource(resourceId);
127
- }
128
- getResourceFile(result) {
129
- return {
130
- customUpload: true,
131
- originalName: result.name,
132
- size: result.sizeInBytes,
133
- url: '/api/resource/' + result.resourceId + '/download',
134
- storage: 'openZaak',
135
- type: result.extension,
136
- data: {
137
- createdOn: result.createdOn,
138
- name: result.name,
139
- sizeInBytes: result.sizeInBytes,
140
- resourceId: result.resourceId,
141
- extension: result.extension
142
- }
143
- };
144
- }
145
- }
146
- OpenZaakUploadService.decorators = [
147
- { type: Injectable }
148
- ];
149
- OpenZaakUploadService.ctorParameters = () => [
150
- { type: OpenZaakService },
151
- { type: HttpClient },
152
- { type: ConfigService }
100
+ /*
101
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
102
+ *
103
+ * Licensed under EUPL, Version 1.2 (the "License");
104
+ * you may not use this file except in compliance with the License.
105
+ * You may obtain a copy of the License at
106
+ *
107
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
108
+ *
109
+ * Unless required by applicable law or agreed to in writing, software
110
+ * distributed under the License is distributed on an "AS IS" basis,
111
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
112
+ * See the License for the specific language governing permissions and
113
+ * limitations under the License.
114
+ */
115
+ class OpenZaakUploadService {
116
+ constructor(openZaakService, http, configService) {
117
+ this.openZaakService = openZaakService;
118
+ this.http = http;
119
+ this.configService = configService;
120
+ this.valtimoApiConfig = configService.config.valtimoApi;
121
+ }
122
+ uploadFile(file, documentDefinitionName) {
123
+ return this.openZaakService
124
+ .upload(new File([file], file.name, { type: file.type }), documentDefinitionName)
125
+ .pipe(map(result => this.getResourceFile(result)));
126
+ }
127
+ getResource(resourceId) {
128
+ return this.openZaakService.getResource(resourceId);
129
+ }
130
+ getResourceFile(result) {
131
+ return {
132
+ customUpload: true,
133
+ originalName: result.name,
134
+ size: result.sizeInBytes,
135
+ url: '/api/resource/' + result.resourceId + '/download',
136
+ storage: 'openZaak',
137
+ type: result.extension,
138
+ data: {
139
+ createdOn: result.createdOn,
140
+ name: result.name,
141
+ sizeInBytes: result.sizeInBytes,
142
+ resourceId: result.resourceId,
143
+ extension: result.extension,
144
+ },
145
+ };
146
+ }
147
+ }
148
+ OpenZaakUploadService.decorators = [
149
+ { type: Injectable }
150
+ ];
151
+ OpenZaakUploadService.ctorParameters = () => [
152
+ { type: OpenZaakService },
153
+ { type: HttpClient },
154
+ { type: ConfigService }
153
155
  ];
154
156
 
155
- /*
156
- * Copyright 2015-2020 Ritense BV, the Netherlands.
157
- *
158
- * Licensed under EUPL, Version 1.2 (the "License");
159
- * you may not use this file except in compliance with the License.
160
- * You may obtain a copy of the License at
161
- *
162
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
163
- *
164
- * Unless required by applicable law or agreed to in writing, software
165
- * distributed under the License is distributed on an "AS IS" basis,
166
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
167
- * See the License for the specific language governing permissions and
168
- * limitations under the License.
169
- */
170
- class S3Service {
171
- constructor(http, configService) {
172
- this.http = http;
173
- this.configService = configService;
174
- this.valtimoApiConfig = configService.config.valtimoApi;
175
- }
176
- getPreSignedUrl(fileName) {
177
- const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');
178
- const options = { headers, responseType: 'text' };
179
- return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/pre-signed-url/${fileName}`, options);
180
- }
181
- upload(url, file) {
182
- const headers = new HttpHeaders()
183
- .set('Content-Type', file.type);
184
- return this.http.put(url.toString(), file, { headers: headers });
185
- }
186
- registerResource(s3ResourceDTO) {
187
- return this.http.put(`${this.valtimoApiConfig.endpointUri}resource`, s3ResourceDTO);
188
- }
189
- get(resourceId) {
190
- const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
191
- return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`, { headers: headers });
192
- }
193
- delete(resourceId) {
194
- const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
195
- return this.http.delete(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`, { headers: headers });
196
- }
197
- }
198
- S3Service.ɵprov = ɵɵdefineInjectable({ factory: function S3Service_Factory() { return new S3Service(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: S3Service, providedIn: "root" });
199
- S3Service.decorators = [
200
- { type: Injectable, args: [{
201
- providedIn: 'root'
202
- },] }
203
- ];
204
- S3Service.ctorParameters = () => [
205
- { type: HttpClient },
206
- { type: ConfigService }
157
+ /*
158
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
159
+ *
160
+ * Licensed under EUPL, Version 1.2 (the "License");
161
+ * you may not use this file except in compliance with the License.
162
+ * You may obtain a copy of the License at
163
+ *
164
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
165
+ *
166
+ * Unless required by applicable law or agreed to in writing, software
167
+ * distributed under the License is distributed on an "AS IS" basis,
168
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
169
+ * See the License for the specific language governing permissions and
170
+ * limitations under the License.
171
+ */
172
+ class S3Service {
173
+ constructor(http, configService) {
174
+ this.http = http;
175
+ this.configService = configService;
176
+ this.valtimoApiConfig = configService.config.valtimoApi;
177
+ }
178
+ getPreSignedUrl(fileName) {
179
+ const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');
180
+ const options = { headers, responseType: 'text' };
181
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/pre-signed-url/${fileName}`, options);
182
+ }
183
+ upload(url, file) {
184
+ const headers = new HttpHeaders().set('Content-Type', file.type);
185
+ return this.http.put(url.toString(), file, { headers: headers });
186
+ }
187
+ registerResource(s3ResourceDTO) {
188
+ return this.http.put(`${this.valtimoApiConfig.endpointUri}resource`, s3ResourceDTO);
189
+ }
190
+ get(resourceId) {
191
+ const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
192
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`, { headers: headers });
193
+ }
194
+ delete(resourceId) {
195
+ const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
196
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`, {
197
+ headers: headers,
198
+ });
199
+ }
200
+ }
201
+ S3Service.ɵprov = ɵɵdefineInjectable({ factory: function S3Service_Factory() { return new S3Service(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: S3Service, providedIn: "root" });
202
+ S3Service.decorators = [
203
+ { type: Injectable, args: [{
204
+ providedIn: 'root',
205
+ },] }
206
+ ];
207
+ S3Service.ctorParameters = () => [
208
+ { type: HttpClient },
209
+ { type: ConfigService }
207
210
  ];
208
211
 
209
- /*
210
- * Copyright 2015-2020 Ritense BV, the Netherlands.
211
- *
212
- * Licensed under EUPL, Version 1.2 (the "License");
213
- * you may not use this file except in compliance with the License.
214
- * You may obtain a copy of the License at
215
- *
216
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
217
- *
218
- * Unless required by applicable law or agreed to in writing, software
219
- * distributed under the License is distributed on an "AS IS" basis,
220
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
221
- * See the License for the specific language governing permissions and
222
- * limitations under the License.
223
- */
224
- class S3UploadService {
225
- constructor(s3Service) {
226
- this.s3Service = s3Service;
227
- }
228
- uploadFile(file) {
229
- let resourceUrl;
230
- const fileName = file.name;
231
- const splitFileName = fileName.split('.');
232
- const fileNameWithUUID = `${splitFileName[0]}-${v4()}.${splitFileName[1]}`;
233
- const renamedFile = new File([file], fileNameWithUUID, { type: file.type });
234
- return this.s3Service.getPreSignedUrl(renamedFile.name).pipe(map((url) => new URL(url)), tap((url) => resourceUrl = url), switchMap((url) => this.s3Service.upload(url, renamedFile)), map(() => new S3Resource(file, resourceUrl)), switchMap((s3Resource) => this.s3Service.registerResource(s3Resource)), switchMap((s3Resource) => this.s3Service.get(s3Resource.id)), map((result) => (Object.assign(Object.assign({}, result), { originalName: file.name }))), map((result) => this.getResourceFile(result)));
235
- }
236
- getResource(resourceId) {
237
- return this.s3Service.get(resourceId);
238
- }
239
- getResourceFile(result) {
240
- return {
241
- customUpload: true,
242
- originalName: result.originalName,
243
- url: result.url,
244
- size: result.resource.sizeInBytes,
245
- storage: 'url',
246
- type: result.resource.extension,
247
- data: {
248
- key: result.resource.key,
249
- bucketName: result.resource.name,
250
- createdOn: result.resource.createdOn,
251
- name: result.originalName,
252
- sizeInBytes: result.resource.sizeInBytes,
253
- resourceId: result.resource.id.split('ResourceId(id=')[1].slice(0, -1)
254
- }
255
- };
256
- }
257
- }
258
- S3UploadService.decorators = [
259
- { type: Injectable }
260
- ];
261
- S3UploadService.ctorParameters = () => [
262
- { type: S3Service }
212
+ /*
213
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
214
+ *
215
+ * Licensed under EUPL, Version 1.2 (the "License");
216
+ * you may not use this file except in compliance with the License.
217
+ * You may obtain a copy of the License at
218
+ *
219
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
220
+ *
221
+ * Unless required by applicable law or agreed to in writing, software
222
+ * distributed under the License is distributed on an "AS IS" basis,
223
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
+ * See the License for the specific language governing permissions and
225
+ * limitations under the License.
226
+ */
227
+ class S3UploadService {
228
+ constructor(s3Service) {
229
+ this.s3Service = s3Service;
230
+ }
231
+ uploadFile(file) {
232
+ let resourceUrl;
233
+ const fileName = file.name;
234
+ const splitFileName = fileName.split('.');
235
+ const fileNameWithUUID = `${splitFileName[0]}-${v4()}.${splitFileName[1]}`;
236
+ const renamedFile = new File([file], fileNameWithUUID, { type: file.type });
237
+ return this.s3Service.getPreSignedUrl(renamedFile.name).pipe(map(url => new URL(url)), tap(url => (resourceUrl = url)), switchMap(url => this.s3Service.upload(url, renamedFile)), map(() => new S3Resource(file, resourceUrl)), switchMap(s3Resource => this.s3Service.registerResource(s3Resource)), switchMap(s3Resource => this.s3Service.get(s3Resource.id)), map(result => (Object.assign(Object.assign({}, result), { originalName: file.name }))), map(result => this.getResourceFile(result)));
238
+ }
239
+ getResource(resourceId) {
240
+ return this.s3Service.get(resourceId);
241
+ }
242
+ getResourceFile(result) {
243
+ return {
244
+ customUpload: true,
245
+ originalName: result.originalName,
246
+ url: result.url,
247
+ size: result.resource.sizeInBytes,
248
+ storage: 'url',
249
+ type: result.resource.extension,
250
+ data: {
251
+ key: result.resource.key,
252
+ bucketName: result.resource.name,
253
+ createdOn: result.resource.createdOn,
254
+ name: result.originalName,
255
+ sizeInBytes: result.resource.sizeInBytes,
256
+ resourceId: result.resource.id.split('ResourceId(id=')[1].slice(0, -1),
257
+ },
258
+ };
259
+ }
260
+ }
261
+ S3UploadService.decorators = [
262
+ { type: Injectable }
263
+ ];
264
+ S3UploadService.ctorParameters = () => [
265
+ { type: S3Service }
263
266
  ];
264
267
 
265
- /*
266
- * Copyright 2015-2020 Ritense BV, the Netherlands.
267
- *
268
- * Licensed under EUPL, Version 1.2 (the "License");
269
- * you may not use this file except in compliance with the License.
270
- * You may obtain a copy of the License at
271
- *
272
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
273
- *
274
- * Unless required by applicable law or agreed to in writing, software
275
- * distributed under the License is distributed on an "AS IS" basis,
276
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
277
- * See the License for the specific language governing permissions and
278
- * limitations under the License.
279
- */
280
- class UploadProviderService {
281
- constructor(configService, injector, logger) {
282
- this.configService = configService;
283
- this.injector = injector;
284
- this.logger = logger;
285
- this.uploadService = configService.config.uploadProvider === UploadProvider.S3 ?
286
- injector.get(S3UploadService)
287
- : injector.get(OpenZaakUploadService);
288
- this.logger.debug('Loading UploadService as', this.uploadService);
289
- }
290
- uploadFile(file, documentDefinitionName) {
291
- return this.uploadService.uploadFile(file, documentDefinitionName);
292
- }
293
- getResource(resourceId) {
294
- return this.uploadService.getResource(resourceId);
295
- }
296
- }
297
- UploadProviderService.ɵprov = ɵɵdefineInjectable({ factory: function UploadProviderService_Factory() { return new UploadProviderService(ɵɵinject(ConfigService), ɵɵinject(INJECTOR), ɵɵinject(NGXLogger)); }, token: UploadProviderService, providedIn: "root" });
298
- UploadProviderService.decorators = [
299
- { type: Injectable, args: [{
300
- providedIn: 'root'
301
- },] }
302
- ];
303
- UploadProviderService.ctorParameters = () => [
304
- { type: ConfigService },
305
- { type: Injector },
306
- { type: NGXLogger }
268
+ /*
269
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
270
+ *
271
+ * Licensed under EUPL, Version 1.2 (the "License");
272
+ * you may not use this file except in compliance with the License.
273
+ * You may obtain a copy of the License at
274
+ *
275
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
276
+ *
277
+ * Unless required by applicable law or agreed to in writing, software
278
+ * distributed under the License is distributed on an "AS IS" basis,
279
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
280
+ * See the License for the specific language governing permissions and
281
+ * limitations under the License.
282
+ */
283
+ class UploadProviderService {
284
+ constructor(configService, injector, logger) {
285
+ this.configService = configService;
286
+ this.injector = injector;
287
+ this.logger = logger;
288
+ this.uploadService =
289
+ configService.config.uploadProvider === UploadProvider.S3
290
+ ? injector.get(S3UploadService)
291
+ : injector.get(OpenZaakUploadService);
292
+ this.logger.debug('Loading UploadService as', this.uploadService);
293
+ }
294
+ uploadFile(file, documentDefinitionName) {
295
+ return this.uploadService.uploadFile(file, documentDefinitionName);
296
+ }
297
+ getResource(resourceId) {
298
+ return this.uploadService.getResource(resourceId);
299
+ }
300
+ }
301
+ UploadProviderService.ɵprov = ɵɵdefineInjectable({ factory: function UploadProviderService_Factory() { return new UploadProviderService(ɵɵinject(ConfigService), ɵɵinject(INJECTOR), ɵɵinject(NGXLogger)); }, token: UploadProviderService, providedIn: "root" });
302
+ UploadProviderService.decorators = [
303
+ { type: Injectable, args: [{
304
+ providedIn: 'root',
305
+ },] }
306
+ ];
307
+ UploadProviderService.ctorParameters = () => [
308
+ { type: ConfigService },
309
+ { type: Injector },
310
+ { type: NGXLogger }
307
311
  ];
308
312
 
309
- /*
310
- * Copyright 2015-2020 Ritense BV, the Netherlands.
311
- *
312
- * Licensed under EUPL, Version 1.2 (the "License");
313
- * you may not use this file except in compliance with the License.
314
- * You may obtain a copy of the License at
315
- *
316
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
317
- *
318
- * Unless required by applicable law or agreed to in writing, software
319
- * distributed under the License is distributed on an "AS IS" basis,
320
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
321
- * See the License for the specific language governing permissions and
322
- * limitations under the License.
323
- */
324
- class DownloadService {
325
- constructor(http, configService) {
326
- this.http = http;
327
- this.configService = configService;
328
- }
329
- downloadFile(url, name) {
330
- if (url.startsWith(this.configService.config.valtimoApi.endpointUri) || url.startsWith(window.location.origin)) {
331
- // if download url is on backend use angular to get the content so access token is used
332
- this.http.get(url, { responseType: 'blob' }).subscribe(content => {
333
- const downloadUrl = window.URL.createObjectURL(content);
334
- this.openDownloadLink(downloadUrl, name);
335
- });
336
- }
337
- else {
338
- // download links to external services (like amazon s3) open in a new window
339
- this.openDownloadLink(url, name);
340
- }
341
- }
342
- openDownloadLink(url, name) {
343
- const link = document.createElement('a');
344
- link.href = url;
345
- link.download = name;
346
- link.target = '_blank';
347
- link.click();
348
- link.remove();
349
- }
350
- }
351
- DownloadService.ɵprov = ɵɵdefineInjectable({ factory: function DownloadService_Factory() { return new DownloadService(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: DownloadService, providedIn: "root" });
352
- DownloadService.decorators = [
353
- { type: Injectable, args: [{
354
- providedIn: 'root'
355
- },] }
356
- ];
357
- DownloadService.ctorParameters = () => [
358
- { type: HttpClient },
359
- { type: ConfigService }
313
+ /*
314
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
315
+ *
316
+ * Licensed under EUPL, Version 1.2 (the "License");
317
+ * you may not use this file except in compliance with the License.
318
+ * You may obtain a copy of the License at
319
+ *
320
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
321
+ *
322
+ * Unless required by applicable law or agreed to in writing, software
323
+ * distributed under the License is distributed on an "AS IS" basis,
324
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
325
+ * See the License for the specific language governing permissions and
326
+ * limitations under the License.
327
+ */
328
+ class DownloadService {
329
+ constructor(http, configService) {
330
+ this.http = http;
331
+ this.configService = configService;
332
+ }
333
+ downloadFile(url, name) {
334
+ if (url.startsWith(this.configService.config.valtimoApi.endpointUri) ||
335
+ url.startsWith(window.location.origin)) {
336
+ // if download url is on backend use angular to get the content so access token is used
337
+ this.http.get(url, { responseType: 'blob' }).subscribe(content => {
338
+ const downloadUrl = window.URL.createObjectURL(content);
339
+ this.openDownloadLink(downloadUrl, name);
340
+ });
341
+ }
342
+ else {
343
+ // download links to external services (like amazon s3) open in a new window
344
+ this.openDownloadLink(url, name);
345
+ }
346
+ }
347
+ openDownloadLink(url, name) {
348
+ const link = document.createElement('a');
349
+ link.href = url;
350
+ link.download = name;
351
+ link.target = '_blank';
352
+ link.click();
353
+ link.remove();
354
+ }
355
+ }
356
+ DownloadService.ɵprov = ɵɵdefineInjectable({ factory: function DownloadService_Factory() { return new DownloadService(ɵɵinject(HttpClient), ɵɵinject(ConfigService)); }, token: DownloadService, providedIn: "root" });
357
+ DownloadService.decorators = [
358
+ { type: Injectable, args: [{
359
+ providedIn: 'root',
360
+ },] }
361
+ ];
362
+ DownloadService.ctorParameters = () => [
363
+ { type: HttpClient },
364
+ { type: ConfigService }
360
365
  ];
361
366
 
362
- /*
363
- * Copyright 2015-2020 Ritense BV, the Netherlands.
364
- *
365
- * Licensed under EUPL, Version 1.2 (the "License");
366
- * you may not use this file except in compliance with the License.
367
- * You may obtain a copy of the License at
368
- *
369
- * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
370
- *
371
- * Unless required by applicable law or agreed to in writing, software
372
- * distributed under the License is distributed on an "AS IS" basis,
373
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
374
- * See the License for the specific language governing permissions and
375
- * limitations under the License.
376
- */
377
- class ResourceModule {
378
- }
379
- ResourceModule.decorators = [
380
- { type: NgModule, args: [{
381
- declarations: [],
382
- imports: [],
383
- exports: [],
384
- providers: [OpenZaakUploadService, S3UploadService, UploadProviderService, OpenZaakService, S3Service, DownloadService]
385
- },] }
367
+ /*
368
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
369
+ *
370
+ * Licensed under EUPL, Version 1.2 (the "License");
371
+ * you may not use this file except in compliance with the License.
372
+ * You may obtain a copy of the License at
373
+ *
374
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
375
+ *
376
+ * Unless required by applicable law or agreed to in writing, software
377
+ * distributed under the License is distributed on an "AS IS" basis,
378
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
379
+ * See the License for the specific language governing permissions and
380
+ * limitations under the License.
381
+ */
382
+ class ResourceModule {
383
+ }
384
+ ResourceModule.decorators = [
385
+ { type: NgModule, args: [{
386
+ declarations: [],
387
+ imports: [],
388
+ exports: [],
389
+ providers: [
390
+ OpenZaakUploadService,
391
+ S3UploadService,
392
+ UploadProviderService,
393
+ OpenZaakService,
394
+ S3Service,
395
+ DownloadService,
396
+ ],
397
+ },] }
386
398
  ];
387
399
 
388
- /*
389
- * Public API Surface of upload
400
+ /*
401
+ * Public API Surface of upload
390
402
  */
391
403
 
392
- /**
393
- * Generated bundle index. Do not edit.
404
+ /**
405
+ * Generated bundle index. Do not edit.
394
406
  */
395
407
 
396
408
  export { DownloadService, OpenZaakService, ResourceModule, S3Service, UploadProviderService, OpenZaakUploadService as ɵa, S3UploadService as ɵb };