@dvelop-sdk/business-objects 1.0.0-beta.2 → 1.0.0-beta.5
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/lib/entities/create-entity/create-entity.d.ts +39 -30
- package/lib/entities/create-entity/create-entity.d.ts.map +1 -1
- package/lib/entities/create-entity/create-entity.js +31 -26
- package/lib/entities/create-entity/create-entity.js.map +1 -1
- package/lib/entities/delete-entity/delete-entity.d.ts +27 -14
- package/lib/entities/delete-entity/delete-entity.d.ts.map +1 -1
- package/lib/entities/delete-entity/delete-entity.js +23 -15
- package/lib/entities/delete-entity/delete-entity.js.map +1 -1
- package/lib/entities/get-entities/get-entities.d.ts +20 -15
- package/lib/entities/get-entities/get-entities.d.ts.map +1 -1
- package/lib/entities/get-entities/get-entities.js +16 -11
- package/lib/entities/get-entities/get-entities.js.map +1 -1
- package/lib/entities/get-entity/get-entity.d.ts +28 -14
- package/lib/entities/get-entity/get-entity.d.ts.map +1 -1
- package/lib/entities/get-entity/get-entity.js +23 -14
- package/lib/entities/get-entity/get-entity.js.map +1 -1
- package/lib/entities/update-entity/update-entity.d.ts +40 -25
- package/lib/entities/update-entity/update-entity.d.ts.map +1 -1
- package/lib/entities/update-entity/update-entity.js +31 -23
- package/lib/entities/update-entity/update-entity.js.map +1 -1
- package/lib/utils/http.d.ts +9 -0
- package/lib/utils/http.d.ts.map +1 -1
- package/lib/utils/http.js +27 -2
- package/lib/utils/http.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,23 +2,30 @@ import { DvelopContext, DvelopHttpResponse as HttpResponse } from "@dvelop-sdk/c
|
|
|
2
2
|
import { HttpConfig } from "../../utils/http";
|
|
3
3
|
/**
|
|
4
4
|
* Parameters for the {@link createBoEntity}-function.
|
|
5
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
5
6
|
* @category Entity
|
|
6
7
|
*/
|
|
7
|
-
export interface CreateBoEntityParams {
|
|
8
|
+
export interface CreateBoEntityParams<E = any> {
|
|
9
|
+
/** Name of the model */
|
|
8
10
|
modelName: string;
|
|
11
|
+
/** EntityName in plural (**Singular name won't work**) */
|
|
9
12
|
pluralEntityName: string;
|
|
10
|
-
|
|
13
|
+
/** Entity to be created*/
|
|
14
|
+
entity: E;
|
|
11
15
|
}
|
|
12
16
|
/**
|
|
13
17
|
* Factory for {@link createBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
14
|
-
* @
|
|
18
|
+
* @template E Type for Entity to be created.
|
|
19
|
+
* @template R Return type of the {@link createBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
15
20
|
* @internal
|
|
16
21
|
* @category Entity
|
|
17
22
|
*/
|
|
18
|
-
export declare function _createBoEntityFactory(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: CreateBoEntityParams) =>
|
|
23
|
+
export declare function _createBoEntityFactory<E, R>(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: CreateBoEntityParams<E>) => R): (context: DvelopContext, params: CreateBoEntityParams<E>) => Promise<R>;
|
|
19
24
|
/**
|
|
20
25
|
* Create a business object entity.
|
|
26
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
21
27
|
*
|
|
28
|
+
* @example
|
|
22
29
|
* ```typescript
|
|
23
30
|
* import { createBoEntity } from "@dvelop-sdk/business-objects";
|
|
24
31
|
*
|
|
@@ -26,41 +33,43 @@ export declare function _createBoEntityFactory(httpRequestFunction: (context: Dv
|
|
|
26
33
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
27
34
|
* authSessionId: "3f3c428d452"
|
|
28
35
|
* },{
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* modelName: "HOSPITALBASEDATA",
|
|
37
|
+
* pluralEntityName: "employees",
|
|
38
|
+
* entity: {
|
|
39
|
+
* employeeId: "1",
|
|
40
|
+
* firstName: "John Micheal",
|
|
41
|
+
* lastName: "Dorian",
|
|
42
|
+
* jobTitel: "senior physician"
|
|
43
|
+
* }
|
|
37
44
|
* });
|
|
38
45
|
* ```
|
|
39
|
-
* ---
|
|
40
|
-
* You can also
|
|
46
|
+
* ---
|
|
47
|
+
* You can also use generics:
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
41
50
|
* import { createBoEntity } from "@dvelop-sdk/business-objects";
|
|
42
51
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
52
|
+
* interface Employee {
|
|
53
|
+
* employeeId: string;
|
|
54
|
+
* firstName: string;
|
|
55
|
+
* lastName: string;
|
|
56
|
+
* jobTitel: string;
|
|
57
|
+
* }
|
|
48
58
|
*
|
|
49
|
-
*
|
|
59
|
+
* await create<Employee>({
|
|
50
60
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
51
61
|
* authSessionId: "3f3c428d452"
|
|
52
62
|
* },{
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
63
|
+
* modelName: "HOSPITALBASEDATA",
|
|
64
|
+
* pluralEntityName: "employees",
|
|
65
|
+
* entity: {
|
|
66
|
+
* employeeId: "1",
|
|
67
|
+
* firstName: "John Micheal",
|
|
68
|
+
* lastName: "Dorian",
|
|
69
|
+
* jobTitel: "senior physician"
|
|
70
|
+
* }
|
|
61
71
|
* });
|
|
62
|
-
* console.log(responseMessage); // Entity created successfully.
|
|
63
72
|
* ```
|
|
64
73
|
*/
|
|
65
|
-
export declare function createBoEntity(context: DvelopContext, params: CreateBoEntityParams): Promise<void>;
|
|
74
|
+
export declare function createBoEntity<E = any>(context: DvelopContext, params: CreateBoEntityParams<E>): Promise<void>;
|
|
66
75
|
//# sourceMappingURL=create-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/create-entity/create-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAE3E
|
|
1
|
+
{"version":3,"file":"create-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/create-entity/create-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAE3E;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,GAAG;IAC3C,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAC;IACzB,0BAA0B;IAC1B,MAAM,EAAE,CAAC,CAAC;CACX;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EACzC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,YAAY,CAAC,EAC1F,iBAAiB,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,GACxG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAWzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,wBAAsB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpH"}
|
|
@@ -40,7 +40,8 @@ exports.createBoEntity = exports._createBoEntityFactory = void 0;
|
|
|
40
40
|
var http_1 = require("../../utils/http");
|
|
41
41
|
/**
|
|
42
42
|
* Factory for {@link createBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
43
|
-
* @
|
|
43
|
+
* @template E Type for Entity to be created.
|
|
44
|
+
* @template R Return type of the {@link createBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
44
45
|
* @internal
|
|
45
46
|
* @category Entity
|
|
46
47
|
*/
|
|
@@ -65,7 +66,9 @@ function _createBoEntityFactory(httpRequestFunction, transformFunction) {
|
|
|
65
66
|
exports._createBoEntityFactory = _createBoEntityFactory;
|
|
66
67
|
/**
|
|
67
68
|
* Create a business object entity.
|
|
69
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
68
70
|
*
|
|
71
|
+
* @example
|
|
69
72
|
* ```typescript
|
|
70
73
|
* import { createBoEntity } from "@dvelop-sdk/business-objects";
|
|
71
74
|
*
|
|
@@ -73,40 +76,42 @@ exports._createBoEntityFactory = _createBoEntityFactory;
|
|
|
73
76
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
74
77
|
* authSessionId: "3f3c428d452"
|
|
75
78
|
* },{
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
79
|
+
* modelName: "HOSPITALBASEDATA",
|
|
80
|
+
* pluralEntityName: "employees",
|
|
81
|
+
* entity: {
|
|
82
|
+
* employeeId: "1",
|
|
83
|
+
* firstName: "John Micheal",
|
|
84
|
+
* lastName: "Dorian",
|
|
85
|
+
* jobTitel: "senior physician"
|
|
86
|
+
* }
|
|
84
87
|
* });
|
|
85
88
|
* ```
|
|
86
|
-
* ---
|
|
87
|
-
* You can also
|
|
89
|
+
* ---
|
|
90
|
+
* You can also use generics:
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
88
93
|
* import { createBoEntity } from "@dvelop-sdk/business-objects";
|
|
89
94
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
+
* interface Employee {
|
|
96
|
+
* employeeId: string;
|
|
97
|
+
* firstName: string;
|
|
98
|
+
* lastName: string;
|
|
99
|
+
* jobTitel: string;
|
|
100
|
+
* }
|
|
95
101
|
*
|
|
96
|
-
*
|
|
102
|
+
* await create<Employee>({
|
|
97
103
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
98
104
|
* authSessionId: "3f3c428d452"
|
|
99
105
|
* },{
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
106
|
+
* modelName: "HOSPITALBASEDATA",
|
|
107
|
+
* pluralEntityName: "employees",
|
|
108
|
+
* entity: {
|
|
109
|
+
* employeeId: "1",
|
|
110
|
+
* firstName: "John Micheal",
|
|
111
|
+
* lastName: "Dorian",
|
|
112
|
+
* jobTitel: "senior physician"
|
|
113
|
+
* }
|
|
108
114
|
* });
|
|
109
|
-
* console.log(responseMessage); // Entity created successfully.
|
|
110
115
|
* ```
|
|
111
116
|
*/
|
|
112
117
|
/* istanbul ignore next */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-entity.js","sourceRoot":"","sources":["../../../src/entities/create-entity/create-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA2E;
|
|
1
|
+
{"version":3,"file":"create-entity.js","sourceRoot":"","sources":["../../../src/entities/create-entity/create-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA2E;AAgB3E;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,mBAA0F,EAC1F,iBAAyG;IAF3G,iBAcC;IAVC,OAAO,UAAO,OAAsB,EAAE,MAA+B;;;;wBAElD,qBAAM,mBAAmB,CAAC,OAAO,EAAE;wBAClD,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,6BAA2B,MAAM,CAAC,SAAS,SAAI,MAAM,CAAC,gBAAkB;wBAC7E,IAAI,EAAE,MAAM,CAAC,MAAM;qBACpB,CAAC,EAAA;;oBAJI,QAAQ,GAAG,SAIf;oBAEF,sBAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAC;;;SACrD,CAAC;AACJ,CAAC;AAdD,wDAcC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,0BAA0B;AAC1B,SAAsB,cAAc,CAAU,OAAsB,EAAE,MAA+B;;;;wBAC5F,qBAAM,sBAAsB,CAAU,kCAA2B,EAAE,cAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;wBAArG,sBAAO,SAA8F,EAAC;;;;CACvG;AAFD,wCAEC"}
|
|
@@ -5,20 +5,26 @@ import { HttpConfig } from "../../utils/http";
|
|
|
5
5
|
* @category Entity
|
|
6
6
|
*/
|
|
7
7
|
export interface DeleteBoEntityParams {
|
|
8
|
+
/** Name of the model */
|
|
8
9
|
modelName: string;
|
|
10
|
+
/** EntityName in plural (**Singular name won't work**) */
|
|
9
11
|
pluralEntityName: string;
|
|
10
|
-
|
|
12
|
+
/** Type of the key property */
|
|
13
|
+
keyPropertyType: "string" | "number" | "guid";
|
|
14
|
+
/** Key-property of the entity to be deleted */
|
|
15
|
+
keyPropertyValue: string | number;
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* Factory for {@link deleteBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
14
|
-
* @
|
|
19
|
+
* @template E Return type of the {@link deleteBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
15
20
|
* @internal
|
|
16
21
|
* @category Entity
|
|
17
22
|
*/
|
|
18
|
-
export declare function _deleteBoEntityFactory(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: DeleteBoEntityParams) =>
|
|
23
|
+
export declare function _deleteBoEntityFactory<T>(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: DeleteBoEntityParams) => T): (context: DvelopContext, params: DeleteBoEntityParams) => Promise<T>;
|
|
19
24
|
/**
|
|
20
25
|
* Delete a business object entity.
|
|
21
26
|
*
|
|
27
|
+
* @example
|
|
22
28
|
* ```typescript
|
|
23
29
|
* import { deleteBoEntity } from "@dvelop-sdk/business-objects";
|
|
24
30
|
*
|
|
@@ -26,30 +32,37 @@ export declare function _deleteBoEntityFactory(httpRequestFunction: (context: Dv
|
|
|
26
32
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
27
33
|
* authSessionId: "3f3c428d452"
|
|
28
34
|
* },{
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
35
|
+
* modelName: "HOSPITALBASEDATA",
|
|
36
|
+
* pluralEntityName: "employees",
|
|
37
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
38
|
+
* entityKeyValue: 1
|
|
32
39
|
* });
|
|
33
40
|
* ```
|
|
34
41
|
* ---
|
|
35
42
|
* You can also write your own function, for example to get a notification, if the entity requested for deletion doesn't exist.
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
36
45
|
* import { deleteBoEntity } from "@dvelop-sdk/business-objects";
|
|
37
46
|
*
|
|
38
|
-
* const myDeleteFunction = _deleteBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
|
|
47
|
+
* const myDeleteFunction = _deleteBoEntityFactory(_defaultHttpRequestFunction, (response: HttpResponse) => {
|
|
39
48
|
* if(response.status === 204) {
|
|
40
|
-
* return "Entity
|
|
49
|
+
* return "Entity does not exist.";
|
|
50
|
+
* } else {
|
|
51
|
+
* return "Entity was deleted.";
|
|
41
52
|
* }
|
|
42
|
-
* })
|
|
53
|
+
* });
|
|
43
54
|
*
|
|
44
|
-
* const responseMessage = await myDeleteFunction({
|
|
55
|
+
* const responseMessage: string = await myDeleteFunction({
|
|
45
56
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
46
57
|
* authSessionId: "3f3c428d452"
|
|
47
58
|
* },{
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
59
|
+
* modelName: "HOSPITALBASEDATA",
|
|
60
|
+
* pluralEntityName: "employees",
|
|
61
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
62
|
+
* entityKeyValue: 3
|
|
51
63
|
* });
|
|
52
|
-
*
|
|
64
|
+
*
|
|
65
|
+
* console.log(responseMessage); // Entity does not exist.
|
|
53
66
|
* ```
|
|
54
67
|
*/
|
|
55
68
|
export declare function deleteBoEntity(context: DvelopContext, params: DeleteBoEntityParams): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/delete-entity/delete-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,oBAAoB;
|
|
1
|
+
{"version":3,"file":"delete-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/delete-entity/delete-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,UAAU,EAA+B,MAAM,kBAAkB,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,eAAe,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,+CAA+C;IAC/C,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,YAAY,CAAC,EAC1F,iBAAiB,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,KAAK,CAAC,GACrG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,CAAC,CAAC,CAkBtE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,wBAAsB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAExG"}
|
|
@@ -40,7 +40,7 @@ exports.deleteBoEntity = exports._deleteBoEntityFactory = void 0;
|
|
|
40
40
|
var http_1 = require("../../utils/http");
|
|
41
41
|
/**
|
|
42
42
|
* Factory for {@link deleteBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
43
|
-
* @
|
|
43
|
+
* @template E Return type of the {@link deleteBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
44
44
|
* @internal
|
|
45
45
|
* @category Entity
|
|
46
46
|
*/
|
|
@@ -51,11 +51,11 @@ function _deleteBoEntityFactory(httpRequestFunction, transformFunction) {
|
|
|
51
51
|
return __generator(this, function (_a) {
|
|
52
52
|
switch (_a.label) {
|
|
53
53
|
case 0:
|
|
54
|
-
if (
|
|
55
|
-
urlEntityKeyValue = params.
|
|
54
|
+
if (params.keyPropertyType === "number" || params.keyPropertyType === "guid") {
|
|
55
|
+
urlEntityKeyValue = params.keyPropertyValue;
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
urlEntityKeyValue = "'" + params.
|
|
58
|
+
urlEntityKeyValue = "'" + params.keyPropertyValue + "'";
|
|
59
59
|
}
|
|
60
60
|
return [4 /*yield*/, httpRequestFunction(context, {
|
|
61
61
|
method: "DELETE",
|
|
@@ -72,6 +72,7 @@ exports._deleteBoEntityFactory = _deleteBoEntityFactory;
|
|
|
72
72
|
/**
|
|
73
73
|
* Delete a business object entity.
|
|
74
74
|
*
|
|
75
|
+
* @example
|
|
75
76
|
* ```typescript
|
|
76
77
|
* import { deleteBoEntity } from "@dvelop-sdk/business-objects";
|
|
77
78
|
*
|
|
@@ -79,30 +80,37 @@ exports._deleteBoEntityFactory = _deleteBoEntityFactory;
|
|
|
79
80
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
80
81
|
* authSessionId: "3f3c428d452"
|
|
81
82
|
* },{
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
83
|
+
* modelName: "HOSPITALBASEDATA",
|
|
84
|
+
* pluralEntityName: "employees",
|
|
85
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
86
|
+
* entityKeyValue: 1
|
|
85
87
|
* });
|
|
86
88
|
* ```
|
|
87
89
|
* ---
|
|
88
90
|
* You can also write your own function, for example to get a notification, if the entity requested for deletion doesn't exist.
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
89
93
|
* import { deleteBoEntity } from "@dvelop-sdk/business-objects";
|
|
90
94
|
*
|
|
91
|
-
* const myDeleteFunction = _deleteBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
|
|
95
|
+
* const myDeleteFunction = _deleteBoEntityFactory(_defaultHttpRequestFunction, (response: HttpResponse) => {
|
|
92
96
|
* if(response.status === 204) {
|
|
93
|
-
* return "Entity
|
|
97
|
+
* return "Entity does not exist.";
|
|
98
|
+
* } else {
|
|
99
|
+
* return "Entity was deleted.";
|
|
94
100
|
* }
|
|
95
|
-
* })
|
|
101
|
+
* });
|
|
96
102
|
*
|
|
97
|
-
* const responseMessage = await myDeleteFunction({
|
|
103
|
+
* const responseMessage: string = await myDeleteFunction({
|
|
98
104
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
99
105
|
* authSessionId: "3f3c428d452"
|
|
100
106
|
* },{
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
107
|
+
* modelName: "HOSPITALBASEDATA",
|
|
108
|
+
* pluralEntityName: "employees",
|
|
109
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
110
|
+
* entityKeyValue: 3
|
|
104
111
|
* });
|
|
105
|
-
*
|
|
112
|
+
*
|
|
113
|
+
* console.log(responseMessage); // Entity does not exist.
|
|
106
114
|
* ```
|
|
107
115
|
*/
|
|
108
116
|
/* istanbul ignore next */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-entity.js","sourceRoot":"","sources":["../../../src/entities/delete-entity/delete-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA2E;
|
|
1
|
+
{"version":3,"file":"delete-entity.js","sourceRoot":"","sources":["../../../src/entities/delete-entity/delete-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA2E;AAiB3E;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,mBAA0F,EAC1F,iBAAsG;IAFxG,iBAqBC;IAjBC,OAAO,UAAO,OAAsB,EAAE,MAA4B;;;;;oBAGhE,IAAI,MAAM,CAAC,eAAe,KAAK,QAAQ,IAAI,MAAM,CAAC,eAAe,KAAK,MAAM,EAAE;wBAC5E,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;qBAC7C;yBAAM;wBACL,iBAAiB,GAAG,MAAI,MAAM,CAAC,gBAAgB,MAAG,CAAC;qBACpD;oBAGgB,qBAAM,mBAAmB,CAAC,OAAO,EAAE;4BAClD,MAAM,EAAE,QAAQ;4BAChB,GAAG,EAAE,6BAA2B,MAAM,CAAC,SAAS,SAAI,MAAM,CAAC,gBAAgB,SAAI,iBAAiB,MAAG;yBACpG,CAAC,EAAA;;oBAHI,QAAQ,GAAG,SAGf;oBAEF,sBAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAC;;;SACrD,CAAC;AACJ,CAAC;AArBD,wDAqBC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,0BAA0B;AAC1B,SAAsB,cAAc,CAAC,OAAsB,EAAE,MAA4B;;;;wBAChF,qBAAM,sBAAsB,CAAC,kCAA2B,EAAE,cAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;wBAA5F,sBAAO,SAAqF,EAAC;;;;CAC9F;AAFD,wCAEC"}
|
|
@@ -7,60 +7,65 @@ import { HttpConfig, HttpResponse } from "../../utils/http";
|
|
|
7
7
|
export interface GetBoEntitiesParams {
|
|
8
8
|
/** Name of the model */
|
|
9
9
|
modelName: string;
|
|
10
|
-
/** EntityName in plural (**
|
|
10
|
+
/** EntityName in plural (**Singular name won't work**) */
|
|
11
11
|
pluralEntityName: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Default transform-function provided to the {@link getBoEntities}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
15
|
+
* @template E Return type
|
|
15
16
|
* @internal
|
|
16
17
|
* @category Entities
|
|
17
18
|
*/
|
|
18
|
-
export declare function _getBoEntitiesDefaultTransformFunction<
|
|
19
|
+
export declare function _getBoEntitiesDefaultTransformFunction<E>(response: HttpResponse, _: DvelopContext, __: GetBoEntitiesParams): E[];
|
|
19
20
|
/**
|
|
20
21
|
* Factory for {@link getBoEntities}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
21
|
-
* @
|
|
22
|
+
* @template E Return type of the {@link getBoEntities}-function. A corresponding transformFunction has to be supplied.
|
|
22
23
|
* @internal
|
|
23
24
|
* @category Entities
|
|
24
25
|
*/
|
|
25
|
-
export declare function _getBoEntitiesFactory<
|
|
26
|
+
export declare function _getBoEntitiesFactory<E>(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: GetBoEntitiesParams) => E[]): (context: DvelopContext, params: GetBoEntitiesParams) => Promise<E[]>;
|
|
26
27
|
/**
|
|
27
28
|
* Returns all specified entities from a model.
|
|
29
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
28
30
|
*
|
|
31
|
+
* @example
|
|
29
32
|
* ```typescript
|
|
30
33
|
* import { getBoEntities } from "@dvelop-sdk/business-objects";
|
|
31
34
|
*
|
|
32
|
-
* const
|
|
35
|
+
* const employees = await getBoEntities({
|
|
33
36
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
34
37
|
* authSessionId: "3f3c428d452"
|
|
35
38
|
* },{
|
|
36
|
-
*
|
|
37
|
-
*
|
|
39
|
+
* modelName: "HOSPITALBASEDATA",
|
|
40
|
+
* pluralEntityName: "employees",
|
|
38
41
|
* });
|
|
39
|
-
* console.log(
|
|
42
|
+
* console.log(employees); // [{ employeeId: '1', firstName: 'John Micheal', lastName: 'Dorian', jobTitel: 'senior physician' }, { employeeId: '2', firstName: 'Christopher', lastName: 'Turk', jobTitel: 'chief surgeon' }]
|
|
40
43
|
* ```
|
|
41
44
|
* ---
|
|
42
45
|
* You can also use generics:
|
|
46
|
+
* @example
|
|
43
47
|
* ```typescript
|
|
44
48
|
* import { getBoEntities } from "@dvelop-sdk/business-objects";
|
|
45
49
|
*
|
|
46
|
-
* interface
|
|
50
|
+
* interface Employee {
|
|
51
|
+
* employeeId: string;
|
|
52
|
+
* firstName: string;
|
|
47
53
|
* lastName: string;
|
|
54
|
+
* jobTitel: string;
|
|
48
55
|
* }
|
|
49
56
|
*
|
|
50
|
-
* const
|
|
57
|
+
* const employees: Employee[] = await getBoEntities<Employee>({
|
|
51
58
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
52
59
|
* authSessionId: "3f3c428d452"
|
|
53
60
|
* },{
|
|
54
61
|
* modelName: "HOSPITALBASEDATA",
|
|
55
|
-
* pluralEntityName: "employees"
|
|
62
|
+
* pluralEntityName: "employees"
|
|
56
63
|
* });
|
|
57
64
|
*
|
|
58
|
-
*
|
|
59
|
-
* console.log(entity.lastName);
|
|
60
|
-
* });
|
|
65
|
+
* employees.forEach(e => console.log(e.lastName));
|
|
61
66
|
* // Dorian
|
|
62
67
|
* // Turk
|
|
63
68
|
* ```
|
|
64
69
|
*/
|
|
65
|
-
export declare function getBoEntities<
|
|
70
|
+
export declare function getBoEntities<E = any>(context: DvelopContext, params: GetBoEntitiesParams): Promise<E[]>;
|
|
66
71
|
//# sourceMappingURL=get-entities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entities.d.ts","sourceRoot":"","sources":["../../../src/entities/get-entities/get-entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAA+B,MAAM,kBAAkB,CAAC;AAEzF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"get-entities.d.ts","sourceRoot":"","sources":["../../../src/entities/get-entities/get-entities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAA+B,MAAM,kBAAkB,CAAC;AAEzF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,sCAAsC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,mBAAmB,GAAG,CAAC,EAAE,CAEhI;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,YAAY,CAAC,EAC1F,iBAAiB,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,KAAK,CAAC,EAAE,GACtG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAUvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,wBAAsB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAE9G"}
|
|
@@ -40,6 +40,7 @@ exports.getBoEntities = exports._getBoEntitiesFactory = exports._getBoEntitiesDe
|
|
|
40
40
|
var http_1 = require("../../utils/http");
|
|
41
41
|
/**
|
|
42
42
|
* Default transform-function provided to the {@link getBoEntities}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
43
|
+
* @template E Return type
|
|
43
44
|
* @internal
|
|
44
45
|
* @category Entities
|
|
45
46
|
*/
|
|
@@ -49,7 +50,7 @@ function _getBoEntitiesDefaultTransformFunction(response, _, __) {
|
|
|
49
50
|
exports._getBoEntitiesDefaultTransformFunction = _getBoEntitiesDefaultTransformFunction;
|
|
50
51
|
/**
|
|
51
52
|
* Factory for {@link getBoEntities}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
52
|
-
* @
|
|
53
|
+
* @template E Return type of the {@link getBoEntities}-function. A corresponding transformFunction has to be supplied.
|
|
53
54
|
* @internal
|
|
54
55
|
* @category Entities
|
|
55
56
|
*/
|
|
@@ -73,39 +74,43 @@ function _getBoEntitiesFactory(httpRequestFunction, transformFunction) {
|
|
|
73
74
|
exports._getBoEntitiesFactory = _getBoEntitiesFactory;
|
|
74
75
|
/**
|
|
75
76
|
* Returns all specified entities from a model.
|
|
77
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
76
78
|
*
|
|
79
|
+
* @example
|
|
77
80
|
* ```typescript
|
|
78
81
|
* import { getBoEntities } from "@dvelop-sdk/business-objects";
|
|
79
82
|
*
|
|
80
|
-
* const
|
|
83
|
+
* const employees = await getBoEntities({
|
|
81
84
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
82
85
|
* authSessionId: "3f3c428d452"
|
|
83
86
|
* },{
|
|
84
|
-
*
|
|
85
|
-
*
|
|
87
|
+
* modelName: "HOSPITALBASEDATA",
|
|
88
|
+
* pluralEntityName: "employees",
|
|
86
89
|
* });
|
|
87
|
-
* console.log(
|
|
90
|
+
* console.log(employees); // [{ employeeId: '1', firstName: 'John Micheal', lastName: 'Dorian', jobTitel: 'senior physician' }, { employeeId: '2', firstName: 'Christopher', lastName: 'Turk', jobTitel: 'chief surgeon' }]
|
|
88
91
|
* ```
|
|
89
92
|
* ---
|
|
90
93
|
* You can also use generics:
|
|
94
|
+
* @example
|
|
91
95
|
* ```typescript
|
|
92
96
|
* import { getBoEntities } from "@dvelop-sdk/business-objects";
|
|
93
97
|
*
|
|
94
|
-
* interface
|
|
98
|
+
* interface Employee {
|
|
99
|
+
* employeeId: string;
|
|
100
|
+
* firstName: string;
|
|
95
101
|
* lastName: string;
|
|
102
|
+
* jobTitel: string;
|
|
96
103
|
* }
|
|
97
104
|
*
|
|
98
|
-
* const
|
|
105
|
+
* const employees: Employee[] = await getBoEntities<Employee>({
|
|
99
106
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
100
107
|
* authSessionId: "3f3c428d452"
|
|
101
108
|
* },{
|
|
102
109
|
* modelName: "HOSPITALBASEDATA",
|
|
103
|
-
* pluralEntityName: "employees"
|
|
110
|
+
* pluralEntityName: "employees"
|
|
104
111
|
* });
|
|
105
112
|
*
|
|
106
|
-
*
|
|
107
|
-
* console.log(entity.lastName);
|
|
108
|
-
* });
|
|
113
|
+
* employees.forEach(e => console.log(e.lastName));
|
|
109
114
|
* // Dorian
|
|
110
115
|
* // Turk
|
|
111
116
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entities.js","sourceRoot":"","sources":["../../../src/entities/get-entities/get-entities.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;AAazF
|
|
1
|
+
{"version":3,"file":"get-entities.js","sourceRoot":"","sources":["../../../src/entities/get-entities/get-entities.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;AAazF;;;;;GAKG;AACH,SAAgB,sCAAsC,CAAI,QAAsB,EAAE,CAAgB,EAAE,EAAuB;IACzH,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;AAC7B,CAAC;AAFD,wFAEC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,mBAA0F,EAC1F,iBAAuG;IAFzG,iBAaC;IATC,OAAO,UAAO,OAAsB,EAAE,MAA2B;;;;wBAE9C,qBAAM,mBAAmB,CAAC,OAAO,EAAE;wBAClD,MAAM,EAAE,KAAK;wBACb,GAAG,EAAE,6BAA2B,MAAM,CAAC,SAAS,SAAI,MAAM,CAAC,gBAAkB;qBAC9E,CAAC,EAAA;;oBAHI,QAAQ,GAAG,SAGf;oBAEF,sBAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAC;;;SACrD,CAAC;AACJ,CAAC;AAbD,sDAaC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,0BAA0B;AAC1B,SAAsB,aAAa,CAAU,OAAsB,EAAE,MAA2B;;;;wBACvF,qBAAM,qBAAqB,CAAI,kCAA2B,EAAE,sCAAsC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;wBAA3H,sBAAO,SAAoH,EAAC;;;;CAC7H;AAFD,sCAEC"}
|
|
@@ -5,59 +5,73 @@ import { HttpConfig, HttpResponse } from "../../utils/http";
|
|
|
5
5
|
* @category Entity
|
|
6
6
|
*/
|
|
7
7
|
export interface GetBoEntityParams {
|
|
8
|
+
/** Name of the model */
|
|
8
9
|
modelName: string;
|
|
10
|
+
/** EntityName in plural (**Singular name won't work**) */
|
|
9
11
|
pluralEntityName: string;
|
|
10
|
-
|
|
12
|
+
/** Type of the key property */
|
|
13
|
+
keyPropertyType: "string" | "number" | "guid";
|
|
14
|
+
/** Key-property of the entity to be retrieved */
|
|
15
|
+
keyPropertyValue: string | number;
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* Default transform-function provided to the {@link getBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
19
|
+
* @template E Return type
|
|
14
20
|
* @internal
|
|
15
21
|
* @category Entity
|
|
16
22
|
*/
|
|
17
|
-
export declare function _getBoEntityDefaultTransformFunction<
|
|
23
|
+
export declare function _getBoEntityDefaultTransformFunction<E = any>(response: HttpResponse, _: DvelopContext, __: GetBoEntityParams): E;
|
|
18
24
|
/**
|
|
19
25
|
* Factory for {@link getBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
20
|
-
* @
|
|
26
|
+
* @template E Return type of the {@link getBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
21
27
|
* @internal
|
|
22
28
|
* @category Entity
|
|
23
29
|
*/
|
|
24
|
-
export declare function _getBoEntityFactory<
|
|
30
|
+
export declare function _getBoEntityFactory<E>(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: GetBoEntityParams) => E): (context: DvelopContext, params: GetBoEntityParams) => Promise<E>;
|
|
25
31
|
/**
|
|
26
32
|
* Returns one specified entity from a model.
|
|
33
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
27
34
|
*
|
|
35
|
+
* @example
|
|
28
36
|
* ```typescript
|
|
29
37
|
* import { getBoEntity } from "@dvelop-sdk/business-objects";
|
|
30
38
|
*
|
|
31
|
-
* const
|
|
39
|
+
* const jd = await getBoEntity({
|
|
32
40
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
33
41
|
* authSessionId: "3f3c428d452"
|
|
34
42
|
* },{
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
* modelName: "HOSPITALBASEDATA",
|
|
44
|
+
* pluralEntityName: "employees",
|
|
45
|
+
* keyPropertyType: "string", //"string", "number" or "guid"
|
|
46
|
+
* keyPropertyValue: "1"
|
|
38
47
|
* });
|
|
39
|
-
* console.log(
|
|
48
|
+
* console.log(jd); // { employeeId: '1', firstName: 'John Micheal', lastName: 'Dorian', jobTitel: 'senior physician' }
|
|
40
49
|
* ```
|
|
41
50
|
* ---
|
|
42
51
|
* You can also use generics:
|
|
52
|
+
* @example
|
|
43
53
|
* ```typescript
|
|
44
54
|
* import { getBoEntity } from "@dvelop-sdk/business-objects";
|
|
45
55
|
*
|
|
46
|
-
* interface
|
|
56
|
+
* interface Employee {
|
|
57
|
+
* employeeId: string;
|
|
58
|
+
* firstName: string;
|
|
47
59
|
* lastName: string;
|
|
60
|
+
* jobTitel: string;
|
|
48
61
|
* }
|
|
49
62
|
*
|
|
50
|
-
* const
|
|
63
|
+
* const jd: Employee = await getBoEntity<Employee>({
|
|
51
64
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
52
65
|
* authSessionId: "3f3c428d452"
|
|
53
66
|
* },{
|
|
54
67
|
* modelName: "HOSPITALBASEDATA",
|
|
55
68
|
* pluralEntityName: "employees",
|
|
56
|
-
*
|
|
69
|
+
* keyPropertyType: "string", //"string", "number" or "guid"
|
|
70
|
+
* keyPropertyValue: "1"
|
|
57
71
|
* });
|
|
58
72
|
*
|
|
59
|
-
* console.log(
|
|
73
|
+
* console.log(jd.lastName); // Dorian
|
|
60
74
|
* ```
|
|
61
75
|
*/
|
|
62
|
-
export declare function getBoEntity<
|
|
76
|
+
export declare function getBoEntity<E = any>(context: DvelopContext, params: GetBoEntityParams): Promise<E>;
|
|
63
77
|
//# sourceMappingURL=get-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/get-entity/get-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAA+B,MAAM,kBAAkB,CAAC;AAEzF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;
|
|
1
|
+
{"version":3,"file":"get-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/get-entity/get-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAA+B,MAAM,kBAAkB,CAAC;AAEzF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,eAAe,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,iDAAiD;IACjD,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,iBAAiB,GAAG,CAAC,CAGhI;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,YAAY,CAAC,EAC1F,iBAAiB,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,KAAK,CAAC,GAClG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,CAiBnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,wBAAsB,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CAExG"}
|
|
@@ -40,17 +40,18 @@ exports.getBoEntity = exports._getBoEntityFactory = exports._getBoEntityDefaultT
|
|
|
40
40
|
var http_1 = require("../../utils/http");
|
|
41
41
|
/**
|
|
42
42
|
* Default transform-function provided to the {@link getBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
43
|
+
* @template E Return type
|
|
43
44
|
* @internal
|
|
44
45
|
* @category Entity
|
|
45
46
|
*/
|
|
46
47
|
function _getBoEntityDefaultTransformFunction(response, _, __) {
|
|
47
|
-
// TODO delete @odata.context!
|
|
48
|
+
// TODO: delete @odata.context!
|
|
48
49
|
return response.data;
|
|
49
50
|
}
|
|
50
51
|
exports._getBoEntityDefaultTransformFunction = _getBoEntityDefaultTransformFunction;
|
|
51
52
|
/**
|
|
52
53
|
* Factory for {@link getBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
53
|
-
* @
|
|
54
|
+
* @template E Return type of the {@link getBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
54
55
|
* @internal
|
|
55
56
|
* @category Entity
|
|
56
57
|
*/
|
|
@@ -61,11 +62,11 @@ function _getBoEntityFactory(httpRequestFunction, transformFunction) {
|
|
|
61
62
|
return __generator(this, function (_a) {
|
|
62
63
|
switch (_a.label) {
|
|
63
64
|
case 0:
|
|
64
|
-
if (
|
|
65
|
-
urlEntityKeyValue = params.
|
|
65
|
+
if (params.keyPropertyType === "number" || params.keyPropertyType === "guid") {
|
|
66
|
+
urlEntityKeyValue = params.keyPropertyValue;
|
|
66
67
|
}
|
|
67
68
|
else {
|
|
68
|
-
urlEntityKeyValue = "'" + params.
|
|
69
|
+
urlEntityKeyValue = "'" + params.keyPropertyValue + "'";
|
|
69
70
|
}
|
|
70
71
|
return [4 /*yield*/, httpRequestFunction(context, {
|
|
71
72
|
method: "GET",
|
|
@@ -81,39 +82,47 @@ function _getBoEntityFactory(httpRequestFunction, transformFunction) {
|
|
|
81
82
|
exports._getBoEntityFactory = _getBoEntityFactory;
|
|
82
83
|
/**
|
|
83
84
|
* Returns one specified entity from a model.
|
|
85
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
84
86
|
*
|
|
87
|
+
* @example
|
|
85
88
|
* ```typescript
|
|
86
89
|
* import { getBoEntity } from "@dvelop-sdk/business-objects";
|
|
87
90
|
*
|
|
88
|
-
* const
|
|
91
|
+
* const jd = await getBoEntity({
|
|
89
92
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
90
93
|
* authSessionId: "3f3c428d452"
|
|
91
94
|
* },{
|
|
92
|
-
*
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
* modelName: "HOSPITALBASEDATA",
|
|
96
|
+
* pluralEntityName: "employees",
|
|
97
|
+
* keyPropertyType: "string", //"string", "number" or "guid"
|
|
98
|
+
* keyPropertyValue: "1"
|
|
95
99
|
* });
|
|
96
|
-
* console.log(
|
|
100
|
+
* console.log(jd); // { employeeId: '1', firstName: 'John Micheal', lastName: 'Dorian', jobTitel: 'senior physician' }
|
|
97
101
|
* ```
|
|
98
102
|
* ---
|
|
99
103
|
* You can also use generics:
|
|
104
|
+
* @example
|
|
100
105
|
* ```typescript
|
|
101
106
|
* import { getBoEntity } from "@dvelop-sdk/business-objects";
|
|
102
107
|
*
|
|
103
|
-
* interface
|
|
108
|
+
* interface Employee {
|
|
109
|
+
* employeeId: string;
|
|
110
|
+
* firstName: string;
|
|
104
111
|
* lastName: string;
|
|
112
|
+
* jobTitel: string;
|
|
105
113
|
* }
|
|
106
114
|
*
|
|
107
|
-
* const
|
|
115
|
+
* const jd: Employee = await getBoEntity<Employee>({
|
|
108
116
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
109
117
|
* authSessionId: "3f3c428d452"
|
|
110
118
|
* },{
|
|
111
119
|
* modelName: "HOSPITALBASEDATA",
|
|
112
120
|
* pluralEntityName: "employees",
|
|
113
|
-
*
|
|
121
|
+
* keyPropertyType: "string", //"string", "number" or "guid"
|
|
122
|
+
* keyPropertyValue: "1"
|
|
114
123
|
* });
|
|
115
124
|
*
|
|
116
|
-
* console.log(
|
|
125
|
+
* console.log(jd.lastName); // Dorian
|
|
117
126
|
* ```
|
|
118
127
|
*/
|
|
119
128
|
/* istanbul ignore next */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-entity.js","sourceRoot":"","sources":["../../../src/entities/get-entity/get-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;
|
|
1
|
+
{"version":3,"file":"get-entity.js","sourceRoot":"","sources":["../../../src/entities/get-entity/get-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;AAiBzF;;;;;GAKG;AACH,SAAgB,oCAAoC,CAAU,QAAsB,EAAE,CAAgB,EAAE,EAAqB;IAC3H,+BAA+B;IAC/B,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC;AAHD,oFAGC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CACjC,mBAA0F,EAC1F,iBAAmG;IAFrG,iBAoBC;IAhBC,OAAO,UAAO,OAAsB,EAAE,MAAyB;;;;;oBAG7D,IAAI,MAAM,CAAC,eAAe,KAAK,QAAQ,IAAI,MAAM,CAAC,eAAe,KAAK,MAAM,EAAE;wBAC5E,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;qBAC7C;yBAAM;wBACL,iBAAiB,GAAG,MAAI,MAAM,CAAC,gBAAgB,MAAG,CAAC;qBACpD;oBAEgB,qBAAM,mBAAmB,CAAC,OAAO,EAAE;4BAClD,MAAM,EAAE,KAAK;4BACb,GAAG,EAAE,6BAA2B,MAAM,CAAC,SAAS,SAAI,MAAM,CAAC,gBAAgB,SAAI,iBAAiB,MAAG;yBACpG,CAAC,EAAA;;oBAHI,QAAQ,GAAG,SAGf;oBAEF,sBAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAC;;;SACrD,CAAC;AACJ,CAAC;AApBD,kDAoBC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,0BAA0B;AAC1B,SAAsB,WAAW,CAAU,OAAsB,EAAE,MAAyB;;;;wBACnF,qBAAM,mBAAmB,CAAI,kCAA2B,EAAE,oCAAoC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;wBAAvH,sBAAO,SAAgH,EAAC;;;;CACzH;AAFD,kCAEC"}
|
|
@@ -2,24 +2,33 @@ import { DvelopContext } from "@dvelop-sdk/core";
|
|
|
2
2
|
import { HttpConfig, HttpResponse } from "../../utils/http";
|
|
3
3
|
/**
|
|
4
4
|
* Parameters for the {@link updateBoEntity}-function.
|
|
5
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
5
6
|
* @category Entity
|
|
6
7
|
*/
|
|
7
|
-
export interface UpdateBoEntityParams {
|
|
8
|
+
export interface UpdateBoEntityParams<E = any> {
|
|
9
|
+
/** Name of the model */
|
|
8
10
|
modelName: string;
|
|
11
|
+
/** EntityName in plural (**Singular name won't work**) */
|
|
9
12
|
pluralEntityName: string;
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
/** Type of the key property */
|
|
14
|
+
keyPropertyType: "string" | "number" | "guid";
|
|
15
|
+
/** Key-property of the entity to be updated */
|
|
16
|
+
keyPropertyValue: string | number;
|
|
17
|
+
/** [Partial](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype) of `E`. Given properties will be updated. */
|
|
18
|
+
entityChange: Partial<E>;
|
|
12
19
|
}
|
|
13
20
|
/**
|
|
14
21
|
* Factory for {@link updateBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
15
|
-
* @
|
|
22
|
+
* @template E Return type of the {@link updateBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
16
23
|
* @internal
|
|
17
24
|
* @category Entity
|
|
18
25
|
*/
|
|
19
|
-
export declare function _updateBoEntityFactory(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: UpdateBoEntityParams) =>
|
|
26
|
+
export declare function _updateBoEntityFactory<E, R>(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: UpdateBoEntityParams<E>) => R): (context: DvelopContext, params: UpdateBoEntityParams) => Promise<R>;
|
|
20
27
|
/**
|
|
21
28
|
* Update a business object entity.
|
|
29
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
22
30
|
*
|
|
31
|
+
* @example
|
|
23
32
|
* ```typescript
|
|
24
33
|
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
25
34
|
*
|
|
@@ -27,35 +36,41 @@ export declare function _updateBoEntityFactory(httpRequestFunction: (context: Dv
|
|
|
27
36
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
28
37
|
* authSessionId: "3f3c428d452"
|
|
29
38
|
* },{
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
39
|
+
* modelName: "HOSPITALBASEDATA",
|
|
40
|
+
* pluralEntityName: "employees",
|
|
41
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
42
|
+
* keyPropertyValue: 1,
|
|
43
|
+
* entityChange: {
|
|
44
|
+
* "firstName": "J.D."
|
|
45
|
+
* }
|
|
36
46
|
* });
|
|
37
47
|
* ```
|
|
38
|
-
|
|
39
|
-
* You can also
|
|
48
|
+
* ---
|
|
49
|
+
* You can also use generics:
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
40
52
|
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
41
53
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
54
|
+
* interface Employee {
|
|
55
|
+
* employeeId: string;
|
|
56
|
+
* firstName: string;
|
|
57
|
+
* lastName: string;
|
|
58
|
+
* jobTitel: string;
|
|
59
|
+
* }
|
|
45
60
|
*
|
|
46
|
-
*
|
|
61
|
+
* await updateBoEntity<Employee>({
|
|
47
62
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
48
63
|
* authSessionId: "3f3c428d452"
|
|
49
64
|
* },{
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
65
|
+
* modelName: "HOSPITALBASEDATA",
|
|
66
|
+
* pluralEntityName: "employees",
|
|
67
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
68
|
+
* keyPropertyValue: 1,
|
|
69
|
+
* entityChange: {
|
|
70
|
+
* "firstName": "John Micheal (J.D.)"
|
|
71
|
+
* }
|
|
56
72
|
* });
|
|
57
|
-
* console.log(responseMessage); // My own transform function message
|
|
58
73
|
* ```
|
|
59
74
|
*/
|
|
60
|
-
export declare function updateBoEntity(context: DvelopContext, params: UpdateBoEntityParams): Promise<void>;
|
|
75
|
+
export declare function updateBoEntity<E = any>(context: DvelopContext, params: UpdateBoEntityParams<E>): Promise<void>;
|
|
61
76
|
//# sourceMappingURL=update-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/update-entity/update-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAA+B,MAAM,kBAAkB,CAAC;AAEzF
|
|
1
|
+
{"version":3,"file":"update-entity.d.ts","sourceRoot":"","sources":["../../../src/entities/update-entity/update-entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAA+B,MAAM,kBAAkB,CAAC;AAEzF;;;;GAIG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,GAAG;IAC3C,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,gBAAgB,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,eAAe,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,+CAA+C;IAC/C,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,uIAAuI;IACvI,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,CAAC,EACzC,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,YAAY,CAAC,EAC1F,iBAAiB,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,GACxG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,CAAC,CAAC,CAkBtE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,wBAAsB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpH"}
|
|
@@ -40,7 +40,7 @@ exports.updateBoEntity = exports._updateBoEntityFactory = void 0;
|
|
|
40
40
|
var http_1 = require("../../utils/http");
|
|
41
41
|
/**
|
|
42
42
|
* Factory for {@link updateBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
43
|
-
* @
|
|
43
|
+
* @template E Return type of the {@link updateBoEntity}-function. A corresponding transformFunction has to be supplied.
|
|
44
44
|
* @internal
|
|
45
45
|
* @category Entity
|
|
46
46
|
*/
|
|
@@ -51,11 +51,11 @@ function _updateBoEntityFactory(httpRequestFunction, transformFunction) {
|
|
|
51
51
|
return __generator(this, function (_a) {
|
|
52
52
|
switch (_a.label) {
|
|
53
53
|
case 0:
|
|
54
|
-
if (
|
|
55
|
-
urlEntityKeyValue = params.
|
|
54
|
+
if (params.keyPropertyType === "number" || params.keyPropertyType === "guid") {
|
|
55
|
+
urlEntityKeyValue = params.keyPropertyValue;
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
urlEntityKeyValue = "'" + params.
|
|
58
|
+
urlEntityKeyValue = "'" + params.keyPropertyValue + "'";
|
|
59
59
|
}
|
|
60
60
|
return [4 /*yield*/, httpRequestFunction(context, {
|
|
61
61
|
method: "PUT",
|
|
@@ -72,7 +72,9 @@ function _updateBoEntityFactory(httpRequestFunction, transformFunction) {
|
|
|
72
72
|
exports._updateBoEntityFactory = _updateBoEntityFactory;
|
|
73
73
|
/**
|
|
74
74
|
* Update a business object entity.
|
|
75
|
+
* @template E Type for Entity. Defaults to `any`.
|
|
75
76
|
*
|
|
77
|
+
* @example
|
|
76
78
|
* ```typescript
|
|
77
79
|
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
78
80
|
*
|
|
@@ -80,34 +82,40 @@ exports._updateBoEntityFactory = _updateBoEntityFactory;
|
|
|
80
82
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
81
83
|
* authSessionId: "3f3c428d452"
|
|
82
84
|
* },{
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
85
|
+
* modelName: "HOSPITALBASEDATA",
|
|
86
|
+
* pluralEntityName: "employees",
|
|
87
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
88
|
+
* keyPropertyValue: 1,
|
|
89
|
+
* entityChange: {
|
|
90
|
+
* "firstName": "J.D."
|
|
91
|
+
* }
|
|
89
92
|
* });
|
|
90
93
|
* ```
|
|
91
|
-
|
|
92
|
-
* You can also
|
|
94
|
+
* ---
|
|
95
|
+
* You can also use generics:
|
|
96
|
+
* @example
|
|
97
|
+
* ```typescript
|
|
93
98
|
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
94
99
|
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
100
|
+
* interface Employee {
|
|
101
|
+
* employeeId: string;
|
|
102
|
+
* firstName: string;
|
|
103
|
+
* lastName: string;
|
|
104
|
+
* jobTitel: string;
|
|
105
|
+
* }
|
|
98
106
|
*
|
|
99
|
-
*
|
|
107
|
+
* await updateBoEntity<Employee>({
|
|
100
108
|
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
101
109
|
* authSessionId: "3f3c428d452"
|
|
102
110
|
* },{
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
111
|
+
* modelName: "HOSPITALBASEDATA",
|
|
112
|
+
* pluralEntityName: "employees",
|
|
113
|
+
* keyPropertyType: "number", //"string", "number" or "guid"
|
|
114
|
+
* keyPropertyValue: 1,
|
|
115
|
+
* entityChange: {
|
|
116
|
+
* "firstName": "John Micheal (J.D.)"
|
|
117
|
+
* }
|
|
109
118
|
* });
|
|
110
|
-
* console.log(responseMessage); // My own transform function message
|
|
111
119
|
* ```
|
|
112
120
|
*/
|
|
113
121
|
/* istanbul ignore next */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-entity.js","sourceRoot":"","sources":["../../../src/entities/update-entity/update-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;
|
|
1
|
+
{"version":3,"file":"update-entity.js","sourceRoot":"","sources":["../../../src/entities/update-entity/update-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;AAoBzF;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,mBAA0F,EAC1F,iBAAyG;IAF3G,iBAqBC;IAjBC,OAAO,UAAO,OAAsB,EAAE,MAA+B;;;;;oBAGnE,IAAI,MAAM,CAAC,eAAe,KAAK,QAAQ,IAAI,MAAM,CAAC,eAAe,KAAK,MAAM,EAAE;wBAC5E,iBAAiB,GAAG,MAAM,CAAC,gBAAgB,CAAC;qBAC7C;yBAAM;wBACL,iBAAiB,GAAG,MAAI,MAAM,CAAC,gBAAgB,MAAG,CAAC;qBACpD;oBAEgB,qBAAM,mBAAmB,CAAC,OAAO,EAAE;4BAClD,MAAM,EAAE,KAAK;4BACb,GAAG,EAAE,6BAA2B,MAAM,CAAC,SAAS,SAAI,MAAM,CAAC,gBAAgB,SAAI,iBAAiB,MAAG;4BACnG,IAAI,EAAE,MAAM,CAAC,YAAY;yBAC1B,CAAC,EAAA;;oBAJI,QAAQ,GAAG,SAIf;oBAEF,sBAAO,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAC;;;SACrD,CAAC;AACJ,CAAC;AArBD,wDAqBC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,0BAA0B;AAC1B,SAAsB,cAAc,CAAU,OAAsB,EAAE,MAA+B;;;;wBAC5F,qBAAM,sBAAsB,CAAU,kCAA2B,EAAE,cAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;wBAArG,sBAAO,SAA8F,EAAC;;;;CACvG;AAFD,wCAEC"}
|
package/lib/utils/http.d.ts
CHANGED
|
@@ -27,6 +27,15 @@ export declare class BusinessObjectsError extends DvelopSdkError {
|
|
|
27
27
|
originalError?: Error | undefined;
|
|
28
28
|
constructor(message: string, originalError?: Error | undefined);
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* TODO: Generic Error for business-objects package.
|
|
32
|
+
* @category Error
|
|
33
|
+
*/
|
|
34
|
+
export declare class NotImplementedError extends DvelopSdkError {
|
|
35
|
+
message: string;
|
|
36
|
+
originalError?: Error | undefined;
|
|
37
|
+
constructor(message: string, originalError?: Error | undefined);
|
|
38
|
+
}
|
|
30
39
|
/**
|
|
31
40
|
* Factory used to create the default httpRequestFunction. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
32
41
|
* @internal
|
package/lib/utils/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,gBAAgB,EAAmG,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjO,OAAO,EAAE,uBAAuB,IAAI,UAAU,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE7G;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE;QAEL,IAAI,EAAE,MAAM,CAAC;QAEb,OAAO,EAAE,MAAM,CAAC;QAEhB,OAAO,EAAE;YAEP,IAAI,EAAE,MAAM,CAAC;YAEb,OAAO,EAAE,MAAM,CAAC;SACjB,EAAE,CAAC;QAEJ,UAAU,EAAE;YAEV,SAAS,EAAE,MAAM,CAAC;YAElB,SAAS,EAAE,MAAM,CAAC;SACnB,CAAA;KACF,CAAA;CACF;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,gBAAgB,EAAmG,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjO,OAAO,EAAE,uBAAuB,IAAI,UAAU,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE7G;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE;QAEL,IAAI,EAAE,MAAM,CAAC;QAEb,OAAO,EAAE,MAAM,CAAC;QAEhB,OAAO,EAAE;YAEP,IAAI,EAAE,MAAM,CAAC;YAEb,OAAO,EAAE,MAAM,CAAC;SACjB,EAAE,CAAC;QAEJ,UAAU,EAAE;YAEV,SAAS,EAAE,MAAM,CAAC;YAElB,SAAS,EAAE,MAAM,CAAC;SACnB,CAAA;KACF,CAAA;CACF;AAoBD;;;EAGE;AAEF,qBAAa,oBAAqB,SAAQ,cAAc;IAEnC,OAAO,EAAE,MAAM;IAAS,aAAa,CAAC;gBAAtC,OAAO,EAAE,MAAM,EAAS,aAAa,CAAC,mBAAO;CAIjE;AAED;;;EAGE;AAEF,qBAAa,mBAAoB,SAAQ,cAAc;IAElC,OAAO,EAAE,MAAM;IAAS,aAAa,CAAC;gBAAtC,OAAO,EAAE,MAAM,EAAS,aAAa,CAAC,mBAAO;CAIjE;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,UAAU,EAAE,gBAAgB,GAAG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAsCzK;AAGD;;;;GAIG;AAEH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAEtI"}
|
package/lib/utils/http.js
CHANGED
|
@@ -51,11 +51,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports._defaultHttpRequestFunction = exports._defaultHttpRequestFunctionFactory = exports.BusinessObjectsError = void 0;
|
|
54
|
+
exports._defaultHttpRequestFunction = exports._defaultHttpRequestFunctionFactory = exports.NotImplementedError = exports.BusinessObjectsError = void 0;
|
|
55
55
|
var core_1 = require("@dvelop-sdk/core");
|
|
56
56
|
function getErrorString(error) {
|
|
57
57
|
if (error === null || error === void 0 ? void 0 : error.error) {
|
|
58
|
-
|
|
58
|
+
var detailString = "";
|
|
59
|
+
if (error.error.details && error.error.details.length > 0) {
|
|
60
|
+
detailString = error.error.details
|
|
61
|
+
.reduce(function (detailString, detail) { return detailString += "\t * " + detail.message + " (" + detail.code + ")\n"; }, "\n");
|
|
62
|
+
}
|
|
63
|
+
return error.error.message + " (" + error.error.code + ")." + detailString + "\nSee 'See 'originalError'-property for details.'";
|
|
59
64
|
}
|
|
60
65
|
else {
|
|
61
66
|
return null;
|
|
@@ -79,6 +84,24 @@ var BusinessObjectsError = /** @class */ (function (_super) {
|
|
|
79
84
|
return BusinessObjectsError;
|
|
80
85
|
}(core_1.DvelopSdkError));
|
|
81
86
|
exports.BusinessObjectsError = BusinessObjectsError;
|
|
87
|
+
/**
|
|
88
|
+
* TODO: Generic Error for business-objects package.
|
|
89
|
+
* @category Error
|
|
90
|
+
*/
|
|
91
|
+
/* istanbul ignore next */
|
|
92
|
+
var NotImplementedError = /** @class */ (function (_super) {
|
|
93
|
+
__extends(NotImplementedError, _super);
|
|
94
|
+
// eslint-disable-next-line no-unused-vars
|
|
95
|
+
function NotImplementedError(message, originalError) {
|
|
96
|
+
var _this = _super.call(this, message) || this;
|
|
97
|
+
_this.message = message;
|
|
98
|
+
_this.originalError = originalError;
|
|
99
|
+
Object.setPrototypeOf(_this, NotImplementedError.prototype);
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
return NotImplementedError;
|
|
103
|
+
}(core_1.DvelopSdkError));
|
|
104
|
+
exports.NotImplementedError = NotImplementedError;
|
|
82
105
|
/**
|
|
83
106
|
* Factory used to create the default httpRequestFunction. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
84
107
|
* @internal
|
|
@@ -111,6 +134,8 @@ function _defaultHttpRequestFunctionFactory(httpClient) {
|
|
|
111
134
|
throw new core_1.ForbiddenError(getErrorString(error_1.response.data) || "BusinessObjects-App responded with Status 403 indicating a forbidden action. See 'originalError'-property for details.", error_1);
|
|
112
135
|
case 404:
|
|
113
136
|
throw new core_1.NotFoundError(getErrorString(error_1.response.data) || "BusinessObjects-App responded with Status 404 indicating a requested resource does not exist. See 'originalError'-property for details.", error_1);
|
|
137
|
+
case 501:
|
|
138
|
+
throw new NotImplementedError(getErrorString(error_1.response.data) || "BusinessObjects-App responded with Status 501 indicating a requested feature is not implemented. See 'originalError'-property for details.", error_1);
|
|
114
139
|
default:
|
|
115
140
|
throw new BusinessObjectsError(getErrorString(error_1.response.data) || "BusinessObjects-App responded with status " + error_1.response.status + ". See 'originalError'-property for details.", error_1);
|
|
116
141
|
}
|
package/lib/utils/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAiO;AA8BjO,SAAS,cAAc,CAAC,KAA8B;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvelop-sdk/business-objects",
|
|
3
3
|
"description": "This package contains functionality for the BusinessObjects-App in the d.velop cloud.",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.5",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -25,4 +25,4 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@dvelop-sdk/core": "^2.0.0"
|
|
27
27
|
}
|
|
28
|
-
}
|
|
28
|
+
}
|