Skip to content

Commit 792bf2c

Browse files
committed
refactor(json-api-nestjs): Deep refactoring
BREAKING CHANGE: Now relation body params allow only as specification. https://jsonapi.org/format/#crud-updating-resource-relationships befoare allow without data props
1 parent 84f69ab commit 792bf2c

File tree

222 files changed

+18878
-57
lines changed

Some content is hidden

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

222 files changed

+18878
-57
lines changed

.verdaccio/config.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# path to a directory with all packages
2+
storage: ../tmp/local-registry/storage
3+
4+
# a list of other known repositories we can talk to
5+
uplinks:
6+
npmjs:
7+
url: https://registry.npmjs.org/
8+
maxage: 60m
9+
10+
packages:
11+
'**':
12+
# give all users (including non-authenticated users) full access
13+
# because it is a local registry
14+
access: $all
15+
publish: $all
16+
unpublish: $all
17+
18+
# if package is not available locally, proxy requests to npm registry
19+
proxy: npmjs
20+
21+
# log settings
22+
log:
23+
type: stdout
24+
format: pretty
25+
level: warn
26+
27+
publish:
28+
allow_offline: true # set offline to true to allow publish offline

docker-compose.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: '3.8'
2+
services:
3+
# api-gate:
4+
# container_name: api-gate
5+
# restart: always
6+
# build: apps/api-gate/
7+
# ports:
8+
# - "3000:3000"
9+
postgres:
10+
image: postgres:15.1-alpine
11+
restart: always
12+
environment:
13+
- POSTGRES_USER=postgres
14+
- POSTGRES_PASSWORD=postgres
15+
ports:
16+
- '5432:5432'
17+
volumes:
18+
- db:/var/lib/postgresql/data
19+
pgadmin:
20+
container_name: 'pgadmin'
21+
image: 'dpage/pgadmin4:latest'
22+
hostname: pgadmin
23+
depends_on:
24+
- 'postgres'
25+
environment:
26+
- PGADMIN_DEFAULT_PASSWORD=password
27+
28+
volumes:
29+
- pgadmin:/root/.pgadmin
30+
ports:
31+
- '8000:80'
32+
# redis:
33+
# image: redis:6.2-alpine
34+
# restart: always
35+
# ports:
36+
# - '6379:6379'
37+
# command: redis-server --save 20 1 --loglevel warning
38+
# volumes:
39+
# - redis:/data
40+
# jaeger:
41+
# image: jaegertracing/all-in-one:1.41
42+
# ports:
43+
# - "16686:16686"
44+
# - "14268:14268"
45+
volumes:
46+
db:
47+
driver: local
48+
# redis:
49+
# driver: local
50+
pgadmin:
51+
driver: local

libs/json-api/json-api-nestjs-sdk/src/lib/service/json-api-utils.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ export class JsonApiUtilsService {
338338
}
339339
return {
340340
...acum,
341-
[key]: data,
341+
[key]: { data },
342342
};
343343
}, {} as Relationships<E>);
344344

libs/json-api/json-api-nestjs-sdk/src/lib/types/query-params.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { QueryField } from 'json-shared-type';
1+
import { QueryField } from '@klerick/json-api-nestjs-shared';
22
import { EntityProps, EntityRelation } from './entity';
33
import { TypeOfArray } from './utils';
44
import { Operands, OperandsRelation } from './filter-operand';
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"extends": ["../../../.eslintrc.base.json"],
3+
"ignorePatterns": ["!**/*"],
4+
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"rules": {}
8+
},
9+
{
10+
"files": ["*.ts", "*.tsx"],
11+
"rules": {}
12+
},
13+
{
14+
"files": ["*.js", "*.jsx"],
15+
"rules": {}
16+
},
17+
{
18+
"files": ["*.json"],
19+
"parser": "jsonc-eslint-parser",
20+
"rules": {
21+
"@nx/dependency-checks": [
22+
"error",
23+
{
24+
"ignoredFiles": ["{projectRoot}/eslint.config.{js,cjs,mjs}"]
25+
}
26+
]
27+
}
28+
}
29+
]
30+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# json-api-nestjs-shared
2+
3+
This library was generated with [Nx](https://nx.dev).
4+
5+
## Building
6+
7+
Run `nx build json-api-nestjs-shared` to build the library.
8+
9+
## Running unit tests
10+
11+
Run `nx test json-api-nestjs-shared` to execute the unit tests via [Jest](https://jestjs.io).
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
displayName: 'json-api-nestjs-shared',
3+
preset: '../../../jest.preset.js',
4+
testEnvironment: 'node',
5+
transform: {
6+
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
7+
},
8+
moduleFileExtensions: ['ts', 'js', 'html'],
9+
coverageDirectory: '../../../coverage/libs/json-api/json-api-nestjs-shared',
10+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@klerick/json-api-nestjs-shared",
3+
"version": "0.0.1",
4+
"dependencies": {
5+
"tslib": "^2.3.0"
6+
},
7+
"type": "commonjs",
8+
"main": "./src/index.js",
9+
"typings": "./src/index.d.ts"
10+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "json-api-nestjs-shared",
3+
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
4+
"sourceRoot": "libs/json-api/json-api-nestjs-shared/src",
5+
"projectType": "library",
6+
"release": {
7+
"version": {
8+
"generatorOptions": {
9+
"packageRoot": "dist/{projectRoot}",
10+
"currentVersionResolver": "git-tag"
11+
}
12+
}
13+
},
14+
"tags": [],
15+
"targets": {
16+
"build": {
17+
"executor": "@nx/js:tsc",
18+
"outputs": ["{options.outputPath}"],
19+
"options": {
20+
"outputPath": "dist/libs/json-api/json-api-nestjs-shared",
21+
"tsConfig": "libs/json-api/json-api-nestjs-shared/tsconfig.lib.json",
22+
"packageJson": "libs/json-api/json-api-nestjs-shared/package.json",
23+
"main": "libs/json-api/json-api-nestjs-shared/src/index.ts",
24+
"assets": ["libs/json-api/json-api-nestjs-shared/*.md"]
25+
}
26+
},
27+
"nx-release-publish": {
28+
"options": {
29+
"packageRoot": "dist/{projectRoot}"
30+
}
31+
}
32+
}
33+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './lib/utils';
2+
export * from './lib/types';

0 commit comments

Comments
 (0)