@experteam-mx/ngx-services 20.1.5 → 20.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -12
- package/fesm2022/experteam-mx-ngx-services.mjs +252 -428
- package/fesm2022/experteam-mx-ngx-services.mjs.map +1 -1
- package/index.d.ts +113 -135
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,24 +1,80 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @experteam-mx/ngx-services
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Common Angular services used across Experteam applications.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Standalone setup (Angular v20+)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Use `provideNgxServices(environment)` in your `ApplicationConfig.providers`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { provideHttpClient, withInterceptors } from '@angular/common/http'
|
|
11
|
+
import type { ApplicationConfig } from '@angular/core'
|
|
12
|
+
import { provideRouter } from '@angular/router'
|
|
13
|
+
import {
|
|
14
|
+
apiHeadersInterceptor,
|
|
15
|
+
apiTokenInterceptor,
|
|
16
|
+
httpCachingInterceptor,
|
|
17
|
+
provideNgxServices,
|
|
18
|
+
type Environment
|
|
19
|
+
} from '@experteam-mx/ngx-services'
|
|
20
|
+
import { environment } from '../environments/environment'
|
|
21
|
+
import { routes } from './app.routes'
|
|
22
|
+
|
|
23
|
+
const envs = {
|
|
24
|
+
...environment,
|
|
25
|
+
authCookie: 'token',
|
|
26
|
+
cacheTtl: 3000
|
|
27
|
+
} as Environment
|
|
28
|
+
|
|
29
|
+
export const appConfig: ApplicationConfig = {
|
|
30
|
+
providers: [
|
|
31
|
+
provideRouter(routes),
|
|
32
|
+
provideNgxServices(envs),
|
|
33
|
+
provideHttpClient(withInterceptors([
|
|
34
|
+
apiHeadersInterceptor,
|
|
35
|
+
apiTokenInterceptor,
|
|
36
|
+
httpCachingInterceptor
|
|
37
|
+
]))
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`provideNgxServices` registers `ENVIRONMENT_TOKEN`, which is required by the API services and some interceptors in this package.
|
|
43
|
+
|
|
44
|
+
## NgModule compatibility
|
|
45
|
+
|
|
46
|
+
`NgxServicesModule.forRoot(environment)` is still available for compatibility, but it is deprecated for new standalone applications and will be removed in `20.2.0`.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { importProvidersFrom } from '@angular/core'
|
|
50
|
+
import { NgxServicesModule } from '@experteam-mx/ngx-services'
|
|
51
|
+
|
|
52
|
+
providers: [
|
|
53
|
+
importProvidersFrom([NgxServicesModule.forRoot(envs)])
|
|
54
|
+
]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Prefer `provideNgxServices(envs)` for all new apps.
|
|
9
58
|
|
|
10
59
|
## Build
|
|
11
60
|
|
|
12
|
-
|
|
61
|
+
```bash
|
|
62
|
+
ng build @experteam-mx/ngx-services
|
|
63
|
+
```
|
|
13
64
|
|
|
14
|
-
|
|
65
|
+
Build output:
|
|
15
66
|
|
|
16
|
-
|
|
67
|
+
`dist/experteam-mx/ngx-services`
|
|
17
68
|
|
|
18
|
-
##
|
|
69
|
+
## Publish
|
|
19
70
|
|
|
20
|
-
|
|
71
|
+
```bash
|
|
72
|
+
cd dist/experteam-mx/ngx-services
|
|
73
|
+
npm publish
|
|
74
|
+
```
|
|
21
75
|
|
|
22
|
-
##
|
|
76
|
+
## Test
|
|
23
77
|
|
|
24
|
-
|
|
78
|
+
```bash
|
|
79
|
+
ng test @experteam-mx/ngx-services
|
|
80
|
+
```
|