@dvelop-sdk/business-objects 1.0.0-alpha.0 → 1.0.0-beta.2

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.
Files changed (33) hide show
  1. package/lib/entities/create-entity/create-entity.d.ts +66 -0
  2. package/lib/entities/create-entity/create-entity.d.ts.map +1 -0
  3. package/lib/entities/create-entity/create-entity.js +124 -0
  4. package/lib/entities/create-entity/create-entity.js.map +1 -0
  5. package/lib/entities/delete-entity/delete-entity.d.ts +56 -0
  6. package/lib/entities/delete-entity/delete-entity.d.ts.map +1 -0
  7. package/lib/entities/delete-entity/delete-entity.js +120 -0
  8. package/lib/entities/delete-entity/delete-entity.js.map +1 -0
  9. package/lib/entities/get-entities/get-entities.d.ts +66 -0
  10. package/lib/entities/get-entities/get-entities.d.ts.map +1 -0
  11. package/lib/entities/get-entities/get-entities.js +125 -0
  12. package/lib/entities/get-entities/get-entities.js.map +1 -0
  13. package/lib/entities/get-entity/get-entity.d.ts +63 -0
  14. package/lib/entities/get-entity/get-entity.d.ts.map +1 -0
  15. package/lib/entities/get-entity/get-entity.js +131 -0
  16. package/lib/entities/get-entity/get-entity.js.map +1 -0
  17. package/lib/entities/update-entity/update-entity.d.ts +61 -0
  18. package/lib/entities/update-entity/update-entity.d.ts.map +1 -0
  19. package/lib/entities/update-entity/update-entity.js +125 -0
  20. package/lib/entities/update-entity/update-entity.js.map +1 -0
  21. package/lib/index.d.ts +7 -0
  22. package/lib/index.d.ts.map +1 -1
  23. package/lib/index.js +33 -1
  24. package/lib/index.js.map +1 -1
  25. package/lib/internal.d.ts +7 -0
  26. package/lib/internal.d.ts.map +1 -0
  27. package/lib/internal.js +19 -0
  28. package/lib/internal.js.map +1 -0
  29. package/lib/utils/http.d.ts +42 -0
  30. package/lib/utils/http.d.ts.map +1 -0
  31. package/lib/utils/http.js +142 -0
  32. package/lib/utils/http.js.map +1 -0
  33. package/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ import { DvelopContext, DvelopHttpResponse as HttpResponse } from "@dvelop-sdk/core";
