u-mapsnpm 1.0.0 → 1.0.2

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 (34) hide show
  1. package/README.md +636 -0
  2. package/dist/angular/helpers/destroy.helper.d.ts +36 -0
  3. package/dist/angular/helpers/destroy.helper.d.ts.map +1 -0
  4. package/dist/angular/helpers/destroy.helper.js +49 -0
  5. package/dist/angular/helpers/destroy.helper.js.map +1 -0
  6. package/dist/angular/helpers/rxjs.helpers.d.ts +39 -0
  7. package/dist/angular/helpers/rxjs.helpers.d.ts.map +1 -0
  8. package/dist/angular/helpers/rxjs.helpers.js +35 -0
  9. package/dist/angular/helpers/rxjs.helpers.js.map +1 -0
  10. package/dist/angular/index.d.ts +4 -0
  11. package/dist/angular/index.d.ts.map +1 -1
  12. package/dist/angular/index.js +7 -0
  13. package/dist/angular/index.js.map +1 -1
  14. package/dist/angular/services/http.service.d.ts +17 -1
  15. package/dist/angular/services/http.service.d.ts.map +1 -1
  16. package/dist/angular/services/http.service.js +38 -13
  17. package/dist/angular/services/http.service.js.map +1 -1
  18. package/dist/angular/tokens/api-url.token.d.ts +16 -0
  19. package/dist/angular/tokens/api-url.token.d.ts.map +1 -0
  20. package/dist/angular/tokens/api-url.token.js +16 -0
  21. package/dist/angular/tokens/api-url.token.js.map +1 -0
  22. package/dist/angular/tokens/app-config.token.d.ts +23 -0
  23. package/dist/angular/tokens/app-config.token.d.ts.map +1 -0
  24. package/dist/angular/tokens/app-config.token.js +14 -0
  25. package/dist/angular/tokens/app-config.token.js.map +1 -0
  26. package/dist/angular/tokens/index.d.ts +3 -0
  27. package/dist/angular/tokens/index.d.ts.map +1 -0
  28. package/dist/angular/tokens/index.js +3 -0
  29. package/dist/angular/tokens/index.js.map +1 -0
  30. package/dist/test-setup.d.ts +3 -0
  31. package/dist/test-setup.d.ts.map +1 -0
  32. package/dist/test-setup.js +3 -0
  33. package/dist/test-setup.js.map +1 -0
  34. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,636 @@
