@experteam-mx/ngx-services 20.1.17-alpha.1 → 20.1.17-dev1.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.
- package/README.md +80 -80
- package/fesm2022/experteam-mx-ngx-services.mjs +30 -0
- package/fesm2022/experteam-mx-ngx-services.mjs.map +1 -1
- package/index.d.ts +76 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
# @experteam-mx/ngx-services
|
|
2
|
-
|
|
3
|
-
Common Angular services used across Experteam applications.
|
|
4
|
-
|
|
5
|
-
## Standalone setup (Angular v20+)
|
|
6
|
-
|
|
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.
|
|
58
|
-
|
|
59
|
-
## Build
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
ng build @experteam-mx/ngx-services
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Build output:
|
|
66
|
-
|
|
67
|
-
`dist/experteam-mx/ngx-services`
|
|
68
|
-
|
|
69
|
-
## Publish
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
cd dist/experteam-mx/ngx-services
|
|
73
|
-
npm publish
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Test
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
ng test @experteam-mx/ngx-services
|
|
80
|
-
```
|
|
1
|
+
# @experteam-mx/ngx-services
|
|
2
|
+
|
|
3
|
+
Common Angular services used across Experteam applications.
|
|
4
|
+
|
|
5
|
+
## Standalone setup (Angular v20+)
|
|
6
|
+
|
|
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.
|
|
58
|
+
|
|
59
|
+
## Build
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
ng build @experteam-mx/ngx-services
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Build output:
|
|
66
|
+
|
|
67
|
+
`dist/experteam-mx/ngx-services`
|
|
68
|
+
|
|
69
|
+
## Publish
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cd dist/experteam-mx/ngx-services
|
|
73
|
+
npm publish
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Test
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
ng test @experteam-mx/ngx-services
|
|
80
|
+
```
|
|
@@ -1563,6 +1563,36 @@ class ApiCompaniesService {
|
|
|
1563
1563
|
return this.http.put(`${this.url}/accounts/${id}`, body)
|
|
1564
1564
|
.pipe(map(({ data }) => data));
|
|
1565
1565
|
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Updates the status of an account.
|
|
1568
|
+
*
|
|
1569
|
+
* This method sends an HTTP PATCH request to the accounts endpoint
|
|
1570
|
+
* in order to activate or deactivate a specific account.
|
|
1571
|
+
*
|
|
1572
|
+
* @param id Unique identifier of the account.
|
|
1573
|
+
* @param isActive Status to assign to the account.
|
|
1574
|
+
* - `true`: activates the account.
|
|
1575
|
+
* - `false`: deactivates the account.
|
|
1576
|
+
*/
|
|
1577
|
+
patchAccount(id, isActive) {
|
|
1578
|
+
return this.http.patch(`${this.url}/accounts/${id}`, {
|
|
1579
|
+
is_active: isActive
|
|
1580
|
+
})
|
|
1581
|
+
.pipe(map(({ data }) => data));
|
|
1582
|
+
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Retrieves the list of active accounts.
|
|
1585
|
+
*
|
|
1586
|
+
* This method sends an HTTP GET request to the active accounts endpoint,
|
|
1587
|
+
* allowing query parameters for filtering or pagination.
|
|
1588
|
+
*
|
|
1589
|
+
* @param params Query parameters used to filter
|
|
1590
|
+
* or paginate the results.
|
|
1591
|
+
*/
|
|
1592
|
+
getAccountsActives(params) {
|
|
1593
|
+
return this.http.get(`${this.url}/accounts/actives`, { params })
|
|
1594
|
+
.pipe(map(({ data }) => data));
|
|
1595
|
+
}
|
|
1566
1596
|
/**
|
|
1567
1597
|
* Fetches account entity data from the server based on the provided query parameters.
|
|
1568
1598
|
*
|