@masterteam/components 0.0.224 → 0.0.226

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.
@@ -0,0 +1,399 @@
1
+ import { HttpClient, HttpEventType, HttpHeaders, HttpErrorResponse } from '@angular/common/http';
2
+ import * as i0 from '@angular/core';
3
+ import { inject, Injectable } from '@angular/core';
4
+ import { map, catchError, throwError, shareReplay, defer, switchMap, filter, Observable, retry, timer } from 'rxjs';
5
+
6
+ class UploaderPolicyError extends Error {
7
+ code;
8
+ maxFileSizeBytes;
9
+ constructor(code, message, maxFileSizeBytes) {
10
+ super(message);
11
+ this.code = code;
12
+ this.maxFileSizeBytes = maxFileSizeBytes;
13
+ this.name = 'UploaderPolicyError';
14
+ }
15
+ }
16
+ const TRANSIENT_RETRY_COUNT = 3;
17
+ const SESSION_RECOVERY_COUNT = 2;
18
+ const SESSION_RESTART_COUNT = 1;
19
+ const CAPABILITIES_CACHE_TTL_MS = 10_000;
20
+ class UploaderService {
21
+ http = inject(HttpClient);
22
+ defaultCapabilitiesCache = new Map();
23
+ contextualCapabilitiesCaches = new WeakMap();
24
+ getCapabilities(endpoint = 'uploader', context) {
25
+ const baseEndpoint = normalizeUploaderEndpoint(endpoint);
26
+ const cache = this.resolveCapabilitiesCache(context);
27
+ const cached = cache.get(baseEndpoint);
28
+ if (cached && cached.expiresAt > Date.now()) {
29
+ return cached.value$;
30
+ }
31
+ let entry;
32
+ const value$ = this.http
33
+ .get(`${baseEndpoint}/capabilities`, this.contextOptions(context))
34
+ .pipe(this.retryTransient(), map((response) => this.unwrapResponse(response)), map((payload) => this.parseCapabilities(payload)), catchError((error) => {
35
+ if (cache.get(baseEndpoint) === entry) {
36
+ cache.delete(baseEndpoint);
37
+ }
38
+ return throwError(() => error);
39
+ }), shareReplay({ bufferSize: 1, refCount: false }));
40
+ entry = {
41
+ expiresAt: Date.now() + CAPABILITIES_CACHE_TTL_MS,
42
+ value$,
43
+ };
44
+ cache.set(baseEndpoint, entry);
45
+ return value$;
46
+ }
47
+ upload(file, endpoint = 'uploader', context) {
48
+ const baseEndpoint = normalizeUploaderEndpoint(endpoint);
49
+ return defer(() => this.getCapabilities(baseEndpoint, context)).pipe(switchMap((capabilities) => {
50
+ if (!capabilities.uploadEnabled) {
51
+ return throwError(() => new UploaderPolicyError('UPLOAD_DISABLED', 'File upload is currently unavailable.'));
52
+ }
53
+ if (file.size > capabilities.maxFileSizeBytes) {
54
+ return throwError(() => new UploaderPolicyError('FILE_TOO_LARGE', 'File size exceeds the maximum allowed size.', capabilities.maxFileSizeBytes));
55
+ }
56
+ return capabilities.useChunkedUpload
57
+ ? this.uploadChunked(file, baseEndpoint, context)
58
+ : this.uploadDirect(file, baseEndpoint, context);
59
+ }));
60
+ }
61
+ cancelSession(endpoint, sessionId, context) {
62
+ const baseEndpoint = normalizeUploaderEndpoint(endpoint);
63
+ return this.http
64
+ .delete(`${baseEndpoint}/session/${encodeURIComponent(sessionId)}`, this.contextOptions(context))
65
+ .pipe(map(() => undefined));
66
+ }
67
+ uploadDirect(file, endpoint, context) {
68
+ const formData = new FormData();
69
+ formData.append('file', file);
70
+ return this.http
71
+ .post(endpoint, formData, {
72
+ ...this.contextOptions(context),
73
+ reportProgress: true,
74
+ observe: 'events',
75
+ })
76
+ .pipe(this.retryTransient(), map((event) => {
77
+ if (event.type === HttpEventType.UploadProgress) {
78
+ return {
79
+ progress: event.total
80
+ ? Math.round((event.loaded / event.total) * 100)
81
+ : 0,
82
+ completed: false,
83
+ };
84
+ }
85
+ if (event.type === HttpEventType.Response) {
86
+ return {
87
+ progress: 100,
88
+ completed: true,
89
+ file: this.normalizeUploadedFile(this.unwrapResponse(event.body), file),
90
+ };
91
+ }
92
+ return null;
93
+ }), filter((event) => event !== null));
94
+ }
95
+ uploadChunked(file, endpoint, context) {
96
+ return this.createSession(file, endpoint, context).pipe(switchMap((initialSession) => new Observable((subscriber) => {
97
+ let session = initialSession;
98
+ let activeRequest = null;
99
+ let finished = false;
100
+ let recoveryAttempts = 0;
101
+ let restartAttempts = 0;
102
+ let uploadChunk;
103
+ const finish = (progress) => {
104
+ const uploadedFile = this.normalizeUploadedFile(progress, file);
105
+ finished = true;
106
+ subscriber.next({
107
+ progress: 100,
108
+ completed: true,
109
+ file: uploadedFile,
110
+ });
111
+ subscriber.complete();
112
+ };
113
+ const restartSession = (error) => {
114
+ if (restartAttempts >= SESSION_RESTART_COUNT ||
115
+ !isMissingSessionError(error)) {
116
+ subscriber.error(error);
117
+ return;
118
+ }
119
+ restartAttempts += 1;
120
+ activeRequest = this.createSession(file, endpoint, context).subscribe({
121
+ next: (newSession) => {
122
+ session = newSession;
123
+ recoveryAttempts = 0;
124
+ uploadChunk(0);
125
+ },
126
+ error: (sessionError) => subscriber.error(sessionError),
127
+ });
128
+ };
129
+ const recoverFromServer = (uploadError) => {
130
+ if (!isTransientUploadError(uploadError)) {
131
+ subscriber.error(uploadError);
132
+ return;
133
+ }
134
+ if (recoveryAttempts >= SESSION_RECOVERY_COUNT) {
135
+ subscriber.error(uploadError);
136
+ return;
137
+ }
138
+ recoveryAttempts += 1;
139
+ activeRequest = this.getSessionStatus(endpoint, session.sessionId, context)
140
+ .pipe(this.retryTransient())
141
+ .subscribe({
142
+ next: (status) => {
143
+ try {
144
+ if (status.isComplete) {
145
+ finish(status);
146
+ return;
147
+ }
148
+ uploadChunk(this.resolveNextOffset(status, file.size, true));
149
+ }
150
+ catch (error) {
151
+ subscriber.error(error);
152
+ }
153
+ },
154
+ error: (statusError) => restartSession(statusError),
155
+ });
156
+ };
157
+ uploadChunk = (offset) => {
158
+ if (subscriber.closed)
159
+ return;
160
+ if (file.size <= 0 || offset < 0 || offset >= file.size) {
161
+ subscriber.error(new UploaderPolicyError('INVALID_SESSION', 'The upload session returned an invalid file range.'));
162
+ return;
163
+ }
164
+ const endExclusive = Math.min(offset + session.chunkSizeBytes, file.size);
165
+ const chunk = file.slice(offset, endExclusive);
166
+ const headers = new HttpHeaders({
167
+ 'Content-Range': `bytes ${offset}-${endExclusive - 1}/${file.size}`,
168
+ });
169
+ activeRequest = this.http
170
+ .put(`${endpoint}/session/${encodeURIComponent(session.sessionId)}`, chunk, {
171
+ ...this.contextOptions(context),
172
+ headers,
173
+ reportProgress: true,
174
+ observe: 'events',
175
+ })
176
+ .pipe(this.retryTransient())
177
+ .subscribe({
178
+ next: (event) => {
179
+ if (event.type === HttpEventType.UploadProgress) {
180
+ const uploaded = Math.min(offset + event.loaded, file.size);
181
+ subscriber.next({
182
+ progress: Math.round((uploaded / file.size) * 100),
183
+ completed: false,
184
+ });
185
+ return;
186
+ }
187
+ if (event.type !== HttpEventType.Response)
188
+ return;
189
+ try {
190
+ const progress = this.parseSessionProgress(this.unwrapResponse(event.body));
191
+ recoveryAttempts = 0;
192
+ if (progress.isComplete) {
193
+ finish(progress);
194
+ return;
195
+ }
196
+ uploadChunk(this.resolveNextOffset(progress, file.size, false, offset));
197
+ }
198
+ catch (error) {
199
+ subscriber.error(error);
200
+ }
201
+ },
202
+ error: recoverFromServer,
203
+ });
204
+ };
205
+ subscriber.next({ progress: 0, completed: false });
206
+ uploadChunk(0);
207
+ return () => {
208
+ activeRequest?.unsubscribe();
209
+ if (!finished && session.sessionId) {
210
+ this.cancelSession(endpoint, session.sessionId, context).subscribe({ error: () => undefined });
211
+ }
212
+ };
213
+ })));
214
+ }
215
+ createSession(file, endpoint, context) {
216
+ return this.http
217
+ .post(`${endpoint}/session`, {
218
+ fileName: file.name,
219
+ fileSize: file.size,
220
+ contentType: file.type || 'application/octet-stream',
221
+ }, this.contextOptions(context))
222
+ .pipe(this.retryTransient(), map((response) => this.parseSession(this.unwrapResponse(response))));
223
+ }
224
+ getSessionStatus(endpoint, sessionId, context) {
225
+ return this.http
226
+ .get(`${endpoint}/session/${encodeURIComponent(sessionId)}`, this.contextOptions(context))
227
+ .pipe(map((response) => this.parseSessionProgress(this.unwrapResponse(response))));
228
+ }
229
+ parseCapabilities(payload) {
230
+ const value = asRecord(payload);
231
+ const uploadEnabled = value['uploadEnabled'];
232
+ const maxFileSizeBytes = value['maxFileSizeBytes'];
233
+ const useChunkedUpload = value['useChunkedUpload'];
234
+ if (typeof uploadEnabled !== 'boolean' ||
235
+ typeof maxFileSizeBytes !== 'number' ||
236
+ !Number.isFinite(maxFileSizeBytes) ||
237
+ maxFileSizeBytes < 0 ||
238
+ (uploadEnabled && maxFileSizeBytes === 0) ||
239
+ typeof useChunkedUpload !== 'boolean') {
240
+ throw new UploaderPolicyError('INVALID_CAPABILITIES', 'File upload is currently unavailable.');
241
+ }
242
+ return { uploadEnabled, maxFileSizeBytes, useChunkedUpload };
243
+ }
244
+ parseSession(payload) {
245
+ const value = asRecord(payload);
246
+ const sessionId = readString(value, 'sessionId');
247
+ const chunkSizeBytes = readNumber(value, 'chunkSizeBytes');
248
+ if (!sessionId || !chunkSizeBytes || chunkSizeBytes <= 0) {
249
+ throw new UploaderPolicyError('INVALID_SESSION', 'The upload session could not be started.');
250
+ }
251
+ return {
252
+ sessionId,
253
+ chunkSizeBytes,
254
+ totalChunks: readNumber(value, 'totalChunks') ?? 0,
255
+ expiresAt: readString(value, 'expiresAt') ?? '',
256
+ };
257
+ }
258
+ parseSessionProgress(payload) {
259
+ const value = asRecord(payload);
260
+ const isComplete = value['isComplete'];
261
+ const bytesUploaded = readNumber(value, 'bytesUploaded');
262
+ const totalBytes = readNumber(value, 'totalBytes');
263
+ if (typeof isComplete !== 'boolean' ||
264
+ bytesUploaded == null ||
265
+ bytesUploaded < 0 ||
266
+ totalBytes == null ||
267
+ totalBytes < 0) {
268
+ throw new UploaderPolicyError('INVALID_SESSION', 'The upload session returned an invalid response.');
269
+ }
270
+ return {
271
+ isComplete,
272
+ chunkIndex: readNumber(value, 'chunkIndex') ?? undefined,
273
+ bytesUploaded,
274
+ totalBytes,
275
+ remainingChunks: readNumber(value, 'remainingChunks') ?? undefined,
276
+ nextRangeStart: readNumber(value, 'nextRangeStart'),
277
+ fileId: readString(value, 'fileId'),
278
+ fileName: readString(value, 'fileName'),
279
+ contentType: readString(value, 'contentType'),
280
+ size: readNumber(value, 'size'),
281
+ };
282
+ }
283
+ resolveNextOffset(progress, fileSize, allowSameOffset, previousOffset = -1) {
284
+ const offset = progress.nextRangeStart ?? progress.bytesUploaded;
285
+ const isAdvancing = allowSameOffset
286
+ ? offset >= previousOffset
287
+ : offset > previousOffset;
288
+ if (!Number.isFinite(offset) ||
289
+ offset < 0 ||
290
+ offset >= fileSize ||
291
+ !isAdvancing) {
292
+ throw new UploaderPolicyError('INVALID_SESSION', 'The upload session returned an invalid file range.');
293
+ }
294
+ return offset;
295
+ }
296
+ normalizeUploadedFile(payload, file) {
297
+ const value = asRecord(payload);
298
+ const fileId = firstNonEmptyString(value['fileId'], value['name'] && value['fileName'] ? value['fileName'] : undefined, value['id'], value['fileName'], value['name']);
299
+ const fileName = firstNonEmptyString(value['originalFileName'], value['name'], value['fileId'] || (value['id'] && !value['name'])
300
+ ? value['fileName']
301
+ : undefined, file.name);
302
+ if (!fileId) {
303
+ throw new UploaderPolicyError('INVALID_SESSION', 'The upload completed without a file identifier.');
304
+ }
305
+ return {
306
+ fileId,
307
+ fileName: fileName || file.name,
308
+ contentType: readString(value, 'contentType') || file.type,
309
+ size: readNumber(value, 'size') ?? file.size,
310
+ payload: value,
311
+ };
312
+ }
313
+ unwrapResponse(response) {
314
+ if (!response || typeof response !== 'object') {
315
+ return response;
316
+ }
317
+ const envelope = response;
318
+ if (envelope.code === 2) {
319
+ throw new Error('Upload request failed.');
320
+ }
321
+ return ('data' in envelope ? envelope.data : response);
322
+ }
323
+ contextOptions(context) {
324
+ return context ? { context } : {};
325
+ }
326
+ resolveCapabilitiesCache(context) {
327
+ if (!context) {
328
+ return this.defaultCapabilitiesCache;
329
+ }
330
+ let cache = this.contextualCapabilitiesCaches.get(context);
331
+ if (!cache) {
332
+ cache = new Map();
333
+ this.contextualCapabilitiesCaches.set(context, cache);
334
+ }
335
+ return cache;
336
+ }
337
+ retryTransient() {
338
+ return retry({
339
+ count: TRANSIENT_RETRY_COUNT,
340
+ delay: (error, retryCount) => isTransientUploadError(error)
341
+ ? timer(250 * 2 ** (retryCount - 1))
342
+ : throwError(() => error),
343
+ });
344
+ }
345
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UploaderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
346
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UploaderService, providedIn: 'root' });
347
+ }
348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: UploaderService, decorators: [{
349
+ type: Injectable,
350
+ args: [{ providedIn: 'root' }]
351
+ }] });
352
+ function normalizeUploaderEndpoint(endpoint) {
353
+ const normalized = (endpoint || 'uploader').trim().replace(/\/+$/, '');
354
+ return normalized || 'uploader';
355
+ }
356
+ function asRecord(value) {
357
+ return value && typeof value === 'object'
358
+ ? value
359
+ : {};
360
+ }
361
+ function readString(value, key) {
362
+ const candidate = value[key];
363
+ return typeof candidate === 'string' && candidate.trim()
364
+ ? candidate.trim()
365
+ : null;
366
+ }
367
+ function readNumber(value, key) {
368
+ const candidate = value[key];
369
+ return typeof candidate === 'number' && Number.isFinite(candidate)
370
+ ? candidate
371
+ : null;
372
+ }
373
+ function firstNonEmptyString(...values) {
374
+ for (const value of values) {
375
+ if (typeof value === 'string' && value.trim()) {
376
+ return value.trim();
377
+ }
378
+ }
379
+ return '';
380
+ }
381
+ function isTransientUploadError(error) {
382
+ if (!(error instanceof HttpErrorResponse))
383
+ return false;
384
+ return (error.status === 0 ||
385
+ error.status === 408 ||
386
+ error.status === 425 ||
387
+ error.status === 429 ||
388
+ error.status >= 500);
389
+ }
390
+ function isMissingSessionError(error) {
391
+ return error instanceof HttpErrorResponse && error.status === 404;
392
+ }
393
+
394
+ /**
395
+ * Generated bundle index. Do not edit.
396
+ */
397
+
398
+ export { UploaderPolicyError, UploaderService };
399
+ //# sourceMappingURL=masterteam-components-uploader.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"masterteam-components-uploader.mjs","sources":["../../../../packages/masterteam/components/uploader/uploader.service.ts","../../../../packages/masterteam/components/uploader/masterteam-components-uploader.ts"],"sourcesContent":["import {\r\n HttpClient,\r\n HttpContext,\r\n HttpErrorResponse,\r\n type HttpEvent,\r\n HttpEventType,\r\n HttpHeaders,\r\n} from '@angular/common/http';\r\nimport { inject, Injectable } from '@angular/core';\r\nimport {\r\n catchError,\r\n defer,\r\n filter,\r\n map,\r\n Observable,\r\n retry,\r\n shareReplay,\r\n switchMap,\r\n throwError,\r\n timer,\r\n type Subscription,\r\n} from 'rxjs';\r\n\r\nexport interface UploadCapabilities {\r\n uploadEnabled: boolean;\r\n maxFileSizeBytes: number;\r\n useChunkedUpload: boolean;\r\n}\r\n\r\nexport interface UploaderUploadedFile {\r\n fileId: string;\r\n fileName: string;\r\n contentType: string;\r\n size: number;\r\n payload: Readonly<Record<string, unknown>>;\r\n}\r\n\r\nexport interface UploaderUploadEvent {\r\n progress: number;\r\n completed: boolean;\r\n file?: UploaderUploadedFile;\r\n}\r\n\r\nexport type UploaderPolicyErrorCode =\r\n | 'UPLOAD_DISABLED'\r\n | 'FILE_TOO_LARGE'\r\n | 'INVALID_CAPABILITIES'\r\n | 'INVALID_SESSION';\r\n\r\nexport class UploaderPolicyError extends Error {\r\n constructor(\r\n readonly code: UploaderPolicyErrorCode,\r\n message: string,\r\n readonly maxFileSizeBytes?: number,\r\n ) {\r\n super(message);\r\n this.name = 'UploaderPolicyError';\r\n }\r\n}\r\n\r\ninterface UploaderResponse<T> {\r\n code?: number;\r\n message?: string | null;\r\n errors?: { message?: string | null } | null;\r\n data?: T;\r\n}\r\n\r\ninterface UploadSession {\r\n sessionId: string;\r\n chunkSizeBytes: number;\r\n totalChunks: number;\r\n expiresAt: string;\r\n}\r\n\r\ninterface UploadSessionProgress {\r\n isComplete: boolean;\r\n chunkIndex?: number;\r\n bytesUploaded: number;\r\n totalBytes: number;\r\n remainingChunks?: number;\r\n nextRangeStart?: number | null;\r\n fileId?: string | null;\r\n fileName?: string | null;\r\n contentType?: string | null;\r\n size?: number | null;\r\n}\r\n\r\ninterface CapabilitiesCacheEntry {\r\n expiresAt: number;\r\n value$: Observable<UploadCapabilities>;\r\n}\r\n\r\nconst TRANSIENT_RETRY_COUNT = 3;\r\nconst SESSION_RECOVERY_COUNT = 2;\r\nconst SESSION_RESTART_COUNT = 1;\r\nconst CAPABILITIES_CACHE_TTL_MS = 10_000;\r\n\r\n@Injectable({ providedIn: 'root' })\r\nexport class UploaderService {\r\n private readonly http = inject(HttpClient);\r\n private readonly defaultCapabilitiesCache = new Map<\r\n string,\r\n CapabilitiesCacheEntry\r\n >();\r\n private readonly contextualCapabilitiesCaches = new WeakMap<\r\n HttpContext,\r\n Map<string, CapabilitiesCacheEntry>\r\n >();\r\n\r\n getCapabilities(\r\n endpoint = 'uploader',\r\n context?: HttpContext,\r\n ): Observable<UploadCapabilities> {\r\n const baseEndpoint = normalizeUploaderEndpoint(endpoint);\r\n const cache = this.resolveCapabilitiesCache(context);\r\n const cached = cache.get(baseEndpoint);\r\n\r\n if (cached && cached.expiresAt > Date.now()) {\r\n return cached.value$;\r\n }\r\n\r\n let entry!: CapabilitiesCacheEntry;\r\n const value$ = this.http\r\n .get<unknown>(\r\n `${baseEndpoint}/capabilities`,\r\n this.contextOptions(context),\r\n )\r\n .pipe(\r\n this.retryTransient<unknown>(),\r\n map((response) => this.unwrapResponse<unknown>(response)),\r\n map((payload) => this.parseCapabilities(payload)),\r\n catchError((error) => {\r\n if (cache.get(baseEndpoint) === entry) {\r\n cache.delete(baseEndpoint);\r\n }\r\n\r\n return throwError(() => error);\r\n }),\r\n shareReplay({ bufferSize: 1, refCount: false }),\r\n );\r\n\r\n entry = {\r\n expiresAt: Date.now() + CAPABILITIES_CACHE_TTL_MS,\r\n value$,\r\n };\r\n cache.set(baseEndpoint, entry);\r\n\r\n return value$;\r\n }\r\n\r\n upload(\r\n file: File,\r\n endpoint = 'uploader',\r\n context?: HttpContext,\r\n ): Observable<UploaderUploadEvent> {\r\n const baseEndpoint = normalizeUploaderEndpoint(endpoint);\r\n\r\n return defer(() => this.getCapabilities(baseEndpoint, context)).pipe(\r\n switchMap((capabilities) => {\r\n if (!capabilities.uploadEnabled) {\r\n return throwError(\r\n () =>\r\n new UploaderPolicyError(\r\n 'UPLOAD_DISABLED',\r\n 'File upload is currently unavailable.',\r\n ),\r\n );\r\n }\r\n\r\n if (file.size > capabilities.maxFileSizeBytes) {\r\n return throwError(\r\n () =>\r\n new UploaderPolicyError(\r\n 'FILE_TOO_LARGE',\r\n 'File size exceeds the maximum allowed size.',\r\n capabilities.maxFileSizeBytes,\r\n ),\r\n );\r\n }\r\n\r\n return capabilities.useChunkedUpload\r\n ? this.uploadChunked(file, baseEndpoint, context)\r\n : this.uploadDirect(file, baseEndpoint, context);\r\n }),\r\n );\r\n }\r\n\r\n cancelSession(\r\n endpoint: string,\r\n sessionId: string,\r\n context?: HttpContext,\r\n ): Observable<void> {\r\n const baseEndpoint = normalizeUploaderEndpoint(endpoint);\r\n\r\n return this.http\r\n .delete<unknown>(\r\n `${baseEndpoint}/session/${encodeURIComponent(sessionId)}`,\r\n this.contextOptions(context),\r\n )\r\n .pipe(map(() => undefined));\r\n }\r\n\r\n private uploadDirect(\r\n file: File,\r\n endpoint: string,\r\n context?: HttpContext,\r\n ): Observable<UploaderUploadEvent> {\r\n const formData = new FormData();\r\n formData.append('file', file);\r\n\r\n return this.http\r\n .post<unknown>(endpoint, formData, {\r\n ...this.contextOptions(context),\r\n reportProgress: true,\r\n observe: 'events',\r\n })\r\n .pipe(\r\n this.retryTransient<HttpEvent<unknown>>(),\r\n map((event): UploaderUploadEvent | null => {\r\n if (event.type === HttpEventType.UploadProgress) {\r\n return {\r\n progress: event.total\r\n ? Math.round((event.loaded / event.total) * 100)\r\n : 0,\r\n completed: false,\r\n };\r\n }\r\n\r\n if (event.type === HttpEventType.Response) {\r\n return {\r\n progress: 100,\r\n completed: true,\r\n file: this.normalizeUploadedFile(\r\n this.unwrapResponse<unknown>(event.body),\r\n file,\r\n ),\r\n };\r\n }\r\n\r\n return null;\r\n }),\r\n filter((event): event is UploaderUploadEvent => event !== null),\r\n );\r\n }\r\n\r\n private uploadChunked(\r\n file: File,\r\n endpoint: string,\r\n context?: HttpContext,\r\n ): Observable<UploaderUploadEvent> {\r\n return this.createSession(file, endpoint, context).pipe(\r\n switchMap(\r\n (initialSession) =>\r\n new Observable<UploaderUploadEvent>((subscriber) => {\r\n let session = initialSession;\r\n let activeRequest: Subscription | null = null;\r\n let finished = false;\r\n let recoveryAttempts = 0;\r\n let restartAttempts = 0;\r\n let uploadChunk: (offset: number) => void;\r\n\r\n const finish = (progress: UploadSessionProgress): void => {\r\n const uploadedFile = this.normalizeUploadedFile(progress, file);\r\n finished = true;\r\n subscriber.next({\r\n progress: 100,\r\n completed: true,\r\n file: uploadedFile,\r\n });\r\n subscriber.complete();\r\n };\r\n\r\n const restartSession = (error: unknown): void => {\r\n if (\r\n restartAttempts >= SESSION_RESTART_COUNT ||\r\n !isMissingSessionError(error)\r\n ) {\r\n subscriber.error(error);\r\n return;\r\n }\r\n\r\n restartAttempts += 1;\r\n activeRequest = this.createSession(\r\n file,\r\n endpoint,\r\n context,\r\n ).subscribe({\r\n next: (newSession) => {\r\n session = newSession;\r\n recoveryAttempts = 0;\r\n uploadChunk(0);\r\n },\r\n error: (sessionError) => subscriber.error(sessionError),\r\n });\r\n };\r\n\r\n const recoverFromServer = (uploadError: unknown): void => {\r\n if (!isTransientUploadError(uploadError)) {\r\n subscriber.error(uploadError);\r\n return;\r\n }\r\n\r\n if (recoveryAttempts >= SESSION_RECOVERY_COUNT) {\r\n subscriber.error(uploadError);\r\n return;\r\n }\r\n\r\n recoveryAttempts += 1;\r\n activeRequest = this.getSessionStatus(\r\n endpoint,\r\n session.sessionId,\r\n context,\r\n )\r\n .pipe(this.retryTransient<UploadSessionProgress>())\r\n .subscribe({\r\n next: (status) => {\r\n try {\r\n if (status.isComplete) {\r\n finish(status);\r\n return;\r\n }\r\n\r\n uploadChunk(\r\n this.resolveNextOffset(status, file.size, true),\r\n );\r\n } catch (error) {\r\n subscriber.error(error);\r\n }\r\n },\r\n error: (statusError) => restartSession(statusError),\r\n });\r\n };\r\n\r\n uploadChunk = (offset: number): void => {\r\n if (subscriber.closed) return;\r\n if (file.size <= 0 || offset < 0 || offset >= file.size) {\r\n subscriber.error(\r\n new UploaderPolicyError(\r\n 'INVALID_SESSION',\r\n 'The upload session returned an invalid file range.',\r\n ),\r\n );\r\n return;\r\n }\r\n\r\n const endExclusive = Math.min(\r\n offset + session.chunkSizeBytes,\r\n file.size,\r\n );\r\n const chunk = file.slice(offset, endExclusive);\r\n const headers = new HttpHeaders({\r\n 'Content-Range': `bytes ${offset}-${endExclusive - 1}/${file.size}`,\r\n });\r\n\r\n activeRequest = this.http\r\n .put<unknown>(\r\n `${endpoint}/session/${encodeURIComponent(session.sessionId)}`,\r\n chunk,\r\n {\r\n ...this.contextOptions(context),\r\n headers,\r\n reportProgress: true,\r\n observe: 'events',\r\n },\r\n )\r\n .pipe(this.retryTransient<HttpEvent<unknown>>())\r\n .subscribe({\r\n next: (event) => {\r\n if (event.type === HttpEventType.UploadProgress) {\r\n const uploaded = Math.min(\r\n offset + event.loaded,\r\n file.size,\r\n );\r\n subscriber.next({\r\n progress: Math.round((uploaded / file.size) * 100),\r\n completed: false,\r\n });\r\n return;\r\n }\r\n\r\n if (event.type !== HttpEventType.Response) return;\r\n try {\r\n const progress = this.parseSessionProgress(\r\n this.unwrapResponse<unknown>(event.body),\r\n );\r\n recoveryAttempts = 0;\r\n\r\n if (progress.isComplete) {\r\n finish(progress);\r\n return;\r\n }\r\n\r\n uploadChunk(\r\n this.resolveNextOffset(\r\n progress,\r\n file.size,\r\n false,\r\n offset,\r\n ),\r\n );\r\n } catch (error) {\r\n subscriber.error(error);\r\n }\r\n },\r\n error: recoverFromServer,\r\n });\r\n };\r\n\r\n subscriber.next({ progress: 0, completed: false });\r\n uploadChunk(0);\r\n\r\n return () => {\r\n activeRequest?.unsubscribe();\r\n if (!finished && session.sessionId) {\r\n this.cancelSession(\r\n endpoint,\r\n session.sessionId,\r\n context,\r\n ).subscribe({ error: () => undefined });\r\n }\r\n };\r\n }),\r\n ),\r\n );\r\n }\r\n\r\n private createSession(\r\n file: File,\r\n endpoint: string,\r\n context?: HttpContext,\r\n ): Observable<UploadSession> {\r\n return this.http\r\n .post<unknown>(\r\n `${endpoint}/session`,\r\n {\r\n fileName: file.name,\r\n fileSize: file.size,\r\n contentType: file.type || 'application/octet-stream',\r\n },\r\n this.contextOptions(context),\r\n )\r\n .pipe(\r\n this.retryTransient<unknown>(),\r\n map((response) =>\r\n this.parseSession(this.unwrapResponse<unknown>(response)),\r\n ),\r\n );\r\n }\r\n\r\n private getSessionStatus(\r\n endpoint: string,\r\n sessionId: string,\r\n context?: HttpContext,\r\n ): Observable<UploadSessionProgress> {\r\n return this.http\r\n .get<unknown>(\r\n `${endpoint}/session/${encodeURIComponent(sessionId)}`,\r\n this.contextOptions(context),\r\n )\r\n .pipe(\r\n map((response) =>\r\n this.parseSessionProgress(this.unwrapResponse<unknown>(response)),\r\n ),\r\n );\r\n }\r\n\r\n private parseCapabilities(payload: unknown): UploadCapabilities {\r\n const value = asRecord(payload);\r\n const uploadEnabled = value['uploadEnabled'];\r\n const maxFileSizeBytes = value['maxFileSizeBytes'];\r\n const useChunkedUpload = value['useChunkedUpload'];\r\n\r\n if (\r\n typeof uploadEnabled !== 'boolean' ||\r\n typeof maxFileSizeBytes !== 'number' ||\r\n !Number.isFinite(maxFileSizeBytes) ||\r\n maxFileSizeBytes < 0 ||\r\n (uploadEnabled && maxFileSizeBytes === 0) ||\r\n typeof useChunkedUpload !== 'boolean'\r\n ) {\r\n throw new UploaderPolicyError(\r\n 'INVALID_CAPABILITIES',\r\n 'File upload is currently unavailable.',\r\n );\r\n }\r\n\r\n return { uploadEnabled, maxFileSizeBytes, useChunkedUpload };\r\n }\r\n\r\n private parseSession(payload: unknown): UploadSession {\r\n const value = asRecord(payload);\r\n const sessionId = readString(value, 'sessionId');\r\n const chunkSizeBytes = readNumber(value, 'chunkSizeBytes');\r\n\r\n if (!sessionId || !chunkSizeBytes || chunkSizeBytes <= 0) {\r\n throw new UploaderPolicyError(\r\n 'INVALID_SESSION',\r\n 'The upload session could not be started.',\r\n );\r\n }\r\n\r\n return {\r\n sessionId,\r\n chunkSizeBytes,\r\n totalChunks: readNumber(value, 'totalChunks') ?? 0,\r\n expiresAt: readString(value, 'expiresAt') ?? '',\r\n };\r\n }\r\n\r\n private parseSessionProgress(payload: unknown): UploadSessionProgress {\r\n const value = asRecord(payload);\r\n const isComplete = value['isComplete'];\r\n const bytesUploaded = readNumber(value, 'bytesUploaded');\r\n const totalBytes = readNumber(value, 'totalBytes');\r\n\r\n if (\r\n typeof isComplete !== 'boolean' ||\r\n bytesUploaded == null ||\r\n bytesUploaded < 0 ||\r\n totalBytes == null ||\r\n totalBytes < 0\r\n ) {\r\n throw new UploaderPolicyError(\r\n 'INVALID_SESSION',\r\n 'The upload session returned an invalid response.',\r\n );\r\n }\r\n\r\n return {\r\n isComplete,\r\n chunkIndex: readNumber(value, 'chunkIndex') ?? undefined,\r\n bytesUploaded,\r\n totalBytes,\r\n remainingChunks: readNumber(value, 'remainingChunks') ?? undefined,\r\n nextRangeStart: readNumber(value, 'nextRangeStart'),\r\n fileId: readString(value, 'fileId'),\r\n fileName: readString(value, 'fileName'),\r\n contentType: readString(value, 'contentType'),\r\n size: readNumber(value, 'size'),\r\n };\r\n }\r\n\r\n private resolveNextOffset(\r\n progress: UploadSessionProgress,\r\n fileSize: number,\r\n allowSameOffset: boolean,\r\n previousOffset = -1,\r\n ): number {\r\n const offset = progress.nextRangeStart ?? progress.bytesUploaded;\r\n const isAdvancing = allowSameOffset\r\n ? offset >= previousOffset\r\n : offset > previousOffset;\r\n\r\n if (\r\n !Number.isFinite(offset) ||\r\n offset < 0 ||\r\n offset >= fileSize ||\r\n !isAdvancing\r\n ) {\r\n throw new UploaderPolicyError(\r\n 'INVALID_SESSION',\r\n 'The upload session returned an invalid file range.',\r\n );\r\n }\r\n\r\n return offset;\r\n }\r\n\r\n private normalizeUploadedFile(\r\n payload: unknown,\r\n file: File,\r\n ): UploaderUploadedFile {\r\n const value = asRecord(payload);\r\n const fileId = firstNonEmptyString(\r\n value['fileId'],\r\n value['name'] && value['fileName'] ? value['fileName'] : undefined,\r\n value['id'],\r\n value['fileName'],\r\n value['name'],\r\n );\r\n const fileName = firstNonEmptyString(\r\n value['originalFileName'],\r\n value['name'],\r\n value['fileId'] || (value['id'] && !value['name'])\r\n ? value['fileName']\r\n : undefined,\r\n file.name,\r\n );\r\n\r\n if (!fileId) {\r\n throw new UploaderPolicyError(\r\n 'INVALID_SESSION',\r\n 'The upload completed without a file identifier.',\r\n );\r\n }\r\n\r\n return {\r\n fileId,\r\n fileName: fileName || file.name,\r\n contentType: readString(value, 'contentType') || file.type,\r\n size: readNumber(value, 'size') ?? file.size,\r\n payload: value,\r\n };\r\n }\r\n\r\n private unwrapResponse<T>(response: unknown): T {\r\n if (!response || typeof response !== 'object') {\r\n return response as T;\r\n }\r\n\r\n const envelope = response as UploaderResponse<T>;\r\n if (envelope.code === 2) {\r\n throw new Error('Upload request failed.');\r\n }\r\n\r\n return ('data' in envelope ? envelope.data : response) as T;\r\n }\r\n\r\n private contextOptions(context?: HttpContext): { context?: HttpContext } {\r\n return context ? { context } : {};\r\n }\r\n\r\n private resolveCapabilitiesCache(\r\n context?: HttpContext,\r\n ): Map<string, CapabilitiesCacheEntry> {\r\n if (!context) {\r\n return this.defaultCapabilitiesCache;\r\n }\r\n\r\n let cache = this.contextualCapabilitiesCaches.get(context);\r\n if (!cache) {\r\n cache = new Map<string, CapabilitiesCacheEntry>();\r\n this.contextualCapabilitiesCaches.set(context, cache);\r\n }\r\n\r\n return cache;\r\n }\r\n\r\n private retryTransient<T>() {\r\n return retry<T>({\r\n count: TRANSIENT_RETRY_COUNT,\r\n delay: (error, retryCount) =>\r\n isTransientUploadError(error)\r\n ? timer(250 * 2 ** (retryCount - 1))\r\n : throwError(() => error),\r\n });\r\n }\r\n}\r\n\r\nfunction normalizeUploaderEndpoint(endpoint: string): string {\r\n const normalized = (endpoint || 'uploader').trim().replace(/\\/+$/, '');\r\n return normalized || 'uploader';\r\n}\r\n\r\nfunction asRecord(value: unknown): Record<string, unknown> {\r\n return value && typeof value === 'object'\r\n ? (value as Record<string, unknown>)\r\n : {};\r\n}\r\n\r\nfunction readString(\r\n value: Record<string, unknown>,\r\n key: string,\r\n): string | null {\r\n const candidate = value[key];\r\n return typeof candidate === 'string' && candidate.trim()\r\n ? candidate.trim()\r\n : null;\r\n}\r\n\r\nfunction readNumber(\r\n value: Record<string, unknown>,\r\n key: string,\r\n): number | null {\r\n const candidate = value[key];\r\n return typeof candidate === 'number' && Number.isFinite(candidate)\r\n ? candidate\r\n : null;\r\n}\r\n\r\nfunction firstNonEmptyString(...values: unknown[]): string {\r\n for (const value of values) {\r\n if (typeof value === 'string' && value.trim()) {\r\n return value.trim();\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nfunction isTransientUploadError(error: unknown): boolean {\r\n if (!(error instanceof HttpErrorResponse)) return false;\r\n return (\r\n error.status === 0 ||\r\n error.status === 408 ||\r\n error.status === 425 ||\r\n error.status === 429 ||\r\n error.status >= 500\r\n );\r\n}\r\n\r\nfunction isMissingSessionError(error: unknown): boolean {\r\n return error instanceof HttpErrorResponse && error.status === 404;\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAiDM,MAAO,mBAAoB,SAAQ,KAAK,CAAA;AAEjC,IAAA,IAAA;AAEA,IAAA,gBAAA;AAHX,IAAA,WAAA,CACW,IAA6B,EACtC,OAAe,EACN,gBAAyB,EAAA;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;AAEvB;AAEA,SAAS,qBAAqB,CAAC,KAAc,EAAA;IAC3C,OAAO,KAAK,YAAY,iBAAiB,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG;AACnE;;AC9rBA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/components",
3
- "version": "0.0.224",
3
+ "version": "0.0.226",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -255,6 +255,10 @@
255
255
  "types": "./types/masterteam-components-upload-field.d.ts",
