ng2-rest 16.5.7 → 16.5.9

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 CHANGED
@@ -1,135 +1,135 @@
1
-
2
- ## ng2-rest ##
3
-
4
- Robust isomorphic REST framework for browser (Angular, React etc.) and backend (NodeJS) JavaScript/TypeScript apps.
5
-
6
- Features:
7
- - Compatible with Angular (2+) (newest 13,14 also...) , React, Vue , NodeJS (works everywhere)
8
- - Compatible with RxJS operators (exhaustMap, switchMap, request cancelation etc.)
9
- - Based on [axios](https://axios-http.com/) => excellent alternative to Angular's [HttpClient](https://angular.io/api/common/http/HttpClient)
10
- - JSONP api request handling
11
- - Transfer class instance from server to client and back
12
- - Elegant way of dealing with REST api ( *similar to ExpressJS routes definitions* )
13
-
14
- (more documentation soon... )
15
-
16
- To install this package run:
17
-
18
- npm install ng2-rest --save
19
-
20
- Import Resource class:
21
- ```ts
22
- import { Resource } from 'ng2-rest/browser';
23
- ```
24
-
25
- Resource
26
- ========
27
-
28
- Fit you existing API (not only REST) into new fluent objects with **Resource**
29
- class observables. Use power of **async** in new angular templates;
30
-
31
- **template.html**
32
- ```html
33
- Users:
34
- <ul *ngIf="model.allUsers() | async; else loader; let users" >
35
-
36
- <li *ngFor="let user of users">
37
- {{user.id}} {{user.fullName()}}
38
- <br>
39
- <input type="name" [(NgModel)]="user.name" >
40
- <button (click)="model.update(user)" > Update </button>
41
- </li>
42
-
43
- </ul>
44
-
45
- <ng-template #loader> loading users... </ng-template>
46
-
47
- ```
48
- **component.ts**
49
- ```ts
50
- class User {
51
- name: string;
52
- surname: string;
53
- id: number;
54
-
55
- fullName() {
56
- return `Surname: ${this.surname}, Name: ${this.name}`;
57
- }
58
- }
59
-
60
- // Express.js style url endpoint model
61
- // you can ommit "<User>" part is you don't wanna see response interface
62
- // also you can ommit third argument ",User" is you don't wanna
63
- // map response object to User class objects
64
- const rest = Resource.create<User>("http://yourbackend.com/api","users/:id",{'':User} )
65
-
66
- class UserComponent {
67
-
68
- // Prepare your beautiful interface
69
- model = {
70
- allUsers: () => rest.model()
71
- .array
72
- .get()
73
- .observable // Observable resposne (useful for Angular 2+ html templates)
74
- .pipe( map({ body } => body.json) ) // get all users, body.json => User[]
75
-
76
- userBy: (id) => rest.model({id})
77
- .get() // Promise response by default
78
- .then({ body } => console.log(body.json)) // get user by id, body.json => User
79
-
80
- update: async (user:User) =>{
81
- try {
82
- await rest.model({id:user.id}).put(user) // Promise response by default
83
-
84
- alert('Update sucess')
85
- } catch(e) {
86
- alert(e)
87
- }
88
- }
89
- }
90
-
91
- constructor() { }
92
-
93
- }
94
- ```
95
-
96
- Specification
97
- ============
98
- Example **UrlParams[]** :
99
- `[ { sort: true },{ filter: 'id,5' }, { filter: 'name,test' } ]`
100
-
101
-
102
- | Name | Parameters | Description |
103
- | :---: | --- | ---: |
104
- | **.array.** | get,post,put,head,delete,jsonp | for everything, but with arrays |
105
- | **get** | `UrlParams[] ` | get model by parameters |
106
- | **post** | `model, UrlParams[] ` | post object model |
107
- | **put** | `model, UrlParams[]` | put object model |
108
- | **head** | `model, UrlParams[]` | get head for model |
109
- | **delete** | `UrlParams[]` | remove object by params |
110
- | **jsonp** | `UrlParams[]` | get jsonp data |
111
-
112
-
113
-
114
- # Production mode
115
- ===
116
- Nice things to do in production mode:
117
-
118
- **1. Disable warnings.**
119
-
120
- If you don't wanna see warning, disable it like this:
121
- ```ts
122
- if (environment.production) {
123
- Resource.enableWarnings = false;
124
- }
125
- ```
126
-
127
- # Angular 2+ ngZone
128
- If you are using Angular 2+ you need to do this in your root **app.component**:
129
- ```ts
130
- constructor(zone:NgZone) {
131
- Resource.initAngularNgZone(zone)
132
- }
133
- ```
134
-
135
-
1
+
2
+ ## ng2-rest ##
3
+
4
+ Robust isomorphic REST framework for browser (Angular, React etc.) and backend (NodeJS) JavaScript/TypeScript apps.
5
+
6
+ Features:
7
+ - Compatible with Angular (2+) (newest 13,14 also...) , React, Vue , NodeJS (works everywhere)
8
+ - Compatible with RxJS operators (exhaustMap, switchMap, request cancelation etc.)
9
+ - Based on [axios](https://axios-http.com/) => excellent alternative to Angular's [HttpClient](https://angular.io/api/common/http/HttpClient)
10
+ - JSONP api request handling
11
+ - Transfer class instance from server to client and back
12
+ - Elegant way of dealing with REST api ( *similar to ExpressJS routes definitions* )
13
+
14
+ (more documentation soon... )
15
+
16
+ To install this package run:
17
+
18
+ npm install ng2-rest --save
19
+
20
+ Import Resource class:
21
+ ```ts
22
+ import { Resource } from 'ng2-rest/browser';
23
+ ```
24
+
25
+ Resource
26
+ ========
27
+
28
+ Fit you existing API (not only REST) into new fluent objects with **Resource**
29
+ class observables. Use power of **async** in new angular templates;
30
+
31
+ **template.html**
32
+ ```html
33
+ Users:
34
+ <ul *ngIf="model.allUsers() | async; else loader; let users" >
35
+
36
+ <li *ngFor="let user of users">
37
+ {{user.id}} {{user.fullName()}}
38
+ <br>
39
+ <input type="name" [(NgModel)]="user.name" >
40
+ <button (click)="model.update(user)" > Update </button>
41
+ </li>
42
+
43
+ </ul>
44
+
45
+ <ng-template #loader> loading users... </ng-template>
46
+
47
+ ```
48
+ **component.ts**
49
+ ```ts
50
+ class User {
51
+ name: string;
52
+ surname: string;
53
+ id: number;
54
+
55
+ fullName() {
56
+ return `Surname: ${this.surname}, Name: ${this.name}`;
57
+ }
58
+ }
59
+
60
+ // Express.js style url endpoint model
61
+ // you can ommit "<User>" part is you don't wanna see response interface
62
+ // also you can ommit third argument ",User" is you don't wanna
63
+ // map response object to User class objects
64
+ const rest = Resource.create<User>("http://yourbackend.com/api","users/:id",{'':User} )
65
+
66
+ class UserComponent {
67
+
68
+ // Prepare your beautiful interface
69
+ model = {
70
+ allUsers: () => rest.model()
71
+ .array
72
+ .get()
73
+ .observable // Observable resposne (useful for Angular 2+ html templates)
74
+ .pipe( map({ body } => body.json) ) // get all users, body.json => User[]
75
+
76
+ userBy: (id) => rest.model({id})
77
+ .get() // Promise response by default
78
+ .then({ body } => console.log(body.json)) // get user by id, body.json => User
79
+
80
+ update: async (user:User) =>{
81
+ try {
82
+ await rest.model({id:user.id}).put(user) // Promise response by default
83
+
84
+ alert('Update sucess')
85
+ } catch(e) {
86
+ alert(e)
87
+ }
88
+ }
89
+ }
90
+
91
+ constructor() { }
92
+
93
+ }
94
+ ```
95
+
96
+ Specification
97
+ ============
98
+ Example **UrlParams[]** :
99
+ `[ { sort: true },{ filter: 'id,5' }, { filter: 'name,test' } ]`
100
+
101
+
102
+ | Name | Parameters | Description |
103
+ | :---: | --- | ---: |
104
+ | **.array.** | get,post,put,head,delete,jsonp | for everything, but with arrays |
105
+ | **get** | `UrlParams[] ` | get model by parameters |
106
+ | **post** | `model, UrlParams[] ` | post object model |
107
+ | **put** | `model, UrlParams[]` | put object model |
108
+ | **head** | `model, UrlParams[]` | get head for model |
109
+ | **delete** | `UrlParams[]` | remove object by params |
110
+ | **jsonp** | `UrlParams[]` | get jsonp data |
111
+
112
+
113
+
114
+ # Production mode
115
+ ===
116
+ Nice things to do in production mode:
117
+
118
+ **1. Disable warnings.**
119
+
120
+ If you don't wanna see warning, disable it like this:
121
+ ```ts
122
+ if (environment.production) {
123
+ Resource.enableWarnings = false;
124
+ }
125
+ ```
126
+
127
+ # Angular 2+ ngZone
128
+ If you are using Angular 2+ you need to do this in your root **app.component**:
129
+ ```ts
130
+ constructor(zone:NgZone) {
131
+ Resource.initAngularNgZone(zone)
132
+ }
133
+ ```
134
+
135
+
@@ -1,6 +1,6 @@
1
1
  THIS FILE IS GENERATED. THIS FILE IS GENERATED. THIS FILE IS GENERATED.
2
2
 
3
- Assets from this folder are being shipped with this npm package (ng2-rest@16.5.7)
3
+ Assets from this folder are being shipped with this npm package (ng2-rest@16.5.9)
4
4
  created from this project.
5
5
 
6
6
  THIS FILE IS GENERATED.THIS FILE IS GENERATED. THIS FILE IS GENERATED.
package/browser/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # MyLib
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
- > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
1
+ # MyLib
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
+ > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
package/client/README.md CHANGED
@@ -1,24 +1,24 @@
1
- # MyLib
2
-
3
- This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
-
5
- ## Code scaffolding
6
-
7
- Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
- > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
-
10
- ## Build
11
-
12
- Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
-
14
- ## Publishing
15
-
16
- After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
-
18
- ## Running unit tests
19
-
20
- Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
-
22
- ## Further help
23
-
24
- To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
1
+ # MyLib
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
8
+ > Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -53,7 +53,7 @@
53
53
  "workerPlugins": {}
54
54
  },
55
55
  "name": "ng2-rest",
56
- "version": "16.5.7",
56
+ "version": "16.5.9",
57
57
  "scripts": {
58
58
  "build:watch": "npm-run watch \"morphi build\" src"
59
59
  },
@@ -79,14 +79,14 @@
79
79
  "@types/lodash": "4.14.92",
80
80
  "axios": "1.3.5",
81
81
  "diff": "3.2.0",
82
- "json10": "~16.5.7",
82
+ "json10": "~16.5.9",
83
83
  "json5": "2.2.1",
84
84
  "lodash": "4.17.20",
85
- "ng2-logger": "~16.5.9"
85
+ "ng2-logger": "~16.5.11"
86
86
  },