1
+ # u-mapsnpm
2
+
3
+ Core utilities, Angular infrastructure, and shared types for the U-Maps platform.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install u-mapsnpm
9
+ ```
10
+
11
+ ### Peer Dependencies
12
+
13
+ Angular features require:
14
+
15
+ ```bash
16
+ npm install @angular/core @angular/common rxjs
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Entry Points
22
+
23
+ ```ts
24
+ import { ... } from 'u-maps'; // Core utilities (framework-agnostic)
25
+ import { ... } from 'u-maps/angular'; // Angular services, helpers, tokens
26
+ import type { ... } from 'u-maps/types'; // Shared TypeScript interfaces
27
+ ```
28
+
29
+ ---
30
+
31
+ ## Core Utilities (`u-maps`)
32
+
33
+ Framework-agnostic utility functions. No Angular dependency required.
34
+
35
+ ### String Utilities
36
+
37
+ #### `capitalize(value: string): string`
38
+
39
+ Capitalizes the first letter of a string.
40
+
41
+ ```ts
42
+ import { capitalize } from 'u-maps';
43
+
44
+ capitalize('hello'); // 'Hello'
45
+ capitalize(''); // ''
46
+ ```
47
+
48
+ #### `truncate(value: string, maxLength: number, suffix?: string): string`
49
+
50
+ Truncates a string to a maximum length, appending a suffix (default `'...'`).
51
+
52
+ ```ts
53
+ import { truncate } from 'u-maps';
54
+
55
+ truncate('Hello World', 8); // 'Hello...'
56
+ truncate('Hello World', 8, '…'); // 'Hello W…'
57
+ truncate('Short', 10); // 'Short'
58
+ ```
59
+
60
+ #### `toKebabCase(value: string): string`
61
+
62
+ Converts a string to kebab-case.
63
+
64
+ ```ts
65
+ import { toKebabCase } from 'u-maps';
66
+
67
+ toKebabCase('helloWorld'); // 'hello-world'
68
+ toKebabCase('Hello World'); // 'hello-world'
69
+ toKebabCase('some_value'); // 'some-value'
70
+ ```
71
+
72
+ #### `toCamelCase(value: string): string`
73
+
74
+ Converts a string to camelCase.
75
+
76
+ ```ts
77
+ import { toCamelCase } from 'u-maps';
78
+
79
+ toCamelCase('hello-world'); // 'helloWorld'
80
+ toCamelCase('Hello World'); // 'helloWorld'
81
+ toCamelCase('some_value'); // 'someValue'
82
+ ```
83
+
84
+ ### Number Utilities
85
+
86
+ #### `formatCurrency(value: number, locale?: string, currency?: string): string`
87
+
88
+ Formats a number as a currency string using `Intl.NumberFormat`.
89
+
90
+ ```ts
91
+ import { formatCurrency } from 'u-maps';
92
+
93
+ formatCurrency(1234.5); // '$1,234.50'
94
+ formatCurrency(1234.5, 'uz-UZ', 'UZS'); // locale-specific format
95
+ ```
96
+
97
+ #### `clamp(value: number, min: number, max: number): number`
98
+
99
+ Clamps a number between min and max bounds.
100
+
101
+ ```ts
102
+ import { clamp } from 'u-maps';
103
+
104
+ clamp(15, 0, 10); // 10
105
+ clamp(-5, 0, 10); // 0
106
+ clamp(5, 0, 10); // 5
107
+ ```
108
+
109
+ #### `roundTo(value: number, decimals: number): number`
110
+
111
+ Rounds a number to the specified number of decimal places.
112
+
113
+ ```ts
114
+ import { roundTo } from 'u-maps';
115
+
116
+ roundTo(3.14159, 2); // 3.14
117
+ roundTo(3.14159, 0); // 3
118
+ ```
119
+
120
+ ### Date Utilities
121
+
122
+ #### `formatDate(date: Date, locale?: string, options?: Intl.DateTimeFormatOptions): string`
123
+
124
+ Formats a Date to a locale string. Defaults to `'en-US'` with `year: 'numeric', month: 'short', day: 'numeric'`.
125
+
126
+ ```ts
127
+ import { formatDate } from 'u-maps';
128
+
129
+ formatDate(new Date('2025-03-25')); // 'Mar 25, 2025'
130
+ formatDate(new Date('2025-03-25'), 'uz-UZ', { dateStyle: 'long' });
131
+ ```
132
+
133
+ #### `isToday(date: Date): boolean`
134
+
135
+ Returns `true` if the given date is today.
136
+
137
+ ```ts
138
+ import { isToday } from 'u-maps';
139
+
140
+ isToday(new Date()); // true
141
+ ```
142
+
143
+ #### `daysBetween(a: Date, b: Date): number`
144
+
145
+ Returns the number of full days between two dates.
146
+
147
+ ```ts
148
+ import { daysBetween } from 'u-maps';
149
+
150
+ daysBetween(new Date('2025-01-01'), new Date('2025-01-10')); // 9
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Angular Layer (`u-maps/angular`)
156
+
157
+ Angular infrastructure utilities. Requires `@angular/core >= 19` and `rxjs >= 7`.
158
+
159
+ ### Services
160
+
161
+ #### `HttpService`
162
+
163
+ Typed HTTP wrapper around Angular's `HttpClient`. Automatically prepends the `API_URL` token to relative paths. All responses are typed with `ApiResponse<T>`.
164
+
165
+ ```ts
166
+ import { HttpService } from 'u-maps/angular';
167
+
168
+ @Injectable({ providedIn: 'root' })
169
+ export class UserService {
170
+ private http = inject(HttpService);
171
+
172
+ getUser(id: string) {
173
+ return this.http.get<User>(`/users/${id}`);
174
+ // Calls: https://api.example.com/users/123
175
+ // Returns: Observable<ApiResponse<User>>
176
+ }
177
+
178
+ getUsers(page: number) {
179
+ return this.http.getList<User>('/users', { params: { page } });
180
+ // Returns: Observable<PaginatedResponse<User>>
181
+ }
182
+
183
+ createUser(body: CreateUserDto) {
184
+ return this.http.post<User>('/users', body);
185
+ }
186
+
187
+ updateUser(id: string, body: Partial<User>) {
188
+ return this.http.put<User>(`/users/${id}`, body);
189
+ }
190
+
191
+ patchUser(id: string, body: Partial<User>) {
192
+ return this.http.patch<User>(`/users/${id}`, body);
193
+ }
194
+
195
+ deleteUser(id: string) {
196
+ return this.http.delete<void>(`/users/${id}`);
197
+ }
198
+ }
199
+ ```
200
+
201
+ **Methods:**
202
+
203
+ | Method | Signature | Returns |
204
+ |--------|-----------|---------|
205
+ | `get` | `get<T>(url, options?)` | `Observable<ApiResponse<T>>` |
206
+ | `getList` | `getList<T>(url, options?)` | `Observable<PaginatedResponse<T>>` |
207
+ | `post` | `post<T>(url, body, options?)` | `Observable<ApiResponse<T>>` |
208
+ | `put` | `put<T>(url, body, options?)` | `Observable<ApiResponse<T>>` |
209
+ | `patch` | `patch<T>(url, body, options?)` | `Observable<ApiResponse<T>>` |
210
+ | `delete` | `delete<T>(url, options?)` | `Observable<ApiResponse<T>>` |
211
+
212
+ **RequestOptions:**
213
+
214
+ ```ts
215
+ interface RequestOptions {
216
+ params?: Record<string, string | number | boolean>;
217
+ headers?: Record<string, string>;
218
+ }
219
+ ```
220
+
221
+ **Extending HttpService:**
222
+
223
+ You can extend `HttpService` for domain-specific services:
224
+
225
+ ```ts
226
+ @Injectable({ providedIn: 'root' })
227
+ export class UserService extends HttpService {
228
+ getUsers() {
229
+ return this.get<User[]>('/users');
230
+ }
231
+ }
232
+ ```
233
+
234
+ Absolute URLs bypass the `API_URL` prefix:
235
+
236
+ ```ts
237
+ this.http.get<Data>('https://external-api.com/data'); // No prefix
238
+ ```
239
+
240
+ #### `BaseService`
241
+
242
+ Abstract service with lifecycle management. Extend this for services that need cleanup.
243
+
244
+ ```ts
245
+ import { BaseService } from 'u-maps/angular';
246
+
247
+ @Injectable({ providedIn: 'root' })
248
+ export class WebSocketService extends BaseService {
249
+ private connection$ = new Subject<Message>();
250
+
251
+ connect(url: string) {
252
+ someWebSocket(url).pipe(
253
+ takeUntil(this.destroy$), // Auto-cleanup on destroy
254
+ ).subscribe(msg => this.connection$.next(msg));
255
+ }
256
+ }
257
+ ```
258
+
259
+ **Protected members:**
260
+
261
+ | Member | Type | Description |
262
+ |--------|------|-------------|
263
+ | `destroyRef` | `DestroyRef` | Angular destroy reference |
264
+ | `destroy$` | `Subject<void>` | Emits and completes on destroy |
265
+
266
+ ### Helpers
267
+
268
+ #### `injectDestroy(): Subject<void>`
269
+
270
+ Creates a `Subject<void>` that emits and completes when the injection context is destroyed. Must be called inside an injection context.
271
+
272
+ ```ts
273
+ import { injectDestroy } from 'u-maps/angular';
274
+
275
+ @Component({ ... })
276
+ export class MyComponent {
277
+ private destroy$ = injectDestroy();
278
+
279
+ ngOnInit() {
280
+ this.someService.data$.pipe(
281
+ takeUntil(this.destroy$),
282
+ ).subscribe(data => { ... });
283
+ }
284
+ }
285
+ ```
286
+
287
+ #### `takeUntilDestroyed<T>(): MonoTypeOperatorFunction<T>`
288
+
289
+ RxJS operator version of `injectDestroy`. Must be called inside an injection context (field initializer, constructor).
290
+
291
+ ```ts
292
+ import { takeUntilDestroyed } from 'u-maps/angular';
293
+
294
+ @Component({ ... })
295
+ export class MyComponent {
296
+ private untilDestroyed = takeUntilDestroyed();
297
+
298
+ ngOnInit() {
299
+ this.someService.data$.pipe(
300
+ this.untilDestroyed,
301
+ ).subscribe(data => { ... });
302
+ }
303
+ }
304
+ ```
305
+
306
+ #### `mapResponse<T>(): OperatorFunction<T, ResponseResult<T>>`
307
+
308
+ Maps an Observable into a discriminated success/error union. The stream never errors — errors are caught and wrapped.
309
+
310
+ ```ts
311
+ import { mapResponse } from 'u-maps/angular';
312
+
313
+ this.http.get<User[]>('/users').pipe(
314
+ mapResponse(),
315
+ ).subscribe(result => {
316
+ if (result.success) {
317
+ console.log(result.data); // User[]
318
+ } else {
319
+ console.error(result.error); // unknown
320
+ }
321
+ });
322
+ ```
323
+
324
+ **ResponseResult type:**
325
+
326
+ ```ts
327
+ type ResponseResult<T> =
328
+ | { success: true; data: T }
329
+ | { success: false; error: unknown };
330
+ ```
331
+
332
+ #### `handleError<T>(fallback: T): OperatorFunction<T, T>`
333
+
334
+ Catches errors and replaces the stream with a fallback value.
335
+
336
+ ```ts
337
+ import { handleError } from 'u-maps/angular';
338
+
339
+ this.http.get<User[]>('/users').pipe(
340
+ handleError([]), // On error, emit empty array
341
+ ).subscribe(users => { ... }); // Always gets User[]
342
+ ```
343
+
344
+ #### `createLoadingState<T>(initialValue?: T | null): LoadingState<T>`
345
+
346
+ Creates a reactive loading-state triple using Angular signals. Useful for managing async data fetch patterns.
347
+
348
+ ```ts
349
+ import { createLoadingState } from 'u-maps/angular';
350
+
351
+ @Component({
352
+ template: `
353
+ @if (state.loading()) {
354
+ <spinner />
355
+ }
356
+ @if (state.error(); as error) {
357
+ <error-message [text]="error" />
358
+ }
359
+ @if (state.data(); as users) {
360
+ <user-list [users]="users" />
361
+ }
362
+ `
363
+ })
364
+ export class UsersComponent {
365
+ state = createLoadingState<User[]>();
366
+
367
+ constructor() {
368
+ this.load();
369
+ }
370
+
371
+ load() {
372
+ this.state.setLoading(true);
373
+ inject(HttpService).get<User[]>('/users').subscribe({
374
+ next: res => this.state.set(res.data),
375
+ error: err => this.state.setError(err.message),
376
+ });
377
+ }
378
+ }
379
+ ```
380
+
381
+ **LoadingState interface:**
382
+
383
+ | Member | Type | Description |
384
+ |--------|------|-------------|
385
+ | `data` | `Signal<T \| null>` | Current data (read-only signal) |
386
+ | `loading` | `Signal<boolean>` | Loading flag (read-only signal) |
387
+ | `error` | `Signal<string \| null>` | Error message (read-only signal) |
388
+ | `set(value)` | `(T) => void` | Sets data, clears loading and error |
389
+ | `setError(msg)` | `(string) => void` | Sets error, clears loading |
390
+ | `setLoading(flag)` | `(boolean) => void` | Sets loading, clears error if `true` |
391
+ | `reset()` | `() => void` | Resets to initial state |
392
+
393
+ ### Injection Tokens
394
+
395
+ #### `API_URL`
396
+
397
+ `InjectionToken<string>` — base URL for all HTTP requests made through `HttpService`.
398
+
399
+ ```ts
400
+ import { API_URL } from 'u-maps/angular';
401
+
402
+ // app.config.ts
403
+ export const appConfig: ApplicationConfig = {
404
+ providers: [
405
+ provideHttpClient(),
406
+ { provide: API_URL, useValue: 'https://api.u-maps.uz/v1' },
407
+ ],
408
+ };
409
+ ```
410
+
411
+ If `API_URL` is not provided, `HttpService` uses an empty string (relative paths stay relative).
412
+
413
+ #### `APP_CONFIG`
414
+
415
+ `InjectionToken<AppConfig>` — application-wide configuration object.
416
+
417
+ ```ts
418
+ import { APP_CONFIG, type AppConfig } from 'u-maps/angular';
419
+
420
+ // Extend for your project
421
+ interface MyConfig extends AppConfig {
422
+ mapboxToken: string;
423
+ sentryDsn: string;
424
+ }
425
+
426
+ const config: MyConfig = {
427
+ apiUrl: 'https://api.u-maps.uz/v1',
428
+ production: true,
429
+ mapboxToken: '...',
430
+ sentryDsn: '...',
431
+ };
432
+
433
+ // app.config.ts
434
+ providers: [
435
+ { provide: APP_CONFIG, useValue: config },
436
+ ]
437
+
438
+ // Any service/component
439
+ export class MapService {
440
+ private config = inject(APP_CONFIG) as MyConfig;
441
+ }
442
+ ```
443
+
444
+ **AppConfig interface:**
445
+
446
+ ```ts
447
+ interface AppConfig {
448
+ apiUrl: string;
449
+ production: boolean;
450
+ [key: string]: unknown; // extensible
451
+ }
452
+ ```
453
+
454
+ ---
455
+
456
+ ## Shared Types (`u-maps/types`)
457
+
458
+ TypeScript interfaces for API contracts and entity shapes. No runtime code.
459
+
460
+ ### API Interfaces
461
+
462
+ #### `ApiResponse<T>`
463
+
464
+ Standard API response envelope.
465
+
466
+ ```ts
467
+ interface ApiResponse<T> {
468
+ data: T;
469
+ meta?: ApiMeta;
470
+ }
471
+ ```
472
+
473
+ #### `PaginatedResponse<T>`
474
+
475
+ Paginated API response. Extends `ApiResponse<T[]>` with required pagination metadata.
476
+
477
+ ```ts
478
+ interface PaginatedResponse<T> extends ApiResponse<T[]> {
479
+ meta: ApiMeta & PaginationMeta;
480
+ }
481
+ ```
482
+
483
+ #### `ApiMeta`
484
+
485
+ ```ts
486
+ interface ApiMeta {
487
+ timestamp: string;
488
+ requestId?: string;
489
+ }
490
+ ```
491
+
492
+ #### `PaginationMeta`
493
+
494
+ ```ts
495
+ interface PaginationMeta {
496
+ page: number;
497
+ pageSize: number;
498
+ totalItems: number;
499
+ totalPages: number;
500
+ }
501
+ ```
502
+
503
+ #### `ApiError`
504
+
505
+ ```ts
506
+ interface ApiError {
507
+ code: string;
508
+ message: string;
509
+ details?: Record<string, unknown>;
510
+ }
511
+ ```
512
+
513
+ ### Entity Interfaces
514
+
515
+ #### `BaseEntity`
516
+
517
+ ```ts
518
+ interface BaseEntity {
519
+ id: string;
520
+ createdAt: string;
521
+ updatedAt: string;
522
+ }
523
+ ```
524
+
525
+ #### `Identifiable`
526
+
527
+ ```ts
528
+ interface Identifiable {
529
+ id: string;
530
+ }
531
+ ```
532
+
533
+ #### `SoftDeletable`
534
+
535
+ ```ts
536
+ interface SoftDeletable {
537
+ deletedAt?: string;
538
+ isDeleted: boolean;
539
+ }
540
+ ```
541
+
542
+ **Usage:**
543
+
544
+ ```ts
545
+ import type { BaseEntity, SoftDeletable } from 'u-maps/types';
546
+
547
+ interface User extends BaseEntity, SoftDeletable {
548
+ name: string;
549
+ email: string;
550
+ }
551
+ ```
552
+
553
+ ---
554
+
555
+ ## Full Setup Example
556
+
557
+ ```ts
558
+ // app.config.ts
559
+ import { ApplicationConfig } from '@angular/core';
560
+ import { provideHttpClient } from '@angular/common/http';
561
+ import { API_URL, APP_CONFIG, type AppConfig } from 'u-maps/angular';
562
+
563
+ const config: AppConfig = {
564
+ apiUrl: 'https://api.u-maps.uz/v1',
565
+ production: true,
566
+ };
567
+
568
+ export const appConfig: ApplicationConfig = {
569
+ providers: [
570
+ provideHttpClient(),
571
+ { provide: API_URL, useValue: config.apiUrl },
572
+ { provide: APP_CONFIG, useValue: config },
573
+ ],
574
+ };
575
+ ```
576
+
577
+ ```ts
578
+ // user.service.ts
579
+ import { Injectable, inject } from '@angular/core';
580
+ import { HttpService } from 'u-maps/angular';
581
+ import type { BaseEntity } from 'u-maps/types';
582
+
583
+ interface User extends BaseEntity {
584
+ name: string;
585
+ email: string;
586
+ }
587
+
588
+ @Injectable({ providedIn: 'root' })
589
+ export class UserService {
590
+ private http = inject(HttpService);
591
+
592
+ getAll(page: number) { return this.http.getList<User>('/users', { params: { page } }); }
593
+ getById(id: string) { return this.http.get<User>(`/users/${id}`); }
594
+ create(body: Partial<User>) { return this.http.post<User>('/users', body); }
595
+ update(id: string, body: Partial<User>) { return this.http.put<User>(`/users/${id}`, body); }
596
+ remove(id: string) { return this.http.delete<void>(`/users/${id}`); }
597
+ }
598
+ ```
599
+
600
+ ```ts
601
+ // users.component.ts
602
+ import { Component, inject } from '@angular/core';
603
+ import { createLoadingState, handleError } from 'u-maps/angular';
604
+ import { UserService } from './user.service';
605
+
606
+ @Component({ ... })
607
+ export class UsersComponent {
608
+ private userService = inject(UserService);
609
+ state = createLoadingState<User[]>();
610
+
611
+ constructor() {
612
+ this.load();
613
+ }
614
+
615
+ load() {
616
+ this.state.setLoading(true);
617
+ this.userService.getAll(1).pipe(
618
+ handleError({ data: [], meta: { timestamp: '', page: 1, pageSize: 10, totalItems: 0, totalPages: 0 } }),
619
+ ).subscribe(res => this.state.set(res.data));
620
+ }
621
+ }
622
+ ```
623
+
624
+ ---
625
+
626
+ ## Commands
627
+
628
+ ```bash
629
+ npx nx build u-mapsnpm # Build
630
+ npx nx test u-mapsnpm # Test (52 tests)
631
+ npm run publish:pkg # Build + publish to npm
632
+ ```
633
+
634
+ ## License
635
+
636
+ MIT
@@ -0,0 +1,36 @@
1
+ import { Subject, type MonoTypeOperatorFunction } from 'rxjs';
2
+ /**
3
+ * Creates an auto-cleanup Subject tied to the current injection context's DestroyRef.
4
+ *
5
+ * Use inside `inject()` context (constructor, field initializer, or runInInjectionContext).
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * export class MyComponent {
10
+ * private destroy$ = injectDestroy();
11
+ *
12
+ * ngOnInit() {
13
+ * someObs$.pipe(takeUntil(this.destroy$)).subscribe();
14
+ * }
15
+ * }
16
+ * ```
17
+ */
18
+ export declare function injectDestroy(): Subject<void>;
19
+ /**
20
+ * RxJS operator that auto-unsubscribes when the injection context is destroyed.
21
+ *
22
+ * Must be called inside an injection context.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * export class MyComponent {
27
+ * private untilDestroyed = takeUntilDestroyed();
28
+ *
29
+ * ngOnInit() {
30
+ * someObs$.pipe(this.untilDestroyed).subscribe();
31
+ * }
32
+ * }
33
+ * ```
34
+ */
35
+ export declare function takeUntilDestroyed<T>(): MonoTypeOperatorFunction<T>;
36
+ //# sourceMappingURL=destroy.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destroy.helper.d.ts","sourceRoot":"","sources":["../../../src/angular/helpers/destroy.helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,MAAM,CAAC;AAG9D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAU7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,KAAK,wBAAwB,CAAC,CAAC,CAAC,CAGnE"}
@@ -0,0 +1,49 @@
1
+ import { DestroyRef, inject } from '@angular/core';
2
+ import { Subject } from 'rxjs';
3
+ import { takeUntil } from 'rxjs/operators';
4
+ /**
5
+ * Creates an auto-cleanup Subject tied to the current injection context's DestroyRef.
6
+ *
7
+ * Use inside `inject()` context (constructor, field initializer, or runInInjectionContext).
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * export class MyComponent {
12
+ * private destroy$ = injectDestroy();
13
+ *
14
+ * ngOnInit() {
15
+ * someObs$.pipe(takeUntil(this.destroy$)).subscribe();
16
+ * }
17
+ * }
18
+ * ```
19
+ */
20
+ export function injectDestroy() {
21
+ const destroy$ = new Subject();
22
+ const destroyRef = inject(DestroyRef);
23
+ destroyRef.onDestroy(() => {
24
+ destroy$.next();
25
+ destroy$.complete();
26
+ });
27
+ return destroy$;
28
+ }
29
+ /**
30
+ * RxJS operator that auto-unsubscribes when the injection context is destroyed.
31
+ *
32
+ * Must be called inside an injection context.
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * export class MyComponent {
37
+ * private untilDestroyed = takeUntilDestroyed();
38
+ *
39
+ * ngOnInit() {
40
+ * someObs$.pipe(this.untilDestroyed).subscribe();
41
+ * }
42
+ * }
43
+ * ```
44
+ */
45
+ export function takeUntilDestroyed() {
46
+ const destroy$ = injectDestroy();
47
+ return (source) => source.pipe(takeUntil(destroy$));
48
+ }
49
+ //# sourceMappingURL=destroy.helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destroy.helper.js","sourceRoot":"","sources":["../../../src/angular/helpers/destroy.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,EAAiC,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;IACrC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAEtC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE;QACxB,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChB,QAAQ,CAAC,QAAQ,EAAE,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { type OperatorFunction } from 'rxjs';
2
+ /**
3
+ * Result type for mapResponse — discriminated union for success/error.
4
+ */
5
+ export type ResponseResult<T> = {
6
+ success: true;
7
+ data: T;
8
+ } | {
9
+ success: false;
10
+ error: unknown;
11
+ };
12
+ /**
13
+ * Maps an Observable into a discriminated success/error result.
14
+ *
15
+ * Catches errors and wraps them instead of letting the stream die.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * this.http.get<User[]>('/users').pipe(
20
+ * mapResponse(),
21
+ * ).subscribe(result => {
22
+ * if (result.success) console.log(result.data);
23
+ * else console.error(result.error);
24
+ * });
25
+ * ```
26
+ */
27
+ export declare function mapResponse<T>(): OperatorFunction<T, ResponseResult<T>>;
28
+ /**
29
+ * Catches errors and replaces the stream with a fallback value.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * this.http.get<User[]>('/users').pipe(
34
+ * handleError([]),
35
+ * ).subscribe(users => { ... });
36
+ * ```
37
+ */
38
+ export declare function handleError<T>(fallback: T): OperatorFunction<T, T>;
39
+ //# sourceMappingURL=rxjs.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rxjs.helpers.d.ts","sourceRoot":"","sources":["../../../src/angular/helpers/rxjs.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,gBAAgB,EAAQ,MAAM,MAAM,CAAC;AAIpE;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IACxB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAC1B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,KAAK,gBAAgB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAOvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAElE"}
@@ -0,0 +1,35 @@
1
+ import { pipe } from 'rxjs';
2
+ import { map, catchError } from 'rxjs/operators';
3
+ import { of } from 'rxjs';
4
+ /**
5
+ * Maps an Observable into a discriminated success/error result.
6
+ *
7
+ * Catches errors and wraps them instead of letting the stream die.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * this.http.get<User[]>('/users').pipe(
12
+ * mapResponse(),
13
+ * ).subscribe(result => {
14
+ * if (result.success) console.log(result.data);
15
+ * else console.error(result.error);
16
+ * });
17
+ * ```
18
+ */
19
+ export function mapResponse() {
20
+ return pipe(map((data) => ({ success: true, data })), catchError((error) => of({ success: false, error })));
21
+ }
22
+ /**
23
+ * Catches errors and replaces the stream with a fallback value.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * this.http.get<User[]>('/users').pipe(
28
+ * handleError([]),
29
+ * ).subscribe(users => { ... });
30
+ * ```
31
+ */
32
+ export function handleError(fallback) {
33
+ return catchError(() => of(fallback));
34
+ }
35
+ //# sourceMappingURL=rxjs.helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rxjs.helpers.js","sourceRoot":"","sources":["../../../src/angular/helpers/rxjs.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,IAAI,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAS1B;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,CACT,GAAG,CAAC,CAAC,IAAO,EAAqB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAC9D,UAAU,CAAC,CAAC,KAAc,EAAiC,EAAE,CAC3D,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAC9B,CACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAI,QAAW;IACxC,OAAO,UAAU,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AACxC,CAAC"}
@@ -1,4 +1,8 @@
1
1
  export { BaseService } from './services/base.service';