256
256
  "default": "./fesm2022/masterteam-components-upload-field.mjs"
257
257
  },
258
+ "./uploader": {
259
+ "types": "./types/masterteam-components-uploader.d.ts",
260
+ "default": "./fesm2022/masterteam-components-uploader.mjs"
261
+ },
258
262
  "./user-search-field": {
259
263
  "types": "./types/masterteam-components-user-search-field.d.ts",
260
264
  "default": "./fesm2022/masterteam-components-user-search-field.mjs"
@@ -74,6 +74,7 @@ interface CellChangeEvent {
74
74
  }
75
75
  type ColumnTypeForActionCell = 'boolean';
76
76
  type TableActionShape = 'flat' | 'popover';
77
+ type TableActionPlacement = 'menu' | 'inline';
77
78
  /**
78
79
  * Filter UX mode for a table.
79
80
  *
@@ -138,11 +139,17 @@ interface TableAction {
138
139
  icon?: MTIcon | undefined;
139
140
  color?: 'info' | 'success' | 'warn' | 'danger' | 'secondary' | 'contrast' | 'help' | 'primary';
140
141
  variant?: 'text' | 'outlined' | undefined;
142
+ size?: 'small' | 'large' | undefined;
143
+ /**
144
+ * In popover action mode, `inline` actions render as direct icon buttons
145
+ * before the three-dot menu. Defaults to `menu`.
146
+ */
147
+ placement?: TableActionPlacement;
141
148
  label?: string;
142
149
  tooltip?: string;
143
150
  hidden?: (row: any) => boolean;
144
151
  action: (row: any) => void;
145
- loading?: (row: any) => boolean;
152
+ loading?: boolean | ((row: any) => boolean);
146
153
  confirmation?: TableActionConfirmationConfig;
147
154
  }