87
87
  "license": "MIT",
88
88
  "private": false,
89
- "lastBuildTagHash": "a6a8a22456399ce57078f7167174d405c679d33e",
89
+ "lastBuildTagHash": "53a21b4b3fe108930d8729b7750294c60645d562",
90
90
  "devDependencies": {
91
91
  "@angular-devkit/build-angular": "~16.0.5",
92
92
  "@angular-devkit/core": "~16.0.5",
@@ -166,8 +166,8 @@
166
166
  "angular-material-css-vars": "5.0.2",
167
167
  "angular-resize-event": "3.2.0",
168
168
  "animate.css": "4.1.1 ",
169
- "any-project-cli": "~16.5.7",
170
- "background-worker-process": "~16.5.7",
169
+ "any-project-cli": "~16.5.9",
170
+ "background-worker-process": "~16.5.9",
171
171
  "base32": "0.0.7",
172
172
  "bcryptjs": "2.4.3",
173
173
  "better-sqlite3": "7.6.2",
@@ -213,13 +213,13 @@
213
213
  "file-saver": "2.0.5",
214
214
  "file-type": "18.5.0",
215
215
  "firedev": "^16",
216
- "firedev-crud": "~16.5.7",
217
- "firedev-crud-deamon": "~16.5.7",
218
- "firedev-ports": "~16.5.7",
219
- "firedev-storage": "~16.5.7",
220
- "firedev-type-sql": "~16.5.7",
221
- "firedev-typeorm": "~16.5.8",
222
- "firedev-ui": "~16.5.7",
216
+ "firedev-crud": "~16.5.9",
217
+ "firedev-crud-deamon": "~16.5.9",
218
+ "firedev-ports": "~16.5.9",
219
+ "firedev-storage": "~16.5.9",
220
+ "firedev-type-sql": "~16.5.9",
221
+ "firedev-typeorm": "~16.5.10",
222
+ "firedev-ui": "~16.5.9",
223
223
  "fkill": "6.1.0",
224
224
  "font-awesome": "4.7.0",
225
225
  "form-data": "4.0.0",
@@ -236,11 +236,11 @@
236
236
  "image-focus": "1.2.1",
237
237
  "immer": "10.0.2",
238
238
  "immutable": "4.3.0",
239
- "incremental-compiler": "~16.5.17",
239
+ "incremental-compiler": "~16.5.19",
240
240
  "inquirer": "7.3.3",
241
241
  "inquirer-autocomplete-prompt": "1.3.0",
242
242
  "is-elevated": "3.0.0",
243
- "isomorphic-region-loader": "~16.5.7",
243
+ "isomorphic-region-loader": "~16.5.10",
244
244
  "istanbul-instrumenter-loader": "2.0.0",
245
245
  "jest": "29.5.0",
246
246
  "jest-date-mock": "1.0.8",
@@ -251,29 +251,29 @@
251
251
  "joi": "17.9.2",
252
252
  "jscodeshift": "0.6.3",
253
253
  "json-stringify-safe": "5.0.1",
254
- "json10-writer": "~16.5.7",
254
+ "json10-writer": "~16.5.9",
255
255
  "json5-writer": "0.2.0",
256
256
  "jszip": "3.10.1",
257
257
  "karma-cli": "1.0.1",
258
258
  "lnk": "1.0.1",
259
259
  "localforage": "1.10.0",
260
260
  "lockfile": "1.0.4",
261
- "lodash-walk-object": "~16.5.7",
261
+ "lodash-walk-object": "~16.5.9",
262
262
  "lowdb": "1.0.0",
263
- "magic-renamer": "~16.5.7",
263
+ "magic-renamer": "~16.5.9",
264
264
  "material-design-icons": "3.0.1",
265
265
  "method-override": "2.3.10",
266
266
  "minimist": "1.2.0",
267
267
  "mkdirp": "0.5.1",
268
268
  "mocha": "10.2.0",
269
269
  "moment": "2.29.3",
270
- "morphi": "~16.5.6",
270
+ "morphi": "~16.5.8",
271
271
  "ng-for-track-by-property": "16.0.1",
272
272
  "ng-in-viewport": "15.0.2",
273
273
  "ng-lock": "16.0.1",
274
274
  "ng-packagr": "16.0.1",
275
- "ng-talkback": "~16.5.6",
276
- "ng2-rest": "~16.5.6",
275
+ "ng-talkback": "~16.5.9",
276
+ "ng2-rest": "~16.5.8",
277
277
  "ngx-ace-wrapper": "14.0.0",
278
278
  "ngx-editor": "15.3.0",
279
279
  "ngx-highlightjs": "9.0.0",
@@ -286,7 +286,7 @@
286
286
  "ngx-scrolltop": "6.0.0",
287
287
  "ngx-store": "3.1.1",
288
288
  "ngx-typed-js": "2.1.1",
289
- "node-cli-tester": "~16.5.6",
289
+ "node-cli-tester": "~16.5.8",
290
290
  "node-localstorage": "2.1.6",
291
291
  "node-notifier": "6.0.0",
292
292
  "node-polyfill-webpack-plugin": "2.0.1",
@@ -313,7 +313,7 @@
313
313
  "q": "1.5.1",
314
314
  "rallax.js": "2.0.4",
315
315
  "randomcolor": "0.5.3",
316
- "record-replay-req-res-scenario": "~16.5.6",
316
+ "record-replay-req-res-scenario": "~16.5.8",
317
317
  "reflect-metadata": "0.1.10",
318
318
  "rimraf": "2.6.2",
319
319
  "rxjs": "~7.8.0",
@@ -324,7 +324,7 @@
324
324
  "socket.io": "2.4.1",
325
325
  "sort-package-json": "1.11.0",
326
326
  "sql.js": "1.8.0",
327
- "static-columns": "~16.5.8",
327
+ "static-columns": "~16.5.10",
328
328
  "string-similarity": "4.0.2",
329
329
  "sudo-block": "3.0.0",
330
330
  "supertest": "6.3.3",
@@ -332,12 +332,12 @@
332
332
  "systeminformation": "3.45.7",
333
333
  "task.js": "0.1.5",
334
334
  "threads": "1.7.0",
335
- "tnp-cli": "~16.5.6",
336
- "tnp-config": "~16.5.8",
337
- "tnp-core": "~16.5.13",
338
- "tnp-db": "~16.5.7",
339
- "tnp-helpers": "~16.5.8",
340
- "tnp-models": "~16.5.7",
335
+ "tnp-cli": "~16.5.8",
336
+ "tnp-config": "~16.5.10",
337
+ "tnp-core": "~16.5.15",
338
+ "tnp-db": "~16.5.9",
339
+ "tnp-helpers": "~16.5.11",
340
+ "tnp-models": "~16.5.9",
341
341
  "ts-debug": "1.3.0",
342
342
  "ts-loader": "2.3.1",
343
343
  "ts-node": "10.9.1",
@@ -346,13 +346,13 @@
346
346
  "turndown": "7.1.2",
347
347
  "typeorm": "~0.3.10",
348
348
  "typescript": "~5.0.2",
349
- "typescript-class-helpers": "~16.5.8",
349
+ "typescript-class-helpers": "~16.5.10",
350
350
  "typescript-formatter": "~7.2.2",
351
351
  "underscore": "1.9.1",
352
352
  "uuid": "8.3.2",
353
353
  "validator": "9.2.0",
354
354
  "video.js": "8.3.0",
355
- "vpn-split": "~16.5.7",
355
+ "vpn-split": "~16.5.10",
356
356
  "watch": "1.0.2",
357
357
  "yup": "1.1.1",
358
358
  "zone.js": "~0.13.0"
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  "workerPlugins": {}
54
54
  },
55
55
  "name": "ng2-rest",
56
- "version": "16.5.7",
56
+ "version": "16.5.9",
57
57
  "scripts": {
58
58
  "build:watch": "npm-run watch \"morphi build\" src"
59
59
  },
@@ -79,13 +79,13 @@
79
79
  "@types/lodash": "4.14.92",
80
80
  "axios": "1.3.5",
81
81
  "diff": "3.2.0",
82
- "json10": "~16.5.7",
82
+ "json10": "~16.5.9",
83
83
  "json5": "2.2.1",
84
84
  "lodash": "4.17.20",
85
- "ng2-logger": "~16.5.9"
85
+ "ng2-logger": "~16.5.11"
86
86
  },
87
87
  "license": "MIT",
88
88
  "private": false,
89
- "lastBuildTagHash": "a6a8a22456399ce57078f7167174d405c679d33e",
89
+ "lastBuildTagHash": "53a21b4b3fe108930d8729b7750294c60645d562",
90
90
  "devDependencies": {}
91
91
  }