@valtimo/resource 4.21.0 → 5.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.
Files changed (63) hide show
  1. package/esm2020/lib/models/index.mjs +21 -0
  2. package/esm2020/lib/models/open-zaak.model.mjs +76 -0
  3. package/esm2020/lib/models/upload.model.mjs +17 -0
  4. package/esm2020/lib/models/uploader.model.mjs +26 -0
  5. package/esm2020/lib/resource.module.mjs +52 -0
  6. package/esm2020/lib/services/download.service.mjs +56 -0
  7. package/esm2020/lib/services/open-zaak-upload.service.mjs +60 -0
  8. package/esm2020/lib/services/open-zaak.service.mjs +96 -0
  9. package/esm2020/lib/services/s3-upload.service.mjs +46 -0
  10. package/esm2020/lib/services/s3.service.mjs +58 -0
  11. package/esm2020/lib/services/upload-provider.service.mjs +49 -0
  12. package/esm2020/public-api.mjs +10 -0
  13. package/esm2020/valtimo-resource.mjs +5 -0
  14. package/fesm2015/valtimo-resource.mjs +517 -0
  15. package/fesm2015/valtimo-resource.mjs.map +1 -0
  16. package/{fesm2015/valtimo-resource.js → fesm2020/valtimo-resource.mjs} +81 -95
  17. package/fesm2020/valtimo-resource.mjs.map +1 -0
  18. package/lib/models/index.d.ts +1 -0
  19. package/lib/models/index.d.ts.map +1 -0
  20. package/lib/models/open-zaak.model.d.ts +1 -0
  21. package/lib/models/open-zaak.model.d.ts.map +1 -0
  22. package/lib/models/upload.model.d.ts +1 -0
  23. package/lib/models/upload.model.d.ts.map +1 -0
  24. package/lib/models/uploader.model.d.ts +1 -0
  25. package/lib/models/uploader.model.d.ts.map +1 -0
  26. package/lib/resource.module.d.ts +5 -0
  27. package/lib/resource.module.d.ts.map +1 -0
  28. package/lib/services/download.service.d.ts +4 -0
  29. package/lib/services/download.service.d.ts.map +1 -0
  30. package/lib/services/open-zaak-upload.service.d.ts +4 -0
  31. package/lib/services/open-zaak-upload.service.d.ts.map +1 -0
  32. package/lib/services/open-zaak.service.d.ts +4 -0
  33. package/lib/services/open-zaak.service.d.ts.map +1 -0
  34. package/lib/services/s3-upload.service.d.ts +4 -0
  35. package/lib/services/s3-upload.service.d.ts.map +1 -0
  36. package/lib/services/s3.service.d.ts +4 -0
  37. package/lib/services/s3.service.d.ts.map +1 -0
  38. package/lib/services/upload-provider.service.d.ts +4 -0
  39. package/lib/services/upload-provider.service.d.ts.map +1 -0
  40. package/package.json +22 -10
  41. package/public-api.d.ts +1 -0
  42. package/public-api.d.ts.map +1 -0
  43. package/valtimo-resource.d.ts +2 -2
  44. package/valtimo-resource.d.ts.map +1 -0
  45. package/bundles/valtimo-resource.umd.js +0 -570
  46. package/bundles/valtimo-resource.umd.js.map +0 -1
  47. package/bundles/valtimo-resource.umd.min.js +0 -2
  48. package/bundles/valtimo-resource.umd.min.js.map +0 -1
  49. package/esm2015/lib/models/index.js +0 -21
  50. package/esm2015/lib/models/open-zaak.model.js +0 -76
  51. package/esm2015/lib/models/upload.model.js +0 -16
  52. package/esm2015/lib/models/uploader.model.js +0 -26
  53. package/esm2015/lib/resource.module.js +0 -40
  54. package/esm2015/lib/services/download.service.js +0 -60
  55. package/esm2015/lib/services/open-zaak-upload.service.js +0 -62
  56. package/esm2015/lib/services/open-zaak.service.js +0 -100
  57. package/esm2015/lib/services/s3-upload.service.js +0 -61
  58. package/esm2015/lib/services/s3.service.js +0 -61
  59. package/esm2015/lib/services/upload-provider.service.js +0 -53
  60. package/esm2015/public-api.js +0 -10
  61. package/esm2015/valtimo-resource.js +0 -7
  62. package/fesm2015/valtimo-resource.js.map +0 -1
  63. package/valtimo-resource.metadata.json +0 -1
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
3
+ *
4
+ * Licensed under EUPL, Version 1.2 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" basis,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Injectable } from '@angular/core';
17
+ import { UploadProvider } from '@valtimo/config';
18
+ import { OpenZaakUploadService } from './open-zaak-upload.service';
19
+ import { S3UploadService } from './s3-upload.service';
20
+ import * as i0 from "@angular/core";
21
+ import * as i1 from "@valtimo/config";
22
+ import * as i2 from "ngx-logger";
23
+ export class UploadProviderService {
24
+ constructor(configService, injector, logger) {
25
+ this.configService = configService;
26
+ this.injector = injector;
27
+ this.logger = logger;
28
+ this.uploadService =
29
+ configService.config.uploadProvider === UploadProvider.S3
30
+ ? injector.get(S3UploadService)
31
+ : injector.get(OpenZaakUploadService);
32
+ this.logger.debug('Loading UploadService as', this.uploadService);
33
+ }
34
+ uploadFile(file, documentDefinitionName) {
35
+ return this.uploadService.uploadFile(file, documentDefinitionName);
36
+ }
37
+ getResource(resourceId) {
38
+ return this.uploadService.getResource(resourceId);
39
+ }
40
+ }
41
+ UploadProviderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: UploadProviderService, deps: [{ token: i1.ConfigService }, { token: i0.Injector }, { token: i2.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable });
42
+ UploadProviderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: UploadProviderService, providedIn: 'root' });
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: UploadProviderService, decorators: [{
44
+ type: Injectable,
45
+ args: [{
46
+ providedIn: 'root',
47
+ }]
48
+ }], ctorParameters: function () { return [{ type: i1.ConfigService }, { type: i0.Injector }, { type: i2.NGXLogger }]; } });
49
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXBsb2Fk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ApIHtcbiAgICB0aGlzLnVwbG9hZFNlcnZpY2UgPVxuICAgICAgY29uZmlnU2VydmljZS5jb25maWcudXBsb2FkUHJvdmlkZXIgPT09IFVwbG9hZFByb3ZpZGVyLlMzXG4gICAgICAgID8gaW5qZWN0b3IuZ2V0PFVwbG9hZFNlcnZpY2U+KFMzVXBsb2FkU2VydmljZSlcbiAgICAgICAgOiBpbmplY3Rvci5nZXQ8VXBsb2FkU2VydmljZT4oT3BlblphYWtVcGxvYWRTZXJ2aWNlKTtcbiAgICB0aGlzLmxvZ2dlci5kZWJ1ZygnTG9hZGluZyBVcGxvYWRTZXJ2aWNlIGFzJywgdGhpcy51cGxvYWRTZXJ2aWNlKTtcbiAgfVxuXG4gIHVwbG9hZEZpbGUoZmlsZTogRmlsZSwgZG9jdW1lbnREZWZpbml0aW9uTmFtZT86IHN0cmluZyk6IE9ic2VydmFibGU8UmVzb3VyY2VGaWxlPiB7XG4gICAgcmV0dXJuIHRoaXMudXBsb2FkU2VydmljZS51cGxvYWRGaWxlKGZpbGUsIGRvY3VtZW50RGVmaW5pdGlvbk5hbWUpO1xuICB9XG5cbiAgZ2V0UmVzb3VyY2UocmVzb3VyY2VJZDogc3RyaW5nKTogT2JzZXJ2YWJsZTxSZXNvdXJjZUR0bz4ge1xuICAgIHJldHVybiB0aGlzLnVwbG9hZFNlcnZpY2UuZ2V0UmVzb3VyY2UocmVzb3VyY2VJZCk7XG4gIH1cbn1cbiJdfQ==
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Public API Surface of upload
3
+ */
4
+ export * from './lib/models';
5
+ export * from './lib/resource.module';
6
+ export * from './lib/services/open-zaak.service';
7
+ export * from './lib/services/upload-provider.service';
8
+ export * from './lib/services/s3.service';
9
+ export * from './lib/services/download.service';
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3ZhbHRpbW8vcmVzb3VyY2Uvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQztBQUM3QixjQUFjLHVCQUF1QixDQUFDO0FBQ3RDLGNBQWMsa0NBQWtDLENBQUM7QUFDakQsY0FBYyx3Q0FBd0MsQ0FBQztBQUN2RCxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsaUNBQWlDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIHVwbG9hZFxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL21vZGVscyc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9yZXNvdXJjZS5tb2R1bGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvc2VydmljZXMvb3Blbi16YWFrLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvc2VydmljZXMvdXBsb2FkLXByb3ZpZGVyLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvc2VydmljZXMvczMuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9zZXJ2aWNlcy9kb3dubG9hZC5zZXJ2aWNlJztcbiJdfQ==
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsdGltby1yZXNvdXJjZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL3ZhbHRpbW8vcmVzb3VyY2Uvc3JjL3ZhbHRpbW8tcmVzb3VyY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGNBQWMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogR2VuZXJhdGVkIGJ1bmRsZSBpbmRleC4gRG8gbm90IGVkaXQuXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9wdWJsaWMtYXBpJztcbiJdfQ==
@@ -0,0 +1,517 @@
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 * as i2$1 from 'ngx-logger';
10
+
11
+ /*
12
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
13
+ *
14
+ * Licensed under EUPL, Version 1.2 (the "License");
15
+ * you may not use this file except in compliance with the License.
16
+ * You may obtain a copy of the License at
17
+ *
18
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software
21
+ * distributed under the License is distributed on an "AS IS" basis,
22
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
+ * See the License for the specific language governing permissions and
24
+ * limitations under the License.
25
+ */
26
+ class S3Resource {
27
+ constructor(file, preSignedUrl) {
28
+ this.id = null;
29
+ this.extension = null;
30
+ this.createdOn = null;
31
+ this.key = decodeURIComponent(preSignedUrl.pathname.substring(1));
32
+ this.name = file.name;
33
+ this.sizeInBytes = file.size;
34
+ }
35
+ }
36
+
37
+ /*
38
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
39
+ *
40
+ * Licensed under EUPL, Version 1.2 (the "License");
41
+ * you may not use this file except in compliance with the License.
42
+ * You may obtain a copy of the License at
43
+ *
44
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
45
+ *
46
+ * Unless required by applicable law or agreed to in writing, software
47
+ * distributed under the License is distributed on an "AS IS" basis,
48
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
49
+ * See the License for the specific language governing permissions and
50
+ * limitations under the License.
51
+ */
52
+ class OpenZaakConfig {
53
+ }
54
+ var Archiefnominatie;
55
+ (function (Archiefnominatie) {
56
+ Archiefnominatie["blijvend_bewaren"] = "blijven_bewaren";
57
+ Archiefnominatie["vernietigen"] = "vernietigen";
58
+ })(Archiefnominatie || (Archiefnominatie = {}));
59
+ var Afleidingswijze;
60
+ (function (Afleidingswijze) {
61
+ Afleidingswijze["afgehandeld"] = "afgehandeld";
62
+ Afleidingswijze["ander_datumkenmerk"] = "ander_datumkenmerk";
63
+ Afleidingswijze["eigenschap"] = "eigenschap";
64
+ Afleidingswijze["gerelateerde_zaak"] = "gerelateerde_zaak";
65
+ Afleidingswijze["hoofdzaak"] = "hoofdzaak";
66
+ Afleidingswijze["ingangsdatum_besluit"] = "ingangsdatum_besluit";
67
+ Afleidingswijze["termijn"] = "termijn";
68
+ Afleidingswijze["vervaldatum_besluit"] = "vervaldatum_besluit";
69
+ Afleidingswijze["zaakobject"] = "zaakobject";
70
+ })(Afleidingswijze || (Afleidingswijze = {}));
71
+ var Objecttype;
72
+ (function (Objecttype) {
73
+ Objecttype["adres"] = "adres";
74
+ Objecttype["besluit"] = "besluit";
75
+ Objecttype["buurt"] = "buurt";
76
+ Objecttype["enkelvoudig_document"] = "enkelvoudig_document";
77
+ Objecttype["gemeente"] = "gemeente";
78
+ Objecttype["gemeentelijke_openbare_ruimte"] = "gemeentelijke_openbare_ruimte";
79
+ Objecttype["huishouden"] = "huishouden";
80
+ Objecttype["inrichtingselement"] = "inrichtingselement";
81
+ Objecttype["kadastrale_onroerende_zaak"] = "kadastrale_onroerende_zaak";
82
+ Objecttype["kunstwerkdeel"] = "kunstwerkdeel";
83
+ Objecttype["maatschappelijke_activiteit"] = "maatschappelijke_activiteit";
84
+ Objecttype["medewerker"] = "medewerker";
85
+ Objecttype["natuurlijk_persoon"] = "natuurlijk_persoon";
86
+ Objecttype["niet_natuurlijk_persoon"] = "niet_natuurlijk_persoon";
87
+ Objecttype["openbare_ruimte"] = "openbare_ruimte";
88
+ Objecttype["organisatorische_eenheid"] = "organisatorische_eenheid";
89
+ Objecttype["pand"] = "pand";
90
+ Objecttype["spoorbaandeel"] = "spoorbaandeel";
91
+ Objecttype["status"] = "status";
92
+ Objecttype["terreindeel"] = "terreindeel";
93
+ Objecttype["terrein_gebouwd_object"] = "terrein_gebouwd_object";
94
+ Objecttype["vestiging"] = "vestiging";
95
+ Objecttype["waterdeel"] = "waterdeel";
96
+ Objecttype["wegdeel"] = "wegdeel";
97
+ Objecttype["wijk"] = "wijk";
98
+ Objecttype["woonplaats"] = "woonplaats";
99
+ Objecttype["woz_deelobject"] = "woz_deelobject";
100
+ Objecttype["woz_object"] = "woz_object";
101
+ Objecttype["woz_waarde"] = "woz_waarde";
102
+ Objecttype["zakelijk_recht"] = "zakelijk_recht";
103
+ Objecttype["overige"] = "overige";
104
+ })(Objecttype || (Objecttype = {}));
105
+ var Operation;
106
+ (function (Operation) {
107
+ Operation["CREATE_ZAAK"] = "CREATE_ZAAK";
108
+ Operation["SET_RESULTAAT"] = "SET_RESULTAAT";
109
+ Operation["SET_STATUS"] = "SET_STATUS";
110
+ Operation["CREATE_BESLUIT"] = "CREATE_BESLUIT";
111
+ })(Operation || (Operation = {}));
112
+
113
+ /*
114
+ *
115
+ * * Copyright 2015-2020 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
+ /*
132
+ * Copyright 2020 Dimpact.
133
+ *
134
+ * Licensed under EUPL, Version 1.2 (the "License");
135
+ * you may not use this file except in compliance with the License.
136
+ * You may obtain a copy of the License at
137
+ *
138
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
139
+ *
140
+ * Unless required by applicable law or agreed to in writing, software
141
+ * distributed under the License is distributed on an "AS IS" basis,
142
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
143
+ * See the License for the specific language governing permissions and
144
+ * limitations under the License.
145
+ */
146
+ class OpenZaakService {
147
+ constructor(http, configService) {
148
+ this.http = http;
149
+ this.configService = configService;
150
+ this.valtimoApiConfig = configService.config.valtimoApi;
151
+ this.catalogus = configService.config.openZaak.catalogus;
152
+ }
153
+ getOpenZaakConfig() {
154
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/config`);
155
+ }
156
+ getResource(resourceId) {
157
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`);
158
+ }
159
+ getZaakTypes() {
160
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/zaaktype`);
161
+ }
162
+ getBesluittypen() {
163
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}besluittype`);
164
+ }
165
+ getInformatieObjectTypes() {
166
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-typen/${this.catalogus}`);
167
+ }
168
+ getZaakTypeLink(id) {
169
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}`);
170
+ }
171
+ getInformatieObjectTypeLink(id) {
172
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link/${id}`);
173
+ }
174
+ createZaakTypeLink(request) {
175
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/link`, request);
176
+ }
177
+ createInformatieObjectTypeLink(request) {
178
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link`, request);
179
+ }
180
+ deleteZaakTypeLink(id) {
181
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}`);
182
+ }
183
+ deleteInformatieObjectTypeLink(id) {
184
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/informatie-object-type-link/${id}`);
185
+ }
186
+ getZaakTypeLinkListByProcess(processDefinitionKey) {
187
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}openzaak/link/process/${processDefinitionKey}`);
188
+ }
189
+ getStatusTypes(zaakTypeRequest) {
190
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/status`, zaakTypeRequest);
191
+ }
192
+ getStatusResults(zaakTypeRequest) {
193
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/resultaat`, zaakTypeRequest);
194
+ }
195
+ createServiceTaskHandler(id, request) {
196
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler`, request);
197
+ }
198
+ modifyServiceTaskHandler(id, request) {
199
+ return this.http.put(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler`, request);
200
+ }
201
+ deleteServiceTaskHandler(id, processDefinitionKey, serviceTaskId) {
202
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}openzaak/link/${id}/service-handler/${processDefinitionKey}/${serviceTaskId}`);
203
+ }
204
+ upload(file, documentDefinitionName) {
205
+ const formData = new FormData();
206
+ formData.append('file', file);
207
+ formData.append('documentDefinitionName', documentDefinitionName);
208
+ return this.http.post(`${this.valtimoApiConfig.endpointUri}resource/upload-open-zaak`, formData, {
209
+ reportProgress: true,
210
+ responseType: 'json',
211
+ });
212
+ }
213
+ }
214
+ OpenZaakService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: OpenZaakService, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
215
+ OpenZaakService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: OpenZaakService, providedIn: 'root' });
216
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: OpenZaakService, decorators: [{
217
+ type: Injectable,
218
+ args: [{
219
+ providedIn: 'root',
220
+ }]
221
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
222
+
223
+ /*
224
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
225
+ *
226
+ * Licensed under EUPL, Version 1.2 (the "License");
227
+ * you may not use this file except in compliance with the License.
228
+ * You may obtain a copy of the License at
229
+ *
230
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
231
+ *
232
+ * Unless required by applicable law or agreed to in writing, software
233
+ * distributed under the License is distributed on an "AS IS" basis,
234
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
235
+ * See the License for the specific language governing permissions and
236
+ * limitations under the License.
237
+ */
238
+ class OpenZaakUploadService {
239
+ constructor(openZaakService, http, configService) {
240
+ this.openZaakService = openZaakService;
241
+ this.http = http;
242
+ this.configService = configService;
243
+ this.valtimoApiConfig = configService.config.valtimoApi;
244
+ }
245
+ uploadFile(file, documentDefinitionName) {
246
+ return this.openZaakService
247
+ .upload(new File([file], file.name, { type: file.type }), documentDefinitionName)
248
+ .pipe(map(result => this.getResourceFile(result)));
249
+ }
250
+ getResource(resourceId) {
251
+ return this.openZaakService.getResource(resourceId);
252
+ }
253
+ getResourceFile(result) {
254
+ return {
255
+ customUpload: true,
256
+ originalName: result.name,
257
+ size: result.sizeInBytes,
258
+ url: '/api/resource/' + result.resourceId + '/download',
259
+ storage: 'openZaak',
260
+ type: result.extension,
261
+ data: {
262
+ createdOn: result.createdOn,
263
+ name: result.name,
264
+ sizeInBytes: result.sizeInBytes,
265
+ resourceId: result.resourceId,
266
+ extension: result.extension,
267
+ },
268
+ };
269
+ }
270
+ }
271
+ OpenZaakUploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: OpenZaakUploadService, deps: [{ token: OpenZaakService }, { token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
272
+ OpenZaakUploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: OpenZaakUploadService });
273
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: OpenZaakUploadService, decorators: [{
274
+ type: Injectable
275
+ }], ctorParameters: function () { return [{ type: OpenZaakService }, { type: i1.HttpClient }, { type: i2.ConfigService }]; } });
276
+
277
+ /*
278
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
279
+ *
280
+ * Licensed under EUPL, Version 1.2 (the "License");
281
+ * you may not use this file except in compliance with the License.
282
+ * You may obtain a copy of the License at
283
+ *
284
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
285
+ *
286
+ * Unless required by applicable law or agreed to in writing, software
287
+ * distributed under the License is distributed on an "AS IS" basis,
288
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289
+ * See the License for the specific language governing permissions and
290
+ * limitations under the License.
291
+ */
292
+ class S3Service {
293
+ constructor(http, configService) {
294
+ this.http = http;
295
+ this.configService = configService;
296
+ this.valtimoApiConfig = configService.config.valtimoApi;
297
+ }
298
+ getPreSignedUrl(fileName) {
299
+ const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');
300
+ const options = { headers, responseType: 'text' };
301
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/pre-signed-url/${fileName}`, options);
302
+ }
303
+ upload(url, file) {
304
+ const headers = new HttpHeaders().set('Content-Type', file.type);
305
+ return this.http.put(url.toString(), file, { headers });
306
+ }
307
+ registerResource(s3ResourceDTO) {
308
+ return this.http.put(`${this.valtimoApiConfig.endpointUri}resource`, s3ResourceDTO);
309
+ }
310
+ get(resourceId) {
311
+ const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
312
+ return this.http.get(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`, { headers });
313
+ }
314
+ delete(resourceId) {
315
+ const headers = new HttpHeaders().set('Content-Type', 'application/json;charset=UTF-8');
316
+ return this.http.delete(`${this.valtimoApiConfig.endpointUri}resource/${resourceId}`, {
317
+ headers,
318
+ });
319
+ }
320
+ }
321
+ S3Service.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: S3Service, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
322
+ S3Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: S3Service, providedIn: 'root' });
323
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: S3Service, decorators: [{
324
+ type: Injectable,
325
+ args: [{
326
+ providedIn: 'root',
327
+ }]
328
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
329
+
330
+ class S3UploadService {
331
+ constructor(s3Service) {
332
+ this.s3Service = s3Service;
333
+ }
334
+ uploadFile(file) {
335
+ let resourceUrl;
336
+ const fileName = file.name;
337
+ const splitFileName = fileName.split('.');
338
+ const fileNameWithUUID = `${splitFileName[0]}-${v4()}.${splitFileName[1]}`;
339
+ const renamedFile = new File([file], fileNameWithUUID, { type: file.type });
340
+ 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)));
341
+ }
342
+ getResource(resourceId) {
343
+ return this.s3Service.get(resourceId);
344
+ }
345
+ getResourceFile(result) {
346
+ return {
347
+ customUpload: true,
348
+ originalName: result.originalName,
349
+ url: result.url,
350
+ size: result.resource.sizeInBytes,
351
+ storage: 'url',
352
+ type: result.resource.extension,
353
+ data: {
354
+ key: result.resource.key,
355
+ bucketName: result.resource.name,
356
+ createdOn: result.resource.createdOn,
357
+ name: result.originalName,
358
+ sizeInBytes: result.resource.sizeInBytes,
359
+ resourceId: result.resource.id.split('ResourceId(id=')[1].slice(0, -1),
360
+ },
361
+ };
362
+ }
363
+ }
364
+ S3UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: S3UploadService, deps: [{ token: S3Service }], target: i0.ɵɵFactoryTarget.Injectable });
365
+ S3UploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: S3UploadService });
366
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: S3UploadService, decorators: [{
367
+ type: Injectable
368
+ }], ctorParameters: function () { return [{ type: S3Service }]; } });
369
+
370
+ /*
371
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
372
+ *
373
+ * Licensed under EUPL, Version 1.2 (the "License");
374
+ * you may not use this file except in compliance with the License.
375
+ * You may obtain a copy of the License at
376
+ *
377
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
378
+ *
379
+ * Unless required by applicable law or agreed to in writing, software
380
+ * distributed under the License is distributed on an "AS IS" basis,
381
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
382
+ * See the License for the specific language governing permissions and
383
+ * limitations under the License.
384
+ */
385
+ class UploadProviderService {
386
+ constructor(configService, injector, logger) {
387
+ this.configService = configService;
388
+ this.injector = injector;
389
+ this.logger = logger;
390
+ this.uploadService =
391
+ configService.config.uploadProvider === UploadProvider.S3
392
+ ? injector.get(S3UploadService)
393
+ : injector.get(OpenZaakUploadService);
394
+ this.logger.debug('Loading UploadService as', this.uploadService);
395
+ }
396
+ uploadFile(file, documentDefinitionName) {
397
+ return this.uploadService.uploadFile(file, documentDefinitionName);
398
+ }
399
+ getResource(resourceId) {
400
+ return this.uploadService.getResource(resourceId);
401
+ }
402
+ }
403
+ UploadProviderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: UploadProviderService, deps: [{ token: i2.ConfigService }, { token: i0.Injector }, { token: i2$1.NGXLogger }], target: i0.ɵɵFactoryTarget.Injectable });
404
+ UploadProviderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: UploadProviderService, providedIn: 'root' });
405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: UploadProviderService, decorators: [{
406
+ type: Injectable,
407
+ args: [{
408
+ providedIn: 'root',
409
+ }]
410
+ }], ctorParameters: function () { return [{ type: i2.ConfigService }, { type: i0.Injector }, { type: i2$1.NGXLogger }]; } });
411
+
412
+ /*
413
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
414
+ *
415
+ * Licensed under EUPL, Version 1.2 (the "License");
416
+ * you may not use this file except in compliance with the License.
417
+ * You may obtain a copy of the License at
418
+ *
419
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
420
+ *
421
+ * Unless required by applicable law or agreed to in writing, software
422
+ * distributed under the License is distributed on an "AS IS" basis,
423
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
424
+ * See the License for the specific language governing permissions and
425
+ * limitations under the License.
426
+ */
427
+ class DownloadService {
428
+ constructor(http, configService) {
429
+ this.http = http;
430
+ this.configService = configService;
431
+ }
432
+ downloadFile(url, name) {
433
+ if (url.startsWith(this.configService.config.valtimoApi.endpointUri) ||
434
+ url.startsWith(window.location.origin)) {
435
+ // if download url is on backend use angular to get the content so access token is used
436
+ this.http.get(url, { responseType: 'blob' }).subscribe(content => {
437
+ const downloadUrl = window.URL.createObjectURL(content);
438
+ this.openDownloadLink(downloadUrl, name);
439
+ });
440
+ }
441
+ else {
442
+ // download links to external services (like amazon s3) open in a new window
443
+ this.openDownloadLink(url, name);
444
+ }
445
+ }
446
+ openDownloadLink(url, name) {
447
+ const link = document.createElement('a');
448
+ link.href = url;
449
+ link.download = name;
450
+ link.target = '_blank';
451
+ link.click();
452
+ link.remove();
453
+ }
454
+ }
455
+ DownloadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: DownloadService, deps: [{ token: i1.HttpClient }, { token: i2.ConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
456
+ DownloadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: DownloadService, providedIn: 'root' });
457
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: DownloadService, decorators: [{
458
+ type: Injectable,
459
+ args: [{
460
+ providedIn: 'root',
461
+ }]
462
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.ConfigService }]; } });
463
+
464
+ /*
465
+ * Copyright 2015-2020 Ritense BV, the Netherlands.
466
+ *
467
+ * Licensed under EUPL, Version 1.2 (the "License");
468
+ * you may not use this file except in compliance with the License.
469
+ * You may obtain a copy of the License at
470
+ *
471
+ * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
472
+ *
473
+ * Unless required by applicable law or agreed to in writing, software
474
+ * distributed under the License is distributed on an "AS IS" basis,
475
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
476
+ * See the License for the specific language governing permissions and
477
+ * limitations under the License.
478
+ */
479
+ class ResourceModule {
480
+ }
481
+ ResourceModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: ResourceModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
482
+ ResourceModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: ResourceModule });
483
+ ResourceModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: ResourceModule, providers: [
484
+ OpenZaakUploadService,
485
+ S3UploadService,
486
+ UploadProviderService,
487
+ OpenZaakService,
488
+ S3Service,
489
+ DownloadService,
490
+ ], imports: [[]] });
491
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.9", ngImport: i0, type: ResourceModule, decorators: [{
492
+ type: NgModule,
493
+ args: [{
494
+ declarations: [],
495
+ imports: [],
496
+ exports: [],
497
+ providers: [
498
+ OpenZaakUploadService,
499
+ S3UploadService,
500
+ UploadProviderService,
501
+ OpenZaakService,
502
+ S3Service,
503
+ DownloadService,
504
+ ],
505
+ }]
506
+ }] });
507
+
508
+ /*
509
+ * Public API Surface of upload
510
+ */
511
+
512
+ /**
513
+ * Generated bundle index. Do not edit.
514
+ */
515
+
516
+ export { Afleidingswijze, Archiefnominatie, DownloadService, Objecttype, OpenZaakConfig, OpenZaakService, Operation, ResourceModule, S3Resource, S3Service, UploadProviderService };
517
+ //# sourceMappingURL=valtimo-resource.mjs.map