@klerick/json-api-nestjs-sdk 10.0.0-beta.2 → 10.0.0-beta.3

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/cjs/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klerick/json-api-nestjs-sdk",
3
- "version": "10.0.0-beta.2",
3
+ "version": "10.0.0-beta.3",
4
4
  "description": "Helper for client JsonAPi Plugin for NestJs",
5
5
  "keywords": [
6
6
  "nestjs",
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  "peerDependencies": {
51
- "@klerick/json-api-nestjs-shared": "1.0.0-beta.2",
51
+ "@klerick/json-api-nestjs-shared": "1.0.0-beta.3",
52
52
  "ts-toolbelt": "9.6.0"
53
53
  },
54
54
  "type": "commonjs"
package/mjs/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klerick/json-api-nestjs-sdk",
3
- "version": "10.0.0-beta.2",
3
+ "version": "10.0.0-beta.3",
4
4
  "description": "Helper for client JsonAPi Plugin for NestJs",
5
5
  "keywords": [
6
6
  "nestjs",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  },
52
52
  "peerDependencies": {
53
- "@klerick/json-api-nestjs-shared": "1.0.0-beta.2",
53
+ "@klerick/json-api-nestjs-shared": "1.0.0-beta.3",
54
54
  "ts-toolbelt": "9.6.0"
55
55
  },
56
56
  "type": "module"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klerick/json-api-nestjs-sdk",
3
- "version": "10.0.0-beta.2",
3
+ "version": "10.0.0-beta.3",
4
4
  "description": "Helper for client JsonAPi Plugin for NestJs",
5
5
  "keywords": [
6
6
  "nestjs",
@@ -48,7 +48,7 @@
48
48
  }
49
49
  },
50
50
  "peerDependencies": {
51
- "@klerick/json-api-nestjs-shared": "^1.0.0-beta.2"
51
+ "@klerick/json-api-nestjs-shared": "^1.0.0-beta.3"
52
52
  },
53
53
  "type": "commonjs",
54
54
  "license": "MIT",