2
2
  export { HttpService, type RequestOptions } from './services/http.service';
3
3
  export { createLoadingState, type LoadingState } from './helpers/signal.helpers';
4
+ export { injectDestroy, takeUntilDestroyed } from './helpers/destroy.helper';
5
+ export { mapResponse, handleError, type ResponseResult } from './helpers/rxjs.helpers';
6
+ export { API_URL } from './tokens/api-url.token';
7
+ export { APP_CONFIG, type AppConfig } from './tokens/app-config.token';
4
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGvF,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,2BAA2B,CAAC"}
@@ -1,4 +1,11 @@
1
+ // Services
1
2
  export { BaseService } from './services/base.service';
2
3
  export { HttpService } from './services/http.service';
4
+ // Helpers
3
5
  export { createLoadingState } from './helpers/signal.helpers';
6
+ export { injectDestroy, takeUntilDestroyed } from './helpers/destroy.helper';
7
+ export { mapResponse, handleError } from './helpers/rxjs.helpers';
8
+ // Tokens
9
+ export { API_URL } from './tokens/api-url.token';
10
+ export { APP_CONFIG } from './tokens/app-config.token';
4
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAuB,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAqB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAuB,MAAM,yBAAyB,CAAC;AAE3E,UAAU;AACV,OAAO,EAAE,kBAAkB,EAAqB,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAuB,MAAM,wBAAwB,CAAC;AAEvF,SAAS;AACT,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAkB,MAAM,2BAA2B,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { HttpClient } from '@angular/common/http';
1
2
  import { Observable } from 'rxjs';
