Skip to content

Commit 490b51f

Browse files
authored
Merge pull request #96 from klerick/some-fix-after-project
New Version:)
2 parents e405f37 + e76d32c commit 490b51f

File tree

86 files changed

+10514
-7861
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+10514
-7861
lines changed

.eslintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
"jest": true
3434
},
3535
"rules": {}
36+
},
37+
{
38+
"files": ["*.ts"],
39+
"rules": {
40+
"@angular-eslint/prefer-standalone": "off"
41+
}
3642
}
3743
],
3844
"extends": ["./.eslintrc.base.json"]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ testem.log
3939
Thumbs.db
4040

4141
.nx/cache
42+
.nx/workspace-data
4243
.angular
4344
.dev.env

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
/coverage
44
/.nx/cache
55
.angular
6+
7+
/.nx/workspace-data

README.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,10 @@ $ npm run seed:run
2323
## Running the example app
2424

2525
```bash
26-
# build plugin
27-
$ npm run json-api-nestjs:build
28-
2926
# dev server
30-
$ npm run example:serve
27+
$ npm run demo:json-api
3128

3229
```
33-
34-
## Test
35-
36-
```bash
37-
# unit tests
38-
$ nx test json-api-nestjs
39-
40-
# test coverage
41-
$ nx test json-api-nestjs --coverage
42-
```
43-
4430
## License
4531

4632
The plugin is [MIT licensed](LICENSE).

apps/json-api-front/.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"prefix": "nestjs-json-api",
2525
"style": "kebab-case"
2626
}
27-
]
27+
],
28+
"@angular-eslint/prefer-standalone": "off"
2829
}
2930
},
3031
{

apps/json-api-front/src/app/app.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { Component, inject, OnInit } from '@angular/core';
22
import { NxWelcomeComponent } from './nx-welcome.component';
33
import { JsonApiSdkService } from 'json-api-nestjs-sdk';
4-
import { AtomicFactory } from 'json-api-nestjs-sdk/json-api-nestjs-sdk.module';
4+
import { AtomicFactory } from 'json-api-nestjs-sdk/ngModule';
55
import {
66
JSON_RPC,
77
RPC_BATCH,
88
Rpc,
9-
} from '@klerick/nestjs-json-rpc-sdk/json-rpc-sdk.module';
9+
} from '@klerick/nestjs-json-rpc-sdk/ngModule';
1010

1111
import { RpcService as IRpcService } from '@nestjs-json-api/type-for-rpc';
1212
import { switchMap } from 'rxjs';
@@ -16,11 +16,11 @@ type RpcMap = {
1616
};
1717

1818
@Component({
19-
standalone: true,
2019
imports: [NxWelcomeComponent],
2120
selector: 'nestjs-json-api-root',
2221
templateUrl: './app.component.html',
2322
styleUrl: './app.component.css',
23+
standalone: true,
2424
})
2525
export class AppComponent implements OnInit {
2626
private JsonApiSdkService = inject(JsonApiSdkService);

apps/json-api-front/src/app/app.config.ts

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1+
import { ApplicationConfig, InjectionToken } from '@angular/core';
2+
import { provideJsonApi } from 'json-api-nestjs-sdk/ngModule';
13
import {
2-
ApplicationConfig,
3-
importProvidersFrom,
4-
InjectionToken,
5-
} from '@angular/core';
6-
import { JsonApiAngular } from 'json-api-nestjs-sdk/json-api-nestjs-sdk.module';
7-
import {
8-
JsonRpcAngular,
94
JsonRpcAngularConfig,
105
TransportType,
11-
} from '@klerick/nestjs-json-rpc-sdk/json-rpc-sdk.module';
6+
provideJsonRpc,
7+
} from '@klerick/nestjs-json-rpc-sdk/ngModule';
128
import { Subject } from 'rxjs';
139
import { webSocket } from 'rxjs/webSocket';
1410
import { io } from 'socket.io-client';
11+
import { provideHttpClient, withFetch } from '@angular/common/http';
1512

1613
const destroySubject = new Subject<boolean>();
1714
setTimeout(() => {
@@ -58,21 +55,18 @@ const ioConfig: JsonRpcAngularConfig = {
5855

5956
export const appConfig: ApplicationConfig = {
6057
providers: [
61-
importProvidersFrom(
62-
JsonApiAngular.forRoot({
63-
apiHost: 'http://localhost:4200',
64-
idKey: 'id',
65-
apiPrefix: 'api',
66-
operationUrl: 'operation',
67-
})
68-
),
69-
importProvidersFrom(
70-
JsonRpcAngular.forRoot(
71-
// httpConfig
72-
// wsConfig
73-
// wsConfigWithToken,
74-
ioConfig
75-
)
58+
provideHttpClient(withFetch()),
59+
provideJsonApi({
60+
apiHost: 'http://localhost:4200',
61+
idKey: 'id',
62+
apiPrefix: 'api',
63+
operationUrl: 'operation',
64+
}),
65+
provideJsonRpc(
66+
// httpConfig
67+
// wsConfig
68+
// wsConfigWithToken,
69+
ioConfig
7670
),
7771
],
7872
};

apps/json-api-front/src/app/nx-welcome.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { CommonModule } from '@angular/common';
33

44
@Component({
55
selector: 'nestjs-json-api-nx-welcome',
6-
standalone: true,
76
imports: [CommonModule],
7+
standalone: true,
88
template: `
99
<!--
1010
* * * * * * * * * * * * * * * * * * * * * * * * * * * *

apps/json-api-server-e2e/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
],
1414
"options": {
1515
"jestConfig": "apps/json-api-server-e2e/jest.config.ts",
16-
"passWithNoTests": true
16+
"passWithNoTests": true,
17+
"parallel": 1
1718
}
1819
}
1920
}

apps/json-api-server-e2e/src/json-api/json-api-sdk/atomic-sdk.spec.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,25 @@ describe('Atomic method:', () => {
8686
);
8787
}
8888

89-
await Promise.all(
90-
[...usersArray, ...addressArray, ...commentsArray, ...rolesArray].map(
91-
(i) => jsonSdk.jonApiSdkService.deleteOne(i)
92-
)
93-
);
89+
for (const item of [
90+
...usersArray,
91+
...addressArray,
92+
...commentsArray,
93+
...rolesArray,
94+
]) {
95+
await jsonSdk.jonApiSdkService.deleteOne(item);
96+
}
97+
});
98+
99+
it('Try check intreceptor', async () => {
100+
const newUser = getUser();
101+
newUser.addresses = addressArray[0];
102+
try {
103+
const result = await jsonSdk.atomicFactory().postOne(newUser).run();
104+
usersId.push(result[0].id);
105+
} catch (e) {
106+
console.log(e);
107+
}
94108
});
95109

96110
it('Should be correct work', async () => {

0 commit comments

Comments
 (0)