@valtimo/resource 10.8.0 → 11.0.0
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.
- package/esm2022/lib/models/open-zaak.model.mjs +69 -0
- package/{esm2020 → esm2022}/lib/models/upload.model.mjs +1 -1
- package/esm2022/lib/models/uploader.model.mjs +30 -0
- package/{esm2020 → esm2022}/lib/resource.module.mjs +12 -12
- package/esm2022/lib/services/download.service.mjs +89 -0
- package/{esm2020 → esm2022}/lib/services/open-zaak-upload.service.mjs +4 -4
- package/esm2022/lib/services/open-zaak.service.mjs +116 -0
- package/esm2022/lib/services/s3-upload.service.mjs +46 -0
- package/esm2022/lib/services/s3.service.mjs +58 -0
- package/esm2022/lib/services/upload-provider.service.mjs +77 -0
- package/{fesm2020 → fesm2022}/valtimo-resource.mjs +42 -51
- package/fesm2022/valtimo-resource.mjs.map +1 -0
- package/lib/models/open-zaak.model.d.ts +0 -14
- package/lib/models/open-zaak.model.d.ts.map +1 -1
- package/lib/models/upload.model.d.ts +1 -1
- package/lib/models/upload.model.d.ts.map +1 -1
- package/lib/models/uploader.model.d.ts +2 -1
- package/lib/models/uploader.model.d.ts.map +1 -1
- package/lib/services/download.service.d.ts.map +1 -1
- package/lib/services/open-zaak.service.d.ts +1 -4
- package/lib/services/open-zaak.service.d.ts.map +1 -1
- package/lib/services/s3-upload.service.d.ts +1 -1
- package/lib/services/s3-upload.service.d.ts.map +1 -1
- package/lib/services/s3.service.d.ts.map +1 -1
- package/lib/services/upload-provider.service.d.ts +1 -1
- package/lib/services/upload-provider.service.d.ts.map +1 -1
- package/package.json +8 -14
- package/esm2020/lib/models/open-zaak.model.mjs +0 -76
- package/esm2020/lib/models/uploader.model.mjs +0 -26
- package/esm2020/lib/services/download.service.mjs +0 -89
- package/esm2020/lib/services/open-zaak.service.mjs +0 -125
- package/esm2020/lib/services/s3-upload.service.mjs +0 -46
- package/esm2020/lib/services/s3.service.mjs +0 -58
- package/esm2020/lib/services/upload-provider.service.mjs +0 -77
- package/fesm2015/valtimo-resource.mjs +0 -627
- package/fesm2015/valtimo-resource.mjs.map +0 -1
- package/fesm2020/valtimo-resource.mjs.map +0 -1
- /package/{esm2020 → esm2022}/lib/models/index.mjs +0 -0
- /package/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/{esm2020 → esm2022}/valtimo-resource.mjs +0 -0
|
@@ -1,627 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, NgModule } from '@angular/core';
|
|
3
|
-
import { map, tap, switchMap } from 'rxjs/operators';
|
|
4
|
-
import * as i1 from '@angular/common/http';
|
|
5
|
-
import { HttpHeaders } from '@angular/common/http';
|
|
6
|
-
import * as i2 from '@valtimo/config';
|
|
7
|
-
import { UploadProvider } from '@valtimo/config';
|
|
8
|
-
import { v4 } from 'uuid';
|
|
9
|
-
import { of, Subject } from 'rxjs';
|
|
10
|
-
import * as i2$1 from 'ngx-logger';
|
|
11
|
-
|
|
12
|
-
/*
|
|
13
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
14
|
-
*
|
|
15
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
16
|
-
* you may not use this file except in compliance with the License.
|
|
17
|
-
* You may obtain a copy of the License at
|
|
18
|
-
*
|
|
19
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
20
|
-
*
|
|
21
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
22
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
23
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
|
-
* See the License for the specific language governing permissions and
|
|
25
|
-
* limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
class S3Resource {
|
|
28
|
-
constructor(file, preSignedUrl) {
|
|
29
|
-
this.id = null;
|
|
30
|
-
this.extension = null;
|
|
31
|
-
this.createdOn = null;
|
|
32
|
-
this.key = decodeURIComponent(preSignedUrl.pathname.substring(1));
|
|
33
|
-
this.name = file.name;
|
|
34
|
-
this.sizeInBytes = file.size;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
40
|
-
*
|
|
41
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
42
|
-
* you may not use this file except in compliance with the License.
|
|
43
|
-
* You may obtain a copy of the License at
|
|
44
|
-
*
|
|
45
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
46
|
-
*
|
|
47
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
48
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
49
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
50
|
-
* See the License for the specific language governing permissions and
|
|
51
|
-
* limitations under the License.
|
|
52
|
-
*/
|
|
53
|
-
class OpenZaakConfig {
|
|
54
|
-
}
|
|
55
|
-
var Archiefnominatie;
|
|
56
|
-
(function (Archiefnominatie) {
|
|
57
|
-
Archiefnominatie["blijvend_bewaren"] = "blijven_bewaren";
|
|
58
|
-
Archiefnominatie["vernietigen"] = "vernietigen";
|
|
59
|
-
})(Archiefnominatie || (Archiefnominatie = {}));
|
|
60
|
-
var Afleidingswijze;
|
|
61
|
-
(function (Afleidingswijze) {
|
|
62
|
-
Afleidingswijze["afgehandeld"] = "afgehandeld";
|
|
63
|
-
Afleidingswijze["ander_datumkenmerk"] = "ander_datumkenmerk";
|
|
64
|
-
Afleidingswijze["eigenschap"] = "eigenschap";
|
|
65
|
-
Afleidingswijze["gerelateerde_zaak"] = "gerelateerde_zaak";
|
|
66
|
-
Afleidingswijze["hoofdzaak"] = "hoofdzaak";
|
|
67
|
-
Afleidingswijze["ingangsdatum_besluit"] = "ingangsdatum_besluit";
|
|
68
|
-
Afleidingswijze["termijn"] = "termijn";
|
|
69
|
-
Afleidingswijze["vervaldatum_besluit"] = "vervaldatum_besluit";
|
|
70
|
-
Afleidingswijze["zaakobject"] = "zaakobject";
|
|
71
|
-
})(Afleidingswijze || (Afleidingswijze = {}));
|
|
72
|
-
var Objecttype;
|
|
73
|
-
(function (Objecttype) {
|
|
74
|
-
Objecttype["adres"] = "adres";
|
|
75
|
-
Objecttype["besluit"] = "besluit";
|
|
76
|
-
Objecttype["buurt"] = "buurt";
|
|
77
|
-
Objecttype["enkelvoudig_document"] = "enkelvoudig_document";
|
|
78
|
-
Objecttype["gemeente"] = "gemeente";
|
|
79
|
-
Objecttype["gemeentelijke_openbare_ruimte"] = "gemeentelijke_openbare_ruimte";
|
|
80
|
-
Objecttype["huishouden"] = "huishouden";
|
|
81
|
-
Objecttype["inrichtingselement"] = "inrichtingselement";
|
|
82
|
-
Objecttype["kadastrale_onroerende_zaak"] = "kadastrale_onroerende_zaak";
|
|
83
|
-
Objecttype["kunstwerkdeel"] = "kunstwerkdeel";
|
|
84
|
-
Objecttype["maatschappelijke_activiteit"] = "maatschappelijke_activiteit";
|
|
85
|
-
Objecttype["medewerker"] = "medewerker";
|
|
86
|
-
Objecttype["natuurlijk_persoon"] = "natuurlijk_persoon";
|
|
87
|
-
Objecttype["niet_natuurlijk_persoon"] = "niet_natuurlijk_persoon";
|
|
88
|
-
Objecttype["openbare_ruimte"] = "openbare_ruimte";
|
|
89
|
-
Objecttype["organisatorische_eenheid"] = "organisatorische_eenheid";
|
|
90
|
-
Objecttype["pand"] = "pand";
|
|
91
|
-
Objecttype["spoorbaandeel"] = "spoorbaandeel";
|
|
92
|
-
Objecttype["status"] = "status";
|
|
93
|
-
Objecttype["terreindeel"] = "terreindeel";
|
|
94
|
-
Objecttype["terrein_gebouwd_object"] = "terrein_gebouwd_object";
|
|
95
|
-
Objecttype["vestiging"] = "vestiging";
|
|
96
|
-
Objecttype["waterdeel"] = "waterdeel";
|
|
97
|
-
Objecttype["wegdeel"] = "wegdeel";
|
|
98
|
-
Objecttype["wijk"] = "wijk";
|
|
99
|
-
Objecttype["woonplaats"] = "woonplaats";
|
|
100
|
-
Objecttype["woz_deelobject"] = "woz_deelobject";
|
|
101
|
-
Objecttype["woz_object"] = "woz_object";
|
|
102
|
-
Objecttype["woz_waarde"] = "woz_waarde";
|
|
103
|
-
Objecttype["zakelijk_recht"] = "zakelijk_recht";
|
|
104
|
-
Objecttype["overige"] = "overige";
|
|
105
|
-
})(Objecttype || (Objecttype = {}));
|
|
106
|
-
var Operation;
|
|
107
|
-
(function (Operation) {
|
|
108
|
-
Operation["CREATE_ZAAK"] = "CREATE_ZAAK";
|
|
109
|
-
Operation["SET_RESULTAAT"] = "SET_RESULTAAT";
|
|
110
|
-
Operation["SET_STATUS"] = "SET_STATUS";
|
|
111
|
-
Operation["CREATE_BESLUIT"] = "CREATE_BESLUIT";
|
|
112
|
-
})(Operation || (Operation = {}));
|
|
113
|
-
|
|
114
|
-
/*
|
|
115
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
116
|
-
*
|
|
117
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
118
|
-
* you may not use this file except in compliance with the License.
|
|
119
|
-
* You may obtain a copy of the License at
|
|
120
|
-
*
|
|
121
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
122
|
-
*
|
|
123
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
124
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
125
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
126
|
-
* See the License for the specific language governing permissions and
|
|
127
|
-
* limitations under the License.
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
/*
|
|
131
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
132
|
-
*
|
|
133
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
134
|
-
* you may not use this file except in compliance with the License.
|
|
135
|
-
* You may obtain a copy of the License at
|
|
136
|
-
*
|
|
137
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
138
|
-
*
|
|
139
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
140
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
141
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
142
|
-
* See the License for the specific language governing permissions and
|
|
143
|
-
* limitations under the License.
|
|
144
|
-
*/
|
|
145
|
-
class OpenZaakService {
|
|
146
|
-
constructor(http, configService) {
|
|
147
|
-
this.http = http;
|
|
148
|
-
this.configService = configService;
|
|
149
|
-
this.valtimoApiConfig = configService.config.valtimoApi;
|
|
150
|
-
this.catalogus = configService.config.openZaak.catalogus;
|
|
151
|
-
}
|
|
152
|
-
getOpenZaakConfig() {
|
|
153
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/openzaak/config`);
|
|
154
|
-
}
|
|
155
|
-
getResource(resourceId) {
|
|
156
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/resource/${resourceId}`);
|
|
157
|
-
}
|
|
158
|
-
getZaakTypes() {
|
|
159
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/openzaak/zaaktype`);
|
|
160
|
-
}
|
|
161
|
-
getBesluittypen() {
|
|
162
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/besluittype`);
|
|
163
|
-
}
|
|
164
|
-
getInformatieObjectTypes() {
|
|
165
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/openzaak/informatie-object-typen/${this.catalogus}`);
|
|
166
|
-
}
|
|
167
|
-
getZaakTypeLink(id) {
|
|
168
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/openzaak/link/${id}`);
|
|
169
|
-
}
|
|
170
|
-
getInformatieObjectTypeLink(id) {
|
|
171
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/openzaak/informatie-object-type-link/${id}`);
|
|
172
|
-
}
|
|
173
|
-
createZaakTypeLink(request) {
|
|
174
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/openzaak/link`, request);
|
|
175
|
-
}
|
|
176
|
-
createInformatieObjectTypeLink(request) {
|
|
177
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/openzaak/informatie-object-type-link`, request);
|
|
178
|
-
}
|
|
179
|
-
deleteZaakTypeLink(id) {
|
|
180
|
-
return this.http.delete(`${this.valtimoApiConfig.endpointUri}v1/openzaak/link/${id}`);
|
|
181
|
-
}
|
|
182
|
-
deleteInformatieObjectTypeLink(id) {
|
|
183
|
-
return this.http.delete(`${this.valtimoApiConfig.endpointUri}v1/openzaak/informatie-object-type-link/${id}`);
|
|
184
|
-
}
|
|
185
|
-
getZaakTypeLinkListByProcess(processDefinitionKey) {
|
|
186
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/openzaak/link/process/${processDefinitionKey}`);
|
|
187
|
-
}
|
|
188
|
-
getStatusTypes(zaakTypeRequest) {
|
|
189
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/openzaak/status`, zaakTypeRequest);
|
|
190
|
-
}
|
|
191
|
-
getStatusResults(zaakTypeRequest) {
|
|
192
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/openzaak/resultaat`, zaakTypeRequest);
|
|
193
|
-
}
|
|
194
|
-
createServiceTaskHandler(id, request) {
|
|
195
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/openzaak/link/${id}/service-handler`, request);
|
|
196
|
-
}
|
|
197
|
-
modifyServiceTaskHandler(id, request) {
|
|
198
|
-
return this.http.put(`${this.valtimoApiConfig.endpointUri}v1/openzaak/link/${id}/service-handler`, request);
|
|
199
|
-
}
|
|
200
|
-
deleteServiceTaskHandler(id, processDefinitionKey, serviceTaskId) {
|
|
201
|
-
return this.http.delete(`${this.valtimoApiConfig.endpointUri}v1/openzaak/link/${id}/service-handler/${processDefinitionKey}/${serviceTaskId}`);
|
|
202
|
-
}
|
|
203
|
-
upload(file, documentDefinitionName) {
|
|
204
|
-
const formData = new FormData();
|
|
205
|
-
formData.append('file', file);
|
|
206
|
-
formData.append('documentDefinitionName', documentDefinitionName);
|
|
207
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/resource/upload-open-zaak`, formData, {
|
|
208
|
-
reportProgress: true,
|
|
209
|
-
responseType: 'json',
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
uploadWithMetadata(file, documentId, metadata) {
|
|
213
|
-
const formData = new FormData();
|
|
214
|
-
formData.append('file', file);
|
|
215
|
-
formData.append('documentId', documentId);
|
|
216
|
-
Object.keys(metadata).forEach(metaDataKey => {
|
|
217
|
-
const metadataValue = metadata[metaDataKey];
|
|
218
|
-
if (metadataValue) {
|
|
219
|
-
formData.append(metaDataKey, metadataValue);
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/resource/temp`, formData, {
|
|
223
|
-
reportProgress: true,
|
|
224
|
-
responseType: 'json',
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
uploadTempFileWithMetadata(file, metadata) {
|
|
228
|
-
const formData = new FormData();
|
|
229
|
-
formData.append('file', file);
|
|
230
|
-
Object.keys(metadata).forEach(metaDataKey => {
|
|
231
|
-
const metadataValue = metadata[metaDataKey];
|
|
232
|
-
if (metadataValue) {
|
|
233
|
-
formData.append(metaDataKey, metadataValue);
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
return this.http.post(`${this.valtimoApiConfig.endpointUri}v1/resource/temp`, formData, {
|
|
237
|
-
reportProgress: true,
|
|
238
|
-
responseType: 'json',
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
OpenZaakService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OpenZaakService, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
243
|
-
OpenZaakService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OpenZaakService, providedIn: 'root' });
|
|
244
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OpenZaakService, decorators: [{
|
|
245
|
-
type: Injectable,
|
|
246
|
-
args: [{
|
|
247
|
-
providedIn: 'root',
|
|
248
|
-
}]
|
|
249
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
|
|
250
|
-
|
|
251
|
-
/*
|
|
252
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
253
|
-
*
|
|
254
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
255
|
-
* you may not use this file except in compliance with the License.
|
|
256
|
-
* You may obtain a copy of the License at
|
|
257
|
-
*
|
|
258
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
259
|
-
*
|
|
260
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
261
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
262
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
263
|
-
* See the License for the specific language governing permissions and
|
|
264
|
-
* limitations under the License.
|
|
265
|
-
*/
|
|
266
|
-
class OpenZaakUploadService {
|
|
267
|
-
constructor(openZaakService, http, configService) {
|
|
268
|
-
this.openZaakService = openZaakService;
|
|
269
|
-
this.http = http;
|
|
270
|
-
this.configService = configService;
|
|
271
|
-
this.valtimoApiConfig = configService.config.valtimoApi;
|
|
272
|
-
}
|
|
273
|
-
uploadFile(file, documentDefinitionName) {
|
|
274
|
-
return this.openZaakService
|
|
275
|
-
.upload(new File([file], file.name, { type: file.type }), documentDefinitionName)
|
|
276
|
-
.pipe(map(result => this.getResourceFile(result)));
|
|
277
|
-
}
|
|
278
|
-
uploadFileWithMetadata(file, documentId, metadata) {
|
|
279
|
-
return this.openZaakService.uploadWithMetadata(new File([file], file.name, { type: file.type }), documentId, metadata);
|
|
280
|
-
}
|
|
281
|
-
uploadTempFileWithMetadata(file, metadata) {
|
|
282
|
-
return this.openZaakService.uploadTempFileWithMetadata(new File([file], file.name, { type: file.type }), metadata);
|
|
283
|
-
}
|
|
284
|
-
getResource(resourceId) {
|
|
285
|
-
return this.openZaakService.getResource(resourceId);
|
|
286
|
-
}
|
|
287
|
-
checkUploadProcessLink(caseDefinitionKey) {
|
|
288
|
-
return this.http
|
|
289
|
-
.get(`${this.valtimoApiConfig.endpointUri}v1/uploadprocess/case/${caseDefinitionKey}/check-link`)
|
|
290
|
-
.pipe(map(res => res.processCaseLinkExists));
|
|
291
|
-
}
|
|
292
|
-
getResourceFile(result) {
|
|
293
|
-
return {
|
|
294
|
-
customUpload: true,
|
|
295
|
-
originalName: result.name,
|
|
296
|
-
size: result.sizeInBytes,
|
|
297
|
-
url: '/api/resource/' + result.resourceId + '/download',
|
|
298
|
-
storage: 'openZaak',
|
|
299
|
-
type: result.extension,
|
|
300
|
-
data: {
|
|
301
|
-
createdOn: result.createdOn,
|
|
302
|
-
name: result.name,
|
|
303
|
-
sizeInBytes: result.sizeInBytes,
|
|
304
|
-
resourceId: result.resourceId,
|
|
305
|
-
extension: result.extension,
|
|
306
|
-
},
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
OpenZaakUploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OpenZaakUploadService, deps: [{ token: OpenZaakService }, { token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
311
|
-
OpenZaakUploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OpenZaakUploadService });
|
|
312
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: OpenZaakUploadService, decorators: [{
|
|
313
|
-
type: Injectable
|
|
314
|
-
}], ctorParameters: function () { return [{ type: OpenZaakService }, { type: i1.HttpClient }, { type: i2.ConfigService }]; } });
|
|
315
|
-
|
|
316
|
-
/*
|
|
317
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
318
|
-
*
|
|
319
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
320
|
-
* you may not use this file except in compliance with the License.
|
|
321
|
-
* You may obtain a copy of the License at
|
|
322
|
-
*
|
|
323
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
324
|
-
*
|
|
325
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
326
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
327
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
328
|
-
* See the License for the specific language governing permissions and
|
|
329
|
-
* limitations under the License.
|
|
330
|
-
*/
|
|
331
|
-
class S3Service {
|
|
332
|
-
constructor(http, configService) {
|
|
333
|
-
this.http = http;
|
|
334
|
-
this.configService = configService;
|
|
335
|
-
this.valtimoApiConfig = configService.config.valtimoApi;
|
|
336
|
-
}
|
|
337
|
-
getPreSignedUrl(fileName) {
|
|
338
|
-
const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');
|
|
339
|
-
const options = { headers, responseType: 'text' };
|
|
340
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/resource/pre-signed-url/${fileName}`, options);
|
|
341
|
-
}
|
|
342
|
-
upload(url, file) {
|
|
343
|
-
const headers = new HttpHeaders().set('Content-Type', file.type);
|
|
344
|
-
return this.http.put(url.toString(), file, { headers });
|
|
345
|
-
}
|
|
346
|
-
registerResource(s3ResourceDTO) {
|
|
347
|
-
return this.http.put(`${this.valtimoApiConfig.endpointUri}v1/resource`, s3ResourceDTO);
|
|
348
|
-
}
|
|
349
|
-
get(resourceId) {
|
|
350
|
-
const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
|
|
351
|
-
return this.http.get(`${this.valtimoApiConfig.endpointUri}v1/resource/${resourceId}`, { headers });
|
|
352
|
-
}
|
|
353
|
-
delete(resourceId) {
|
|
354
|
-
const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
|
|
355
|
-
return this.http.delete(`${this.valtimoApiConfig.endpointUri}v1/resource/${resourceId}`, {
|
|
356
|
-
headers,
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
S3Service.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: S3Service, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
361
|
-
S3Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: S3Service, providedIn: 'root' });
|
|
362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: S3Service, decorators: [{
|
|
363
|
-
type: Injectable,
|
|
364
|
-
args: [{
|
|
365
|
-
providedIn: 'root',
|
|
366
|
-
}]
|
|
367
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
|
|
368
|
-
|
|
369
|
-
class S3UploadService {
|
|
370
|
-
constructor(s3Service) {
|
|
371
|
-
this.s3Service = s3Service;
|
|
372
|
-
}
|
|
373
|
-
uploadFile(file) {
|
|
374
|
-
let resourceUrl;
|
|
375
|
-
const fileName = file.name;
|
|
376
|
-
const splitFileName = fileName.split('.');
|
|
377
|
-
const fileNameWithUUID = `${splitFileName[0]}-${v4()}.${splitFileName[1]}`;
|
|
378
|
-
const renamedFile = new File([file], fileNameWithUUID, { type: file.type });
|
|
379
|
-
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)));
|
|
380
|
-
}
|
|
381
|
-
getResource(resourceId) {
|
|
382
|
-
return this.s3Service.get(resourceId);
|
|
383
|
-
}
|
|
384
|
-
getResourceFile(result) {
|
|
385
|
-
return {
|
|
386
|
-
customUpload: true,
|
|
387
|
-
originalName: result.originalName,
|
|
388
|
-
url: result.url,
|
|
389
|
-
size: result.resource.sizeInBytes,
|
|
390
|
-
storage: 'url',
|
|
391
|
-
type: result.resource.extension,
|
|
392
|
-
data: {
|
|
393
|
-
key: result.resource.key,
|
|
394
|
-
bucketName: result.resource.name,
|
|
395
|
-
createdOn: result.resource.createdOn,
|
|
396
|
-
name: result.originalName,
|
|
397
|
-
sizeInBytes: result.resource.sizeInBytes,
|
|
398
|
-
resourceId: result.resource.id.split('ResourceId(id=')[1].slice(0, -1),
|
|
399
|
-
},
|
|
400
|
-
};
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
S3UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: S3UploadService, deps: [{ token: S3Service }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
404
|
-
S3UploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: S3UploadService });
|
|
405
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: S3UploadService, decorators: [{
|
|
406
|
-
type: Injectable
|
|
407
|
-
}], ctorParameters: function () { return [{ type: S3Service }]; } });
|
|
408
|
-
|
|
409
|
-
/*
|
|
410
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
411
|
-
*
|
|
412
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
413
|
-
* you may not use this file except in compliance with the License.
|
|
414
|
-
* You may obtain a copy of the License at
|
|
415
|
-
*
|
|
416
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
417
|
-
*
|
|
418
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
419
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
420
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
421
|
-
* See the License for the specific language governing permissions and
|
|
422
|
-
* limitations under the License.
|
|
423
|
-
*/
|
|
424
|
-
class UploadProviderService {
|
|
425
|
-
constructor(configService, injector, logger) {
|
|
426
|
-
this.configService = configService;
|
|
427
|
-
this.injector = injector;
|
|
428
|
-
this.logger = logger;
|
|
429
|
-
let uploadService;
|
|
430
|
-
switch (configService.config.uploadProvider) {
|
|
431
|
-
case UploadProvider.S3:
|
|
432
|
-
uploadService = injector.get(S3UploadService);
|
|
433
|
-
break;
|
|
434
|
-
case UploadProvider.OPEN_ZAAK:
|
|
435
|
-
uploadService = injector.get(OpenZaakUploadService);
|
|
436
|
-
break;
|
|
437
|
-
case UploadProvider.DOCUMENTEN_API:
|
|
438
|
-
uploadService = injector.get(OpenZaakUploadService);
|
|
439
|
-
break;
|
|
440
|
-
}
|
|
441
|
-
this.uploadService = uploadService;
|
|
442
|
-
this.logger.debug('Loading UploadService as', this.uploadService);
|
|
443
|
-
}
|
|
444
|
-
uploadFile(file, documentDefinitionName) {
|
|
445
|
-
return this.uploadService.uploadFile(file, documentDefinitionName);
|
|
446
|
-
}
|
|
447
|
-
getResource(resourceId) {
|
|
448
|
-
return this.uploadService.getResource(resourceId);
|
|
449
|
-
}
|
|
450
|
-
checkUploadProcessLink(caseDefinitionKey) {
|
|
451
|
-
if (this.uploadService.checkUploadProcessLink) {
|
|
452
|
-
return this.uploadService.checkUploadProcessLink(caseDefinitionKey);
|
|
453
|
-
}
|
|
454
|
-
return of(false);
|
|
455
|
-
}
|
|
456
|
-
uploadFileWithMetadata(file, documentId, metadata) {
|
|
457
|
-
if (this.uploadService.uploadFileWithMetadata) {
|
|
458
|
-
return this.uploadService.uploadFileWithMetadata(file, documentId, metadata);
|
|
459
|
-
}
|
|
460
|
-
return of(null);
|
|
461
|
-
}
|
|
462
|
-
uploadTempFileWithMetadata(file, metadata) {
|
|
463
|
-
if (this.uploadService.uploadTempFileWithMetadata) {
|
|
464
|
-
return this.uploadService.uploadTempFileWithMetadata(file, metadata);
|
|
465
|
-
}
|
|
466
|
-
return of(null);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
UploadProviderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UploadProviderService, deps: [{ token: i2.ConfigService }, { token: i0.Injector }, { token: i2$1.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
470
|
-
UploadProviderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UploadProviderService, providedIn: 'root' });
|
|
471
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UploadProviderService, decorators: [{
|
|
472
|
-
type: Injectable,
|
|
473
|
-
args: [{
|
|
474
|
-
providedIn: 'root',
|
|
475
|
-
}]
|
|
476
|
-
}], ctorParameters: function () { return [{ type: i2.ConfigService }, { type: i0.Injector }, { type: i2$1.NGXLogger }]; } });
|
|
477
|
-
|
|
478
|
-
/*
|
|
479
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
480
|
-
*
|
|
481
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
482
|
-
* you may not use this file except in compliance with the License.
|
|
483
|
-
* You may obtain a copy of the License at
|
|
484
|
-
*
|
|
485
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
486
|
-
*
|
|
487
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
488
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
489
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
490
|
-
* See the License for the specific language governing permissions and
|
|
491
|
-
* limitations under the License.
|
|
492
|
-
*/
|
|
493
|
-
class DownloadService {
|
|
494
|
-
constructor(http, configService) {
|
|
495
|
-
this.http = http;
|
|
496
|
-
this.configService = configService;
|
|
497
|
-
}
|
|
498
|
-
downloadFile(url, name) {
|
|
499
|
-
const finishedSubject$ = new Subject();
|
|
500
|
-
if (url.startsWith(this.configService.config.valtimoApi.endpointUri) ||
|
|
501
|
-
url.startsWith(window.location.origin) ||
|
|
502
|
-
url.startsWith('/api/')) {
|
|
503
|
-
// if download url is on backend use angular to get the content so access token is used
|
|
504
|
-
this.http.get(url, { responseType: 'blob' }).subscribe(content => {
|
|
505
|
-
const downloadUrl = window.URL.createObjectURL(content);
|
|
506
|
-
if (this.isFileTypeSupportedForNewWindow(name)) {
|
|
507
|
-
this.openBlobInNewTab(downloadUrl, name);
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
this.openDownloadLink(downloadUrl, name);
|
|
511
|
-
}
|
|
512
|
-
finishedSubject$.next(null);
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
else {
|
|
516
|
-
// download links to external services (like amazon s3) open in a new window
|
|
517
|
-
this.openDownloadLink(url, name);
|
|
518
|
-
finishedSubject$.next(null);
|
|
519
|
-
}
|
|
520
|
-
return finishedSubject$;
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* A window.open won't work for blobs because ad blocker extensions will immediately
|
|
524
|
-
* close the tab again. The method used below will prevent this from happening.
|
|
525
|
-
*/
|
|
526
|
-
openBlobInNewTab(url, name) {
|
|
527
|
-
const newWindow = window.open('/');
|
|
528
|
-
// newWindow will be null if the browser blocks the opening of a new tab.
|
|
529
|
-
if (newWindow != null) {
|
|
530
|
-
newWindow.location = url;
|
|
531
|
-
}
|
|
532
|
-
else {
|
|
533
|
-
// In case the tab is blocked it will just download the file.
|
|
534
|
-
this.openDownloadLink(url, name);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
openDownloadLink(url, name) {
|
|
538
|
-
const link = document.createElement('a');
|
|
539
|
-
link.href = url;
|
|
540
|
-
link.download = name;
|
|
541
|
-
link.target = '_blank';
|
|
542
|
-
link.click();
|
|
543
|
-
link.remove();
|
|
544
|
-
}
|
|
545
|
-
isFileTypeSupportedForNewWindow(name) {
|
|
546
|
-
var _a, _b;
|
|
547
|
-
const supportedFileTypes = ((_b = (_a = this.configService) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.supportedDocumentFileTypesToViewInBrowser) || ['pdf', 'jpg', 'png', 'svg'];
|
|
548
|
-
return supportedFileTypes.some(function (suffix) {
|
|
549
|
-
return name.toUpperCase().endsWith(suffix.toUpperCase());
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
DownloadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DownloadService, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
554
|
-
DownloadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DownloadService, providedIn: 'root' });
|
|
555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: DownloadService, decorators: [{
|
|
556
|
-
type: Injectable,
|
|
557
|
-
args: [{
|
|
558
|
-
providedIn: 'root',
|
|
559
|
-
}]
|
|
560
|
-
}], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
|
|
561
|
-
|
|
562
|
-
/*
|
|
563
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
564
|
-
*
|
|
565
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
566
|
-
* you may not use this file except in compliance with the License.
|
|
567
|
-
* You may obtain a copy of the License at
|
|
568
|
-
*
|
|
569
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
570
|
-
*
|
|
571
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
572
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
573
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
574
|
-
* See the License for the specific language governing permissions and
|
|
575
|
-
* limitations under the License.
|
|
576
|
-
*/
|
|
577
|
-
class ResourceModule {
|
|
578
|
-
}
|
|
579
|
-
ResourceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ResourceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
580
|
-
ResourceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ResourceModule });
|
|
581
|
-
ResourceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ResourceModule, providers: [
|
|
582
|
-
OpenZaakUploadService,
|
|
583
|
-
S3UploadService,
|
|
584
|
-
UploadProviderService,
|
|
585
|
-
OpenZaakService,
|
|
586
|
-
S3Service,
|
|
587
|
-
DownloadService,
|
|
588
|
-
] });
|
|
589
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ResourceModule, decorators: [{
|
|
590
|
-
type: NgModule,
|
|
591
|
-
args: [{
|
|
592
|
-
declarations: [],
|
|
593
|
-
imports: [],
|
|
594
|
-
exports: [],
|
|
595
|
-
providers: [
|
|
596
|
-
OpenZaakUploadService,
|
|
597
|
-
S3UploadService,
|
|
598
|
-
UploadProviderService,
|
|
599
|
-
OpenZaakService,
|
|
600
|
-
S3Service,
|
|
601
|
-
DownloadService,
|
|
602
|
-
],
|
|
603
|
-
}]
|
|
604
|
-
}] });
|
|
605
|
-
|
|
606
|
-
/*
|
|
607
|
-
* Copyright 2015-2023 Ritense BV, the Netherlands.
|
|
608
|
-
*
|
|
609
|
-
* Licensed under EUPL, Version 1.2 (the "License");
|
|
610
|
-
* you may not use this file except in compliance with the License.
|
|
611
|
-
* You may obtain a copy of the License at
|
|
612
|
-
*
|
|
613
|
-
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
|
|
614
|
-
*
|
|
615
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
616
|
-
* distributed under the License is distributed on an "AS IS" basis,
|
|
617
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
618
|
-
* See the License for the specific language governing permissions and
|
|
619
|
-
* limitations under the License.
|
|
620
|
-
*/
|
|
621
|
-
|
|
622
|
-
/**
|
|
623
|
-
* Generated bundle index. Do not edit.
|
|
624
|
-
*/
|
|
625
|
-
|
|
626
|
-
export { Afleidingswijze, Archiefnominatie, DownloadService, Objecttype, OpenZaakConfig, OpenZaakService, Operation, ResourceModule, S3Resource, S3Service, UploadProviderService };
|
|
627
|
-
//# sourceMappingURL=valtimo-resource.mjs.map
|