package/CHANGELOG.md DELETED
@@ -1,58 +0,0 @@
1
- ## 10.0.0-beta.0 (2025-05-21)
2
-
3
- This was a version bump only for json-api-nestjs-sdk to align it with other projects, there were no code changes.
4
-
5
- # 9.0.0 (2025-02-12)
6
-
7
- This was a version bump only for json-api-nestjs-sdk to align it with other projects, there were no code changes.
8
-
9
- # 8.0.0 (2024-12-18)
10
-
11
- ### 🚀 Features
12
-
13
- - **json-api-nestjs-sdk,nestjs-json-rpc-sdk:** Change export ([7953371](https://github.com/klerick/nestjs-json-api/commit/7953371))
14
- - **nestjs-json-rpc-sdk:** Skip empty element in response ([28d3efc](https://github.com/klerick/nestjs-json-api/commit/28d3efc))
15
-
16
- ### 🩹 Fixes
17
-
18
- - **json-api-nestjs-sdk:** Fix check for relation and add type for meta data ([9bbe9fd](https://github.com/klerick/nestjs-json-api/commit/9bbe9fd))
19
-
20
- ### ❤️ Thank You
21
-
22
- - Alex H
23
-
24
- ## 7.0.1 (2024-04-21)
25
-
26
-
27
- ### 🩹 Fixes
28
-
29
- - **json-api-nestjs:** Fix validate for patch method ([40b0303](https://github.com/klerick/nestjs-json-api/commit/40b0303))
30
-
31
- - **json-api-nestjs:** Fix validate for patch method ([2caa2d8](https://github.com/klerick/nestjs-json-api/commit/2caa2d8))
32
-
33
- - **json-api-nestjs:** Allow empty atributes for sdk ([c3cc4a5](https://github.com/klerick/nestjs-json-api/commit/c3cc4a5))
34
-
35
- - **json-api-nestjs:** Allow empty atributes for sdk ([3101fca](https://github.com/klerick/nestjs-json-api/commit/3101fca))
36
-
37
- - **json-api-nestjs-sdk:** Allow empty atrributes for sdk ([c4b2675](https://github.com/klerick/nestjs-json-api/commit/c4b2675))
38
-
39
-
40
- ### ❤️ Thank You
41
-
42
- - Alex H
43
-
44
- # 7.0.0 (2024-03-08)
45
-
46
-
47
- ### 🚀 Features
48
-
49
- - ⚠️ **json-api-nestjs-sdk:** New version sdk for json api ([f65ca03](https://github.com/klerick/nestjs-json-api/commit/f65ca03))
50
-
51
-
52
- #### ⚠️ Breaking Changes
53
-
54
- - **json-api-nestjs-sdk:** - add support native js
55
-
56
- ### ❤️ Thank You
57
-
58
- - Alex H
package/README.md DELETED
@@ -1,154 +0,0 @@
1
- <p align='center'>
2
- <a href="https://www.npmjs.com/package/json-api-nestjs-sdk" target="_blank"><img src="https://img.shields.io/npm/v/json-api-nestjs-sdk.svg" alt="NPM Version" /></a>
3
- <a href="https://www.npmjs.com/package/json-api-nestjs-sdk" target="_blank"><img src="https://img.shields.io/npm/l/json-api-nestjs-sdk.svg" alt="Package License" /></a>
4
- <a href="https://www.npmjs.com/package/json-api-nestjs-sdk" target="_blank"><img src="https://img.shields.io/npm/dm/json-api-nestjs-sdk.svg" alt="NPM Downloads" /></a>
5
- <a href="http://commitizen.github.io/cz-cli/" target="_blank"><img src="https://img.shields.io/badge/commitizen-friendly-brightgreen.svg" alt="Commitizen friendly" /></a>
6
- <img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/klerick/02a4c98cf7008fea2af70dc2d50f4cb7/raw/json-api-nestjs-sdk.json" alt="Coverage Badge" />
7
- </p>
8
-
9
- # json-api-nestjs-sdk
10
-
11
- The plugin of client for help work with JSON API over [json-api-nestjs](https://www.npmjs.com/package/json-api-nestjs)
12
-
13
-
14
- ## Installation
15
-
16
- ```bash $
17
- npm install @klerick/json-api-nestjs-sdk
18
- ```
19
-
20
- ## Example
21
-
22
- Once the installation process is complete, we can import the **JsonApiJs**.
23
-
24
- ```typescript
25
- import {
26
- adapterForAxios,
27
- FilterOperand,
28
- JsonApiJs,
29
- JsonSdkPromise,
30
- } from '@klerick/json-api-nestjs-sdk';
31
- import { faker } from '@faker-js/faker';
32
- import axios from 'axios';
33
-
34
- import {Users} from 'database'
35
-
36
- const axiosAdapter = adapterForAxios(axios);
37
-
38
- const jsonConfig: JsonConfig = {
39
- adapter: axiosAdapter,
40
- apiHost: 'http://localhost:3000',
41
- apiPrefix: 'api',
42
- dateFields: ['createdAt', 'updatedAt'],
43
- operationUrl: 'operation',
44
- }
45
-
46
- const jsonSdk = JsonApiJs(
47
- jsonConfig,
48
- true //by default all methods return Observable but you return promise
49
- );
50
-
51
- await jsonSdk.jonApiSdkService.getAll(Users, {
52
- filter: {
53
- target: {
54
- id: { [FilterOperand.in]: usersId.map((i) => `${i}`) },
55
- },
56
- },
57
- include: ['addresses', 'comments', 'roles', 'manager'],
58
- });
59
-
60
-
61
- // Atomic Operation
62
-
63
- const address = new Addresses();
64
-
65
- address.city = faker.string.alpha(50);
66
- address.state = faker.string.alpha(50);
67
- address.country = faker.string.alpha(50);
68
- address.id = 10000;
69
-
70
- const manager = getUser();
71
- manager.id = 10001;
72
- manager.addresses = address;
73
-
74
- const roles = new Roles();
75
- roles.id = 10002;
76
- roles.name = faker.string.alpha(50);
77
- roles.key = faker.string.alpha(50);
78
-
79
- const user = getUser();
80
- user.addresses = address;
81
- user.manager = manager;
82
- user.roles = [roles];
83
-
84
- const [addressPost, managerPost, rolesPost, userPost] = await jsonSdk
85
- .atomicFactory()
86
- .postOne(address)
87
- .postOne(manager)
88
- .postOne(roles)
89
- .postOne(user)
90
- .run();
91
-
92
-
93
- ```
94
- or you can use Angular module:
95
- ```typescript
96
- import {
97
- provideJsonApi,
98
- AtomicFactory,
99
- JsonApiSdkService
100
- } from '@klerick/json-api-nestjs-sdk/ngModule';
101
- import {
102
- provideHttpClient,
103
- withFetch,
104
- } from '@angular/common/http';
105
-
106
- @Component({
107
- standalone: true,
108
- selector: 'nestjs-json-api-root',
109
- templateUrl: './app.component.html',
110
- styleUrl: './app.component.css',
111
- })
112
- export class AppComponent {
113
- private JsonApiSdkService = inject(JsonApiSdkService);
114
- private atomicFactory = inject(AtomicFactory);
115
- }
116
-
117
- const angularConfig: JsonSdkConfig = {
118
- apiHost: 'http://localhost:4200',
119
- idKey: 'id',
120
- apiPrefix: 'api',
121
- operationUrl: 'operation',
122
- }
123
-
124
- bootstrapApplication(AppComponent, {
125
- providers: [
126
- provideHttpClient(withFetch()),
127
- provideJsonApi(angularConfig)
128
- ],
129
- }).catch((err) =>
130
- console.error(err)
131
- );
132
-
133
-
134
-
135
- ```
136
-
137
- ## Configuration params
138
-
139
- ```typescript
140
- type JsonSdkConfig = {
141
- apiHost: string; // url for api
142
- apiPrefix?: string; // prefex for api - api/v1/....
143
- idKey?: string; // name for id field
144
- idIsNumber?: boolean; // use parseInt for id field
145
- operationUrl?: string; // url for atomic operation
146
- dateFields: string[] // array of dateField for create date object - ;
147
- }
148
-
149
- type JsonConfig = JsonSdkConfig & {
150
- adapter?: HttpInnerClient; // by default use fetch for http request but you can change it
151
- }
152
- ```
153
- * You can see interface of [HttpInnerClient](https://github.com/klerick/nestjs-json-api/blob/master/libs/json-api/json-api-nestjs-sdk/src/lib/types/http-inner-client.ts)
154
- * More example you can see [here](https://github.com/klerick/nestjs-json-api/blob/master/apps/json-api-server-e2e/src/json-api/json-api-sdk) or [here](https://github.com/klerick/nestjs-json-api/blob/master/apps/json-api-front/src/app/app.component.ts)