2
3
  import type { ApiResponse, PaginatedResponse } from '../types';
3
4
  export interface RequestOptions {
@@ -7,15 +8,30 @@ export interface RequestOptions {
7
8
  /**
8
9
  * Lightweight HTTP helper wrapping Angular's HttpClient.
9
10
  * Provides typed methods aligned with the shared ApiResponse envelope.
11
+ *
12
+ * Automatically prepends the API_URL token value to relative paths.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * @Injectable({ providedIn: 'root' })
17
+ * export class UserService extends HttpService {
18
+ * getUsers() {
19
+ * return this.get<User[]>('/users');
20
+ * }
21
+ * }
22
+ * ```
10
23
  */
11
24
  export declare class HttpService {
12
- private readonly http;
25
+ protected readonly http: HttpClient;
26
+ protected readonly apiUrl: string;
13
27
  get<T>(url: string, options?: RequestOptions): Observable<ApiResponse<T>>;
14
28
  getList<T>(url: string, options?: RequestOptions): Observable<PaginatedResponse<T>>;
15
29
  post<T>(url: string, body: unknown, options?: RequestOptions): Observable<ApiResponse<T>>;
16
30
  put<T>(url: string, body: unknown, options?: RequestOptions): Observable<ApiResponse<T>>;
17
31
  patch<T>(url: string, body: unknown, options?: RequestOptions): Observable<ApiResponse<T>>;
18
32
  delete<T>(url: string, options?: RequestOptions): Observable<ApiResponse<T>>;
33
+ protected resolveUrl(url: string): string;
19
34
  private buildParams;
35
+ private buildHeaders;
20
36
  }
21
37
  //# sourceMappingURL=http.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.service.d.ts","sourceRoot":"","sources":["../../../src/angular/services/http.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,qBACa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsB;IAE3C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAOzE,OAAO,CAAC,CAAC,EACP,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAOnC,IAAI,CAAC,CAAC,EACJ,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAO7B,GAAG,CAAC,CAAC,EACH,GAAG,EAAE,MAAM,E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C;IAOnC,IAAI,CAAC,CAAC,EACJ,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAO7B,GAAG,CAAC,CAAC,EACH,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAO7B,KAAK,CAAC,CAAC,EACL,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAO7B,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAO5E,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAOzC,OAAO,CAAC,WAAW;IAWnB,OAAO,CAAC,YAAY;CAMrB"}
@@ -5,49 +5,69 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { Injectable, inject } from '@angular/core';
8
- import { HttpClient, HttpParams } from '@angular/common/http';
8
+ import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
9
+ import { API_URL } from '../tokens/api-url.token';
9
10
  /**
10
11
  * Lightweight HTTP helper wrapping Angular's HttpClient.
11
12
  * Provides typed methods aligned with the shared ApiResponse envelope.
13
+ *
14
+ * Automatically prepends the API_URL token value to relative paths.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * @Injectable({ providedIn: 'root' })
19
+ * export class UserService extends HttpService {
20
+ * getUsers() {
21
+ * return this.get<User[]>('/users');
22
+ * }
23
+ * }
24
+ * ```
12
25
  */
13
26
  let HttpService = class HttpService {
14
27
  http = inject(HttpClient);
28
+ apiUrl = inject(API_URL, { optional: true }) ?? '';
15
29
  get(url, options) {
16
- return this.http.get(url, {
30
+ return this.http.get(this.resolveUrl(url), {
17
31
  params: this.buildParams(options?.params),
18
- headers: options?.headers,
32
+ headers: this.buildHeaders(options?.headers),
19
33
  });
20
34
  }
21
35
  getList(url, options) {
22
- return this.http.get(url, {
36
+ return this.http.get(this.resolveUrl(url), {
23
37
  params: this.buildParams(options?.params),
24
- headers: options?.headers,
38
+ headers: this.buildHeaders(options?.headers),
25
39
  });
26
40
  }
27
41
  post(url, body, options) {
28
- return this.http.post(url, body, {
42
+ return this.http.post(this.resolveUrl(url), body, {
29
43
  params: this.buildParams(options?.params),
30
- headers: options?.headers,
44
+ headers: this.buildHeaders(options?.headers),
31
45
  });
32
46
  }
33
47
  put(url, body, options) {
34
- return this.http.put(url, body, {
48
+ return this.http.put(this.resolveUrl(url), body, {
35
49
  params: this.buildParams(options?.params),
36
- headers: options?.headers,
50
+ headers: this.buildHeaders(options?.headers),
37
51
  });
38
52
  }
39
53
  patch(url, body, options) {
40
- return this.http.patch(url, body, {
54
+ return this.http.patch(this.resolveUrl(url), body, {
41
55
  params: this.buildParams(options?.params),
42
- headers: options?.headers,
56
+ headers: this.buildHeaders(options?.headers),
43
57
  });
44
58
  }
45
59
  delete(url, options) {
46
- return this.http.delete(url, {
60
+ return this.http.delete(this.resolveUrl(url), {
47
61
  params: this.buildParams(options?.params),
48
- headers: options?.headers,
62
+ headers: this.buildHeaders(options?.headers),
49
63
  });
50
64
  }
65
+ resolveUrl(url) {
66
+ if (url.startsWith('http://') || url.startsWith('https://')) {
67
+ return url;
68
+ }
69
+ return `${this.apiUrl}${url}`;
70
+ }
51
71
  buildParams(params) {
52
72
  if (!params)
53
73
  return undefined;
@@ -57,6 +77,11 @@ let HttpService = class HttpService {
57
77
  }
58
78
  return httpParams;
59
79
  }
80
+ buildHeaders(headers) {
81
+ if (!headers)
82
+ return undefined;
83
+ return new HttpHeaders(headers);
84
+ }
60
85
  };
61
86
  HttpService = __decorate([
62
87
  Injectable({ providedIn: 'root' })
@@ -1 +1 @@
1
- {"version":3,"file":"http.service.js","sourceRoot":"","sources":["../../../src/angular/services/http.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAS9D;;;GAGG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAW;IACL,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAE3C,GAAG,CAAI,GAAW,EAAE,OAAwB;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,GAAG,EAAE;YACxC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;YACzC,OAAO,EAAE,OAAO,EAAE,OAAO;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CACL,GAAW,EACX,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAuB,GAAG,EAAE;YAC9C,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;YACzC,OAAO,EAAE,OAAO,EAAE,OAAO;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CACF,GAAW,EACX,IAAa,EACb,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAiB,GAAG,EAAE,IAAI,EAAE;YAC/C,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;YACzC,OAAO,EAAE,OAAO,EAAE,OAAO;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,GAAG,CACD,GAAW,EACX,IAAa,EACb,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAiB,GAAG,EAAE,IAAI,EAAE;YAC9C,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;YACzC,OAAO,EAAE,OAAO,EAAE,OAAO;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CACH,GAAW,EACX,IAAa,EACb,OAAwB;QAExB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAiB,GAAG,EAAE,IAAI,EAAE;YAChD,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;YACzC,OAAO,EAAE,OAAO,EAAE,OAAO;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAI,GAAW,EAAE,OAAwB;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAiB,GAAG,EAAE;YAC3C,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC;YACzC,OAAO,EAAE,OAAO,EAAE,OAAO;SAC1B,CAAC,CAAC;IACL,CAAC;IAEO,WAAW,CACjB,MAAkD;QAElD,IAAI,CAAC,MAAM;YAAE,OAAO,SAAS,CAAC;QAC9B,IAAI,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;QAClC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;CACF,CAAA;AAtEY,WAAW;IADvB,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;GACtB,WAAW,CAsEvB"}
1
+ {"version":3,"file":"http.service.js","sourceRoot":"","sources":["../../../src/angular/services/http.service.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE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AE,CAAC;QAClC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAClD,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC;IAEO,YAAY,CAClB,OAAgC;QAEhC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;CACF,CAAA;AArFY,WAAW;IADvB,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;GACtB,WAAW,CAqFvB"}
@@ -0,0 +1,16 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * Token for the base API URL.
4
+ *
5
+ * Provide this at the application root to configure all services
6
+ * that depend on a backend endpoint.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * providers: [
11
+ * { provide: API_URL, useValue: 'https://api.example.com/v1' },
12
+ * ]
13
+ * ```
14
+ */
15
+ export declare const API_URL: InjectionToken<string>;
16
+ //# sourceMappingURL=api-url.token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-url.token.d.ts","sourceRoot":"","sources":["../../../src/angular/tokens/api-url.token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,wBAAwC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * Token for the base API URL.
4
+ *
5
+ * Provide this at the application root to configure all services
6
+ * that depend on a backend endpoint.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * providers: [
11
+ * { provide: API_URL, useValue: 'https://api.example.com/v1' },
12
+ * ]
13
+ * ```
14
+ */
15
+ export const API_URL = new InjectionToken('API_URL');
16
+ //# sourceMappingURL=api-url.token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-url.token.js","sourceRoot":"","sources":["../../../src/angular/tokens/api-url.token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,cAAc,CAAS,SAAS,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * Application-wide configuration shape.
4
+ * Consumers extend this interface for project-specific fields.
5
+ */
6
+ export interface AppConfig {
7
+ apiUrl: string;
8
+ production: boolean;
9
+ [key: string]: unknown;
10
+ }
11
+ /**
12
+ * Token for application configuration.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const config: AppConfig = { apiUrl: '/api', production: true };
17
+ * providers: [
18
+ * { provide: APP_CONFIG, useValue: config },
19
+ * ]
20
+ * ```
21
+ */
22
+ export declare const APP_CONFIG: InjectionToken<AppConfig>;
23
+ //# sourceMappingURL=app-config.token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-config.token.d.ts","sourceRoot":"","sources":["../../../src/angular/tokens/app-config.token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,2BAA8C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ /**
3
+ * Token for application configuration.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const config: AppConfig = { apiUrl: '/api', production: true };
8
+ * providers: [
9
+ * { provide: APP_CONFIG, useValue: config },
10
+ * ]
11
+ * ```
12
+ */
13
+ export const APP_CONFIG = new InjectionToken('APP_CONFIG');
14
+ //# sourceMappingURL=app-config.token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-config.token.js","sourceRoot":"","sources":["../../../src/angular/tokens/app-config.token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAY/C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,cAAc,CAAY,YAAY,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { API_URL } from './api-url.token';
2
+ export { APP_CONFIG, type AppConfig } from './app-config.token';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/angular/tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { API_URL } from './api-url.token';
2
+ export { APP_CONFIG } from './app-config.token';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/tokens/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAkB,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import 'zone.js';
2
+ import '@angular/compiler';
3
+ //# sourceMappingURL=test-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AACjB,OAAO,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import 'zone.js';
2
+ import '@angular/compiler';
3
+ //# sourceMappingURL=test-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AACjB,OAAO,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u-mapsnpm",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Core utilities, Angular helpers, and shared types for U-Maps platform",
5
5
  "type": "module",
6
6
  "main": "./dist/core/index.js",
@@ -25,7 +25,7 @@
25
25
  "keywords": ["u-maps", "utils", "angular", "typescript", "signals", "http"],
26
26
  "repository": {
27
27
  "type": "git",
28
- "url": "https://github.com/AkbarDAfwormo/u-maps-npm"
28
+ "url": "https://u-gitlab.uzinfocom.uz/u-maps/frontend/u-maps-npm"
29
29
  },
30
30
  "scripts": {
31
31
  "build": "tsc -p tsconfig.lib.json",