148
155
 
@@ -364,6 +371,9 @@ declare class Table {
364
371
  onCellChange(row: any, columnKey: string, newValue: any, type?: ColumnTypeForActionCell): void;
365
372
  resolveActionLoading(action: TableAction, row: any): boolean | undefined;
366
373
  getVisibleRowActions(row: any): TableAction[];
374
+ getInlineRowActions(row: any): TableAction[];
375
+ getMenuRowActions(row: any): TableAction[];
376
+ shouldShowRowActionsPopover(row: any): boolean;
367
377
  isRowActionsLoading(row: any): boolean;
368
378
  onRowActionsToggle(event: Event, popover: {
369
379
  toggle: (e: Event) => void;
@@ -724,4 +734,4 @@ declare class TableExportService {
724
734
  }
725
735
 
726
736
  export { Table, TableActionsMenu, TableCaption, TableColumnFilter, TableExportService, TableFilter, TableFilterField, TableGroupingController, TableValueResolver };
727
- export type { CellChangeEvent, ColumnDef, ColumnType, ColumnTypeForActionCell, FilterConfig, FilterOption, FilterValue, TableAction, TableActionConfirmationConfig, TableActionShape, TableEntityUsage, TableExportConfig, TableExportValueResolver, TableFilterMode, TableFilters, TablePersistStateKey, TablePrintConfig, TableStatusMapValue };
737
+ export type { CellChangeEvent, ColumnDef, ColumnType, ColumnTypeForActionCell, FilterConfig, FilterOption, FilterValue, TableAction, TableActionConfirmationConfig, TableActionPlacement, TableActionShape, TableEntityUsage, TableExportConfig, TableExportValueResolver, TableFilterMode, TableFilters, TablePersistStateKey, TablePrintConfig, TableStatusMapValue };
@@ -21,14 +21,8 @@ declare class UploadField implements ControlValueAccessor {
21
21
  readonly: _angular_core.InputSignal<boolean>;
22
22
  readonly context: _angular_core.InputSignal<HttpContext | undefined>;
23
23
  readonly isMultipleEnabled: _angular_core.Signal<boolean>;
24
- /**
25
- * Resolved size cap in bytes. Falls back to {@link DEFAULT_MAX_FILE_SIZE} when
26
- * no explicit `fileSizeLimit` is provided. A `computed` (rather than an input
27
- * default) is required because `dynamic-field` binds `[fileSizeLimit]` to a
28
- * possibly-`undefined` config value, which would otherwise clobber the
29
- * default.
30
- */
31
- readonly effectiveSizeLimit: _angular_core.Signal<number>;
24
+ /** Optional feature-specific limit. The backend capability is authoritative. */
25
+ readonly effectiveSizeLimit: _angular_core.Signal<number | undefined>;
32
26
  /**
33
27
  * The native `accept` attribute is only a UI hint — users can switch the OS
34
28
  * file dialog to "All files" and pick anything. This is the spec we re-check
@@ -49,9 +43,14 @@ declare class UploadField implements ControlValueAccessor {
49
43
  readonly primaryFile: _angular_core.Signal<any>;
50
44
  readonly imgPath: _angular_core.Signal<string | undefined>;
51
45
  readonly disabled: _angular_core.WritableSignal<boolean>;
46
+ readonly policyChecking: _angular_core.WritableSignal<boolean>;
47
+ readonly policyUnavailable: _angular_core.WritableSignal<boolean>;
52
48
  readonly uploadProgress: _angular_core.WritableSignal<number>;
53
49
  readonly loading: _angular_core.WritableSignal<boolean>;
50
+ readonly uploadInteractionDisabled: _angular_core.Signal<boolean>;
54
51
  private readonly httpClient;
52
+ private readonly uploader;
53
+ private readonly destroyRef;
55
54
  private readonly pendingUploads;
56
55
  onTouched: () => void;
57
56
  onModelChange: (value: any) => void;
@@ -73,6 +72,7 @@ declare class UploadField implements ControlValueAccessor {
73
72
  onDragLeave(event: DragEvent): void;
74
73
  onDrop(event: DragEvent): void;
75
74
  protected resolveImgPath(value: any): string | undefined;
75
+ private handleUploadError;
76
76
  private fetchMetadata;
77
77
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<UploadField, never>;
78
78
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<UploadField, "mt-upload-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "description": { "alias": "description"; "required": false; "isSignal": true; }; "endPoint": { "alias": "endPoint"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "userImgClass": { "alias": "userImgClass"; "required": false; "isSignal": true; }; "shape": { "alias": "shape"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "isDragging": { "alias": "isDragging"; "required": false; "isSignal": true; }; "fileSizeLimit": { "alias": "fileSizeLimit"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, { "isDragging": "isDraggingChange"; "onChange": "onChange"; }, never, never, true, never>;
@@ -0,0 +1,53 @@
1
+ import { HttpContext } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from '@angular/core';
4
+
5
+ interface UploadCapabilities {
6
+ uploadEnabled: boolean;
7
+ maxFileSizeBytes: number;
8
+ useChunkedUpload: boolean;
9
+ }
10
+ interface UploaderUploadedFile {
11
+ fileId: string;
12
+ fileName: string;
13
+ contentType: string;
14
+ size: number;
15
+ payload: Readonly<Record<string, unknown>>;
16
+ }
17
+ interface UploaderUploadEvent {
18
+ progress: number;
19
+ completed: boolean;
20
+ file?: UploaderUploadedFile;
21
+ }
22
+ type UploaderPolicyErrorCode = 'UPLOAD_DISABLED' | 'FILE_TOO_LARGE' | 'INVALID_CAPABILITIES' | 'INVALID_SESSION';
23
+ declare class UploaderPolicyError extends Error {
24
+ readonly code: UploaderPolicyErrorCode;
25
+ readonly maxFileSizeBytes?: number | undefined;
26
+ constructor(code: UploaderPolicyErrorCode, message: string, maxFileSizeBytes?: number | undefined);
27
+ }
28
+ declare class UploaderService {
29
+ private readonly http;
30
+ private readonly defaultCapabilitiesCache;
31
+ private readonly contextualCapabilitiesCaches;
32
+ getCapabilities(endpoint?: string, context?: HttpContext): Observable<UploadCapabilities>;
33
+ upload(file: File, endpoint?: string, context?: HttpContext): Observable<UploaderUploadEvent>;
34
+ cancelSession(endpoint: string, sessionId: string, context?: HttpContext): Observable<void>;
35
+ private uploadDirect;
36
+ private uploadChunked;
37
+ private createSession;
38
+ private getSessionStatus;
39
+ private parseCapabilities;
40
+ private parseSession;
41
+ private parseSessionProgress;
42
+ private resolveNextOffset;
43
+ private normalizeUploadedFile;
44
+ private unwrapResponse;
45
+ private contextOptions;
46
+ private resolveCapabilitiesCache;
47
+ private retryTransient;
48
+ static ɵfac: i0.ɵɵFactoryDeclaration<UploaderService, never>;
49
+ static ɵprov: i0.ɵɵInjectableDeclaration<UploaderService>;
50
+ }
51
+
52
+ export { UploaderPolicyError, UploaderService };
53
+ export type { UploadCapabilities, UploaderPolicyErrorCode, UploaderUploadEvent, UploaderUploadedFile };