@data-client/rest 0.14.9 → 0.14.11
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 +0 -3
- package/package.json +2 -2
- package/src/__tests__/Resource.test.ts +1 -9
- package/src/__tests__/RestEndpoint.ts +0 -12
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-client/rest",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.11",
|
|
4
4
|
"description": "Quickly define typed REST resources and endpoints",
|
|
5
5
|
"homepage": "https://dataclient.io/rest",
|
|
6
6
|
"repository": {
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"license": "Apache-2.0",
|
|
132
132
|
"dependencies": {
|
|
133
133
|
"@babel/runtime": "^7.17.0",
|
|
134
|
-
"@data-client/endpoint": "^0.14.
|
|
134
|
+
"@data-client/endpoint": "^0.14.11",
|
|
135
135
|
"path-to-regexp": "^6.2.1"
|
|
136
136
|
},
|
|
137
137
|
"devDependencies": {
|
|
@@ -5,8 +5,8 @@ import { CacheProvider } from '@data-client/react';
|
|
|
5
5
|
import nock from 'nock';
|
|
6
6
|
|
|
7
7
|
import { makeRenderDataClient } from '../../../test';
|
|
8
|
-
import resource from '../resource';
|
|
9
8
|
import { ResourcePath } from '../pathTypes';
|
|
9
|
+
import resource from '../resource';
|
|
10
10
|
import RestEndpoint from '../RestEndpoint';
|
|
11
11
|
import {
|
|
12
12
|
payload,
|
|
@@ -25,10 +25,6 @@ export class User extends Entity {
|
|
|
25
25
|
readonly username: string = '';
|
|
26
26
|
readonly email: string = '';
|
|
27
27
|
readonly isAdmin: boolean = false;
|
|
28
|
-
|
|
29
|
-
pk() {
|
|
30
|
-
return this.id?.toString();
|
|
31
|
-
}
|
|
32
28
|
}
|
|
33
29
|
export const UserResource = resource({
|
|
34
30
|
path: 'http\\://test.com/user/:id',
|
|
@@ -41,10 +37,6 @@ export class PaginatedArticle extends Entity {
|
|
|
41
37
|
readonly author: number | null = null;
|
|
42
38
|
readonly tags: string[] = [];
|
|
43
39
|
|
|
44
|
-
pk() {
|
|
45
|
-
return this.id?.toString();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
40
|
static schema = {
|
|
49
41
|
author: User,
|
|
50
42
|
};
|
|
@@ -26,10 +26,6 @@ export class User extends Entity {
|
|
|
26
26
|
readonly username: string = '';
|
|
27
27
|
readonly email: string = '';
|
|
28
28
|
readonly isAdmin: boolean = false;
|
|
29
|
-
|
|
30
|
-
pk() {
|
|
31
|
-
return this.id?.toString();
|
|
32
|
-
}
|
|
33
29
|
}
|
|
34
30
|
const getUser = new RestEndpoint({
|
|
35
31
|
path: 'http\\://test.com/user/:id',
|
|
@@ -45,10 +41,6 @@ export class PaginatedArticle extends Entity {
|
|
|
45
41
|
readonly author: number | null = null;
|
|
46
42
|
readonly tags: string[] = [];
|
|
47
43
|
|
|
48
|
-
pk() {
|
|
49
|
-
return this.id?.toString();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
44
|
static schema = {
|
|
53
45
|
author: User,
|
|
54
46
|
};
|
|
@@ -804,10 +796,6 @@ describe('RestEndpoint', () => {
|
|
|
804
796
|
readonly username2: string = '';
|
|
805
797
|
readonly email: string = '';
|
|
806
798
|
readonly isAdmin: boolean = false;
|
|
807
|
-
|
|
808
|
-
pk() {
|
|
809
|
-
return this.id?.toString();
|
|
810
|
-
}
|
|
811
799
|
}
|
|
812
800
|
|
|
813
801
|
const getUserBase = new MyEndpoint({
|