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