2
+ import { HttpConfig } from "../../utils/http";
3
+ /**
4
+ * Parameters for the {@link createBoEntity}-function.
5
+ * @category Entity
6
+ */
7
+ export interface CreateBoEntityParams {
8
+ modelName: string;
9
+ pluralEntityName: string;
10
+ entity: Object;
11
+ }
12
+ /**
13
+ * Factory for {@link createBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
14
+ * @typeparam
15
+ * @internal
16
+ * @category Entity
17
+ */
18
+ export declare function _createBoEntityFactory(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: CreateBoEntityParams) => void): (context: DvelopContext, params: CreateBoEntityParams) => Promise<void>;
19
+ /**
20
+ * Create a business object entity.
21
+ *
22
+ * ```typescript
23
+ * import { createBoEntity } from "@dvelop-sdk/business-objects";
24
+ *
25
+ * await createBoEntity({
26
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
27
+ * authSessionId: "3f3c428d452"
28
+ * },{
29
+ * modelName: "HOSPITALBASEDATA",
30
+ * pluralEntityName: "employees",
31
+ * entity: {
32
+ * "employeeid": "1",
33
+ * "firstName": "John",
34
+ * "lastName": "Dorian",
35
+ * "jobTitel": "senior physician"
36
+ * }
37
+ * });
38
+ * ```
39
+ * ---
40
+ * You can also write your own function, for example to get a notification, if the entity was successfully created.
41
+ * import { createBoEntity } from "@dvelop-sdk/business-objects";
42
+ *
43
+ * const myCreateFunction = _createBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
44
+ * if(response.status == 201) {
45
+ * retrun "Entity created successfully.";
46
+ * }
47
+ * })
48
+ *
49
+ * const responseMessage = await myCreateFunction({
50
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
51
+ * authSessionId: "3f3c428d452"
52
+ * },{
53
+ * modelName: "HOSPITALBASEDATA",
54
+ * pluralEntityName: "employees",
55
+ * entity: {
56
+ * "employeeid": "1",
57
+ * "firstName": "John",
58
+ * "lastName": "Dorian",
59
+ * "jobTitel": "senior physician"
60
+ * }
61
+ * });
62
+ * console.log(responseMessage); // Entity created successfully.
63
+ * ```
64
+ */
65
+ export declare function createBoEntity(context: DvelopContext, params: CreateBoEntityParams): Promise<void>;
66
+ //# sourceMappingURL=create-entity.d.ts.map
@@ -0,0 +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;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,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,IAAI,GACxG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAWzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,wBAAsB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAExG"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.createBoEntity = exports._createBoEntityFactory = void 0;
40
+ var http_1 = require("../../utils/http");
41
+ /**
42
+ * Factory for {@link createBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
43
+ * @typeparam
44
+ * @internal
45
+ * @category Entity
46
+ */
47
+ function _createBoEntityFactory(httpRequestFunction, transformFunction) {
48
+ var _this = this;
49
+ return function (context, params) { return __awaiter(_this, void 0, void 0, function () {
50
+ var response;
51
+ return __generator(this, function (_a) {
52
+ switch (_a.label) {
53
+ case 0: return [4 /*yield*/, httpRequestFunction(context, {
54
+ method: "POST",
55
+ url: "/businessobjects/custom/" + params.modelName + "/" + params.pluralEntityName,
56
+ data: params.entity
57
+ })];
58
+ case 1:
59
+ response = _a.sent();
60
+ return [2 /*return*/, transformFunction(response, context, params)];
61
+ }
62
+ });
63
+ }); };
64
+ }
65
+ exports._createBoEntityFactory = _createBoEntityFactory;
66
+ /**
67
+ * Create a business object entity.
68
+ *
69
+ * ```typescript
70
+ * import { createBoEntity } from "@dvelop-sdk/business-objects";
71
+ *
72
+ * await createBoEntity({
73
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
74
+ * authSessionId: "3f3c428d452"
75
+ * },{
76
+ * modelName: "HOSPITALBASEDATA",
77
+ * pluralEntityName: "employees",
78
+ * entity: {
79
+ * "employeeid": "1",
80
+ * "firstName": "John",
81
+ * "lastName": "Dorian",
82
+ * "jobTitel": "senior physician"
83
+ * }
84
+ * });
85
+ * ```
86
+ * ---
87
+ * You can also write your own function, for example to get a notification, if the entity was successfully created.
88
+ * import { createBoEntity } from "@dvelop-sdk/business-objects";
89
+ *
90
+ * const myCreateFunction = _createBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
91
+ * if(response.status == 201) {
92
+ * retrun "Entity created successfully.";
93
+ * }
94
+ * })
95
+ *
96
+ * const responseMessage = await myCreateFunction({
97
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
98
+ * authSessionId: "3f3c428d452"
99
+ * },{
100
+ * modelName: "HOSPITALBASEDATA",
101
+ * pluralEntityName: "employees",
102
+ * entity: {
103
+ * "employeeid": "1",
104
+ * "firstName": "John",
105
+ * "lastName": "Dorian",
106
+ * "jobTitel": "senior physician"
107
+ * }
108
+ * });
109
+ * console.log(responseMessage); // Entity created successfully.
110
+ * ```
111
+ */
112
+ /* istanbul ignore next */
113
+ function createBoEntity(context, params) {
114
+ return __awaiter(this, void 0, void 0, function () {
115
+ return __generator(this, function (_a) {
116
+ switch (_a.label) {
117
+ case 0: return [4 /*yield*/, _createBoEntityFactory(http_1._defaultHttpRequestFunction, function () { })(context, params)];
118
+ case 1: return [2 /*return*/, _a.sent()];
119
+ }
120
+ });
121
+ });
122
+ }
123
+ exports.createBoEntity = createBoEntity;
124
+ //# sourceMappingURL=create-entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-entity.js","sourceRoot":"","sources":["../../../src/entities/create-entity/create-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA2E;AAY3E;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,mBAA0F,EAC1F,iBAAyG;IAF3G,iBAcC;IAVC,OAAO,UAAO,OAAsB,EAAE,MAA4B;;;;wBAE/C,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,0BAA0B;AAC1B,SAAsB,cAAc,CAAC,OAAsB,EAAE,MAA4B;;;;wBAChF,qBAAM,sBAAsB,CAAC,kCAA2B,EAAE,cAAK,CAAC,CAAC,CAAE,OAAO,EAAE,MAAM,CAAC,EAAA;wBAA1F,sBAAO,SAAmF,EAAC;;;;CAC5F;AAFD,wCAEC"}
@@ -0,0 +1,56 @@
1
+ import { DvelopContext, DvelopHttpResponse as HttpResponse } from "@dvelop-sdk/core";
2
+ import { HttpConfig } from "../../utils/http";
3
+ /**
4
+ * Parameters for the {@link deleteBoEntity}-function.
5
+ * @category Entity
6
+ */
7
+ export interface DeleteBoEntityParams {
8
+ modelName: string;
9
+ pluralEntityName: string;
10
+ entityKeyValue: string | number;
11
+ }
12
+ /**
13
+ * Factory for {@link deleteBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
14
+ * @typeparam
15
+ * @internal
16
+ * @category Entity
17
+ */
18
+ export declare function _deleteBoEntityFactory(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: DeleteBoEntityParams) => void): (context: DvelopContext, params: DeleteBoEntityParams) => Promise<void>;
19
+ /**
20
+ * Delete a business object entity.
21
+ *
22
+ * ```typescript
23
+ * import { deleteBoEntity } from "@dvelop-sdk/business-objects";
24
+ *
25
+ * await deleteBoEntity({
26
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
27
+ * authSessionId: "3f3c428d452"
28
+ * },{
29
+ * modelName: "HOSPITALBASEDATA",
30
+ * pluralEntityName: "employees",
31
+ * entityKeyValue: 1
32
+ * });
33
+ * ```
34
+ * ---
35
+ * You can also write your own function, for example to get a notification, if the entity requested for deletion doesn't exist.
36
+ * import { deleteBoEntity } from "@dvelop-sdk/business-objects";
37
+ *
38
+ * const myDeleteFunction = _deleteBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
39
+ * if(response.status === 204) {
40
+ * return "Entity requested for deletion does not exist.";
41
+ * }
42
+ * })
43
+ *
44
+ * const responseMessage = await myDeleteFunction({
45
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
46
+ * authSessionId: "3f3c428d452"
47
+ * },{
48
+ * modelName: "HOSPITALBASEDATA",
49
+ * pluralEntityName: "employees",
50
+ * entityKeyValue: 1
51
+ * });
52
+ * console.log(responseMessage); // Entity requested for deletion does not exist.
53
+ * ```
54
+ */
55
+ export declare function deleteBoEntity(context: DvelopContext, params: DeleteBoEntityParams): Promise<void>;
56
+ //# sourceMappingURL=delete-entity.d.ts.map
@@ -0,0 +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;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,GAAC,MAAM,CAAC;CACjC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,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,IAAI,GACxG,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,KAAK,OAAO,CAAC,IAAI,CAAC,CAiBzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,wBAAsB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAExG"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.deleteBoEntity = exports._deleteBoEntityFactory = void 0;
40
+ var http_1 = require("../../utils/http");
41
+ /**
42
+ * Factory for {@link deleteBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
43
+ * @typeparam
44
+ * @internal
45
+ * @category Entity
46
+ */
47
+ function _deleteBoEntityFactory(httpRequestFunction, transformFunction) {
48
+ var _this = this;
49
+ return function (context, params) { return __awaiter(_this, void 0, void 0, function () {
50
+ var urlEntityKeyValue, response;
51
+ return __generator(this, function (_a) {
52
+ switch (_a.label) {
53
+ case 0:
54
+ if (typeof params.entityKeyValue === "number") {
55
+ urlEntityKeyValue = params.entityKeyValue;
56
+ }
57
+ else {
58
+ urlEntityKeyValue = "'" + params.entityKeyValue + "'";
59
+ }
60
+ return [4 /*yield*/, httpRequestFunction(context, {
61
+ method: "DELETE",
62
+ url: "/businessobjects/custom/" + params.modelName + "/" + params.pluralEntityName + "(" + urlEntityKeyValue + ")"
63
+ })];
64
+ case 1:
65
+ response = _a.sent();
66
+ return [2 /*return*/, transformFunction(response, context, params)];
67
+ }
68
+ });
69
+ }); };
70
+ }
71
+ exports._deleteBoEntityFactory = _deleteBoEntityFactory;
72
+ /**
73
+ * Delete a business object entity.
74
+ *
75
+ * ```typescript
76
+ * import { deleteBoEntity } from "@dvelop-sdk/business-objects";
77
+ *
78
+ * await deleteBoEntity({
79
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
80
+ * authSessionId: "3f3c428d452"
81
+ * },{
82
+ * modelName: "HOSPITALBASEDATA",
83
+ * pluralEntityName: "employees",
84
+ * entityKeyValue: 1
85
+ * });
86
+ * ```
87
+ * ---
88
+ * You can also write your own function, for example to get a notification, if the entity requested for deletion doesn't exist.
89
+ * import { deleteBoEntity } from "@dvelop-sdk/business-objects";
90
+ *
91
+ * const myDeleteFunction = _deleteBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
92
+ * if(response.status === 204) {
93
+ * return "Entity requested for deletion does not exist.";
94
+ * }
95
+ * })
96
+ *
97
+ * const responseMessage = await myDeleteFunction({
98
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
99
+ * authSessionId: "3f3c428d452"
100
+ * },{
101
+ * modelName: "HOSPITALBASEDATA",
102
+ * pluralEntityName: "employees",
103
+ * entityKeyValue: 1
104
+ * });
105
+ * console.log(responseMessage); // Entity requested for deletion does not exist.
106
+ * ```
107
+ */
108
+ /* istanbul ignore next */
109
+ function deleteBoEntity(context, params) {
110
+ return __awaiter(this, void 0, void 0, function () {
111
+ return __generator(this, function (_a) {
112
+ switch (_a.label) {
113
+ case 0: return [4 /*yield*/, _deleteBoEntityFactory(http_1._defaultHttpRequestFunction, function () { })(context, params)];
114
+ case 1: return [2 /*return*/, _a.sent()];
115
+ }
116
+ });
117
+ });
118
+ }
119
+ exports.deleteBoEntity = deleteBoEntity;
120
+ //# sourceMappingURL=delete-entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-entity.js","sourceRoot":"","sources":["../../../src/entities/delete-entity/delete-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAA2E;AAY3E;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,mBAA0F,EAC1F,iBAAyG;IAF3G,iBAoBC;IAhBC,OAAO,UAAO,OAAsB,EAAE,MAA4B;;;;;oBAGhE,IAAG,OAAO,MAAM,CAAC,cAAc,KAAK,QAAQ,EAAE;wBAC5C,iBAAiB,GAAG,MAAM,CAAC,cAAc,CAAC;qBAC3C;yBAAM;wBACL,iBAAiB,GAAG,MAAI,MAAM,CAAC,cAAc,MAAG,CAAC;qBAClD;oBAEgB,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;AApBD,wDAoBC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,0BAA0B;AAC1B,SAAsB,cAAc,CAAC,OAAsB,EAAE,MAA4B;;;;wBAChF,qBAAM,sBAAsB,CAAC,kCAA2B,EAAE,cAAK,CAAC,CAAC,CAAE,OAAO,EAAE,MAAM,CAAC,EAAA;wBAA1F,sBAAO,SAAmF,EAAC;;;;CAC5F;AAFD,wCAEC"}
@@ -0,0 +1,66 @@
1
+ import { DvelopContext } from "@dvelop-sdk/core";
2
+ import { HttpConfig, HttpResponse } from "../../utils/http";
3
+ /**
4
+ * Parameters for the {@link getBoEntities}-function.
5
+ * @category Entities
6
+ */
7
+ export interface GetBoEntitiesParams {
8
+ /** Name of the model */
9
+ modelName: string;
10
+ /** EntityName in plural (**regular won't work**) */
11
+ pluralEntityName: string;
12
+ }
13
+ /**
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
+ * @internal
16
+ * @category Entities
17
+ */
18
+ export declare function _getBoEntitiesDefaultTransformFunction<T>(response: HttpResponse, _: DvelopContext, __: GetBoEntitiesParams): T[];
19
+ /**
20
+ * Factory for {@link getBoEntities}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
21
+ * @typeparam T Return type of the getBoEntities-function. A corresponding transformFuntion has to be supplied.
22
+ * @internal
23
+ * @category Entities
24
+ */
25
+ export declare function _getBoEntitiesFactory<T>(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: <T>(response: HttpResponse, context: DvelopContext, params: GetBoEntitiesParams) => T[]): (context: DvelopContext, params: GetBoEntitiesParams) => Promise<T[]>;
26
+ /**
27
+ * Returns all specified entities from a model.
28
+ *
29
+ * ```typescript
30
+ * import { getBoEntities } from "@dvelop-sdk/business-objects";
31
+ *
32
+ * const result = await getBoEntities({
33
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
34
+ * authSessionId: "3f3c428d452"
35
+ * },{
36
+ * modelName: "HOSPITALBASEDATA",
37
+ * pluralEntityName: "employees",
38
+ * });
39
+ * console.log(result); // [{employeeid: '1', firstName: 'John', lastName: 'Dorian', jobTitel: 'senior physician'}, {employeeid: '2', firstName: 'Christopher', lastName: 'Turk', jobTitel: 'chief surgeon'}]
40
+ * ```
41
+ * ---
42
+ * You can also use generics:
43
+ * ```typescript
44
+ * import { getBoEntities } from "@dvelop-sdk/business-objects";
45
+ *
46
+ * interface MyEntity{
47
+ * lastName: string;
48
+ * }
49
+ *
50
+ * const result: MyEntity[] = await getBoEntities<MyEntity>({
51
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
52
+ * authSessionId: "3f3c428d452"
53
+ * },{
54
+ * modelName: "HOSPITALBASEDATA",
55
+ * pluralEntityName: "employees",
56
+ * });
57
+ *
58
+ * result.forEach(entity => {
59
+ * console.log(entity.lastName);
60
+ * });
61
+ * // Dorian
62
+ * // Turk
63
+ * ```
64
+ */
65
+ export declare function getBoEntities<T = any>(context: DvelopContext, params: GetBoEntitiesParams): Promise<T[]>;
66
+ //# sourceMappingURL=get-entities.d.ts.map
@@ -0,0 +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;IAChC,wBAAwB;IACxB,SAAS,EAAC,MAAM,CAAC;IACjB,oDAAoD;IACpD,gBAAgB,EAAC,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,mBAAmB,GAAE,CAAC,EAAE,CAE/H;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,CAAC,EAAG,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,KAAK,CAAC,EAAE,GAC1G,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAUvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,wBAAsB,aAAa,CAAC,CAAC,GAAC,GAAG,EAAG,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,GAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAE5G"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.getBoEntities = exports._getBoEntitiesFactory = exports._getBoEntitiesDefaultTransformFunction = void 0;
40
+ var http_1 = require("../../utils/http");
41
+ /**
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
+ * @internal
44
+ * @category Entities
45
+ */
46
+ function _getBoEntitiesDefaultTransformFunction(response, _, __) {
47
+ return response.data.value;
48
+ }
49
+ exports._getBoEntitiesDefaultTransformFunction = _getBoEntitiesDefaultTransformFunction;
50
+ /**
51
+ * Factory for {@link getBoEntities}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
52
+ * @typeparam T Return type of the getBoEntities-function. A corresponding transformFuntion has to be supplied.
53
+ * @internal
54
+ * @category Entities
55
+ */
56
+ function _getBoEntitiesFactory(httpRequestFunction, transformFunction) {
57
+ var _this = this;
58
+ return function (context, params) { return __awaiter(_this, void 0, void 0, function () {
59
+ var response;
60
+ return __generator(this, function (_a) {
61
+ switch (_a.label) {
62
+ case 0: return [4 /*yield*/, httpRequestFunction(context, {
63
+ method: "GET",
64
+ url: "/businessobjects/custom/" + params.modelName + "/" + params.pluralEntityName
65
+ })];
66
+ case 1:
67
+ response = _a.sent();
68
+ return [2 /*return*/, transformFunction(response, context, params)];
69
+ }
70
+ });
71
+ }); };
72
+ }
73
+ exports._getBoEntitiesFactory = _getBoEntitiesFactory;
74
+ /**
75
+ * Returns all specified entities from a model.
76
+ *
77
+ * ```typescript
78
+ * import { getBoEntities } from "@dvelop-sdk/business-objects";
79
+ *
80
+ * const result = await getBoEntities({
81
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
82
+ * authSessionId: "3f3c428d452"
83
+ * },{
84
+ * modelName: "HOSPITALBASEDATA",
85
+ * pluralEntityName: "employees",
86
+ * });
87
+ * console.log(result); // [{employeeid: '1', firstName: 'John', lastName: 'Dorian', jobTitel: 'senior physician'}, {employeeid: '2', firstName: 'Christopher', lastName: 'Turk', jobTitel: 'chief surgeon'}]
88
+ * ```
89
+ * ---
90
+ * You can also use generics:
91
+ * ```typescript
92
+ * import { getBoEntities } from "@dvelop-sdk/business-objects";
93
+ *
94
+ * interface MyEntity{
95
+ * lastName: string;
96
+ * }
97
+ *
98
+ * const result: MyEntity[] = await getBoEntities<MyEntity>({
99
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
100
+ * authSessionId: "3f3c428d452"
101
+ * },{
102
+ * modelName: "HOSPITALBASEDATA",
103
+ * pluralEntityName: "employees",
104
+ * });
105
+ *
106
+ * result.forEach(entity => {
107
+ * console.log(entity.lastName);
108
+ * });
109
+ * // Dorian
110
+ * // Turk
111
+ * ```
112
+ */
113
+ /* istanbul ignore next */
114
+ function getBoEntities(context, params) {
115
+ return __awaiter(this, void 0, void 0, function () {
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0: return [4 /*yield*/, _getBoEntitiesFactory(http_1._defaultHttpRequestFunction, _getBoEntitiesDefaultTransformFunction)(context, params)];
119
+ case 1: return [2 /*return*/, _a.sent()];
120
+ }
121
+ });
122
+ });
123
+ }
124
+ exports.getBoEntities = getBoEntities;
125
+ //# sourceMappingURL=get-entities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-entities.js","sourceRoot":"","sources":["../../../src/entities/get-entities/get-entities.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;AAazF;;;;GAIG;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,iBAA2G;IAF7G,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,CAAI,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,EAAC;;;SACxD,CAAC;AACJ,CAAC;AAbD,sDAaC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,0BAA0B;AAC1B,SAAsB,aAAa,CAAS,OAAsB,EAAE,MAA2B;;;;wBACtF,qBAAM,qBAAqB,CAAI,kCAA2B,EAAE,sCAAsC,CAAC,CAAE,OAAO,EAAE,MAAM,CAAC,EAAA;wBAA5H,sBAAO,SAAqH,EAAC;;;;CAC9H;AAFD,sCAEC"}
@@ -0,0 +1,63 @@
1
+ import { DvelopContext } from "@dvelop-sdk/core";
2
+ import { HttpConfig, HttpResponse } from "../../utils/http";
3
+ /**
4
+ * Parameters for the {@link getBoEntity}-function.
5
+ * @category Entity
6
+ */
7
+ export interface GetBoEntityParams {
8
+ modelName: string;
9
+ pluralEntityName: string;
10
+ entityKeyValue: string | number;
11
+ }
12
+ /**
13
+ * 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.
14
+ * @internal
15
+ * @category Entity
16
+ */
17
+ export declare function _getBoEntityDefaultTransformFunction<T extends Object>(response: HttpResponse, _: DvelopContext, __: GetBoEntityParams): T;
18
+ /**
19
+ * Factory for {@link getBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
20
+ * @typeparam T Return type of the getBoEntity-function. A corresponding transformFuntion has to be supplied.
21
+ * @internal
22
+ * @category Entity
23
+ */
24
+ export declare function _getBoEntityFactory<T>(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: GetBoEntityParams) => T): (context: DvelopContext, params: GetBoEntityParams) => Promise<T>;
25
+ /**
26
+ * Returns one specified entity from a model.
27
+ *
28
+ * ```typescript
29
+ * import { getBoEntity } from "@dvelop-sdk/business-objects";
30
+ *
31
+ * const result = await getBoEntity({
32
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
33
+ * authSessionId: "3f3c428d452"
34
+ * },{
35
+ * modelName: "HOSPITALBASEDATA",
36
+ pluralEntityName: "employees",
37
+ entityKeyValue: "1"
38
+ * });
39
+ * console.log(result); // {employeeid: '1', firstName: 'John', lastName: 'Dorian', jobTitel: 'senior physician'}
40
+ * ```
41
+ * ---
42
+ * You can also use generics:
43
+ * ```typescript
44
+ * import { getBoEntity } from "@dvelop-sdk/business-objects";
45
+ *
46
+ * interface MyEntity{
47
+ * lastName: string;
48
+ * }
49
+ *
50
+ * const result: MyEntity[] = await getBoEntity<MyEntity>({
51
+ * systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
52
+ * authSessionId: "3f3c428d452"
53
+ * },{
54
+ * modelName: "HOSPITALBASEDATA",
55
+ * pluralEntityName: "employees",
56
+ * entityKeyValue: "1"
57
+ * });
58
+ *
59
+ * console.log(entity.lastName); // Dorian
60
+ * ```
61
+ */
62
+ export declare function getBoEntity<T>(context: DvelopContext, params: GetBoEntityParams): Promise<T>;
63
+ //# sourceMappingURL=get-entity.d.ts.map
@@ -0,0 +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;IAC9B,SAAS,EAAC,MAAM,CAAC;IACjB,gBAAgB,EAAC,MAAM,CAAC;IACxB,cAAc,EAAC,MAAM,GAAC,MAAM,CAAC;CAChC;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAAE,CAAC,SAAS,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,iBAAiB,GAAG,CAAC,CAG1I;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,wBAAsB,WAAW,CAAC,CAAC,EAAG,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CAEnG"}