@dvelop-sdk/business-objects 1.0.0-alpha.0 → 1.0.0-beta.0
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 +66 -0
- package/lib/entities/create-entity/create-entity.d.ts.map +1 -0
- package/lib/entities/create-entity/create-entity.js +124 -0
- package/lib/entities/create-entity/create-entity.js.map +1 -0
- package/lib/entities/delete-entity/delete-entity.d.ts +56 -0
- package/lib/entities/delete-entity/delete-entity.d.ts.map +1 -0
- package/lib/entities/delete-entity/delete-entity.js +120 -0
- package/lib/entities/delete-entity/delete-entity.js.map +1 -0
- package/lib/entities/get-entities/get-entities.d.ts +66 -0
- package/lib/entities/get-entities/get-entities.d.ts.map +1 -0
- package/lib/entities/get-entities/get-entities.js +125 -0
- package/lib/entities/get-entities/get-entities.js.map +1 -0
- package/lib/entities/get-entity/get-entity.d.ts +63 -0
- package/lib/entities/get-entity/get-entity.d.ts.map +1 -0
- package/lib/entities/get-entity/get-entity.js +131 -0
- package/lib/entities/get-entity/get-entity.js.map +1 -0
- package/lib/entities/update-entity/update-entity.d.ts +61 -0
- package/lib/entities/update-entity/update-entity.d.ts.map +1 -0
- package/lib/entities/update-entity/update-entity.js +125 -0
- package/lib/entities/update-entity/update-entity.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -1
- package/lib/index.js.map +1 -1
- package/lib/internal.d.ts +3 -0
- package/lib/internal.d.ts.map +1 -0
- package/lib/internal.js +10 -0
- package/lib/internal.js.map +1 -0
- package/lib/utils/http.d.ts +42 -0
- package/lib/utils/http.d.ts.map +1 -0
- package/lib/utils/http.js +142 -0
- package/lib/utils/http.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,131 @@
|
|
|
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.getBoEntity = exports._getBoEntityFactory = exports._getBoEntityDefaultTransformFunction = void 0;
|
|
40
|
+
var http_1 = require("../../utils/http");
|
|
41
|
+
/**
|
|
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
|
+
* @internal
|
|
44
|
+
* @category Entity
|
|
45
|
+
*/
|
|
46
|
+
function _getBoEntityDefaultTransformFunction(response, _, __) {
|
|
47
|
+
// TODO delete @odata.context!
|
|
48
|
+
return response.data;
|
|
49
|
+
}
|
|
50
|
+
exports._getBoEntityDefaultTransformFunction = _getBoEntityDefaultTransformFunction;
|
|
51
|
+
/**
|
|
52
|
+
* Factory for {@link getBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
53
|
+
* @typeparam T Return type of the getBoEntity-function. A corresponding transformFuntion has to be supplied.
|
|
54
|
+
* @internal
|
|
55
|
+
* @category Entity
|
|
56
|
+
*/
|
|
57
|
+
function _getBoEntityFactory(httpRequestFunction, transformFunction) {
|
|
58
|
+
var _this = this;
|
|
59
|
+
return function (context, params) { return __awaiter(_this, void 0, void 0, function () {
|
|
60
|
+
var urlEntityKeyValue, response;
|
|
61
|
+
return __generator(this, function (_a) {
|
|
62
|
+
switch (_a.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
if (typeof params.entityKeyValue === "number") {
|
|
65
|
+
urlEntityKeyValue = params.entityKeyValue;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
urlEntityKeyValue = "'" + params.entityKeyValue + "'";
|
|
69
|
+
}
|
|
70
|
+
return [4 /*yield*/, httpRequestFunction(context, {
|
|
71
|
+
method: "GET",
|
|
72
|
+
url: "/businessobjects/custom/" + params.modelName + "/" + params.pluralEntityName + "(" + urlEntityKeyValue + ")"
|
|
73
|
+
})];
|
|
74
|
+
case 1:
|
|
75
|
+
response = _a.sent();
|
|
76
|
+
return [2 /*return*/, transformFunction(response, context, params)];
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}); };
|
|
80
|
+
}
|
|
81
|
+
exports._getBoEntityFactory = _getBoEntityFactory;
|
|
82
|
+
/**
|
|
83
|
+
* Returns one specified entity from a model.
|
|
84
|
+
*
|
|
85
|
+
* ```typescript
|
|
86
|
+
* import { getBoEntity } from "@dvelop-sdk/business-objects";
|
|
87
|
+
*
|
|
88
|
+
* const result = await getBoEntity({
|
|
89
|
+
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
90
|
+
* authSessionId: "3f3c428d452"
|
|
91
|
+
* },{
|
|
92
|
+
* modelName: "HOSPITALBASEDATA",
|
|
93
|
+
pluralEntityName: "employees",
|
|
94
|
+
entityKeyValue: "1"
|
|
95
|
+
* });
|
|
96
|
+
* console.log(result); // {employeeid: '1', firstName: 'John', lastName: 'Dorian', jobTitel: 'senior physician'}
|
|
97
|
+
* ```
|
|
98
|
+
* ---
|
|
99
|
+
* You can also use generics:
|
|
100
|
+
* ```typescript
|
|
101
|
+
* import { getBoEntity } from "@dvelop-sdk/business-objects";
|
|
102
|
+
*
|
|
103
|
+
* interface MyEntity{
|
|
104
|
+
* lastName: string;
|
|
105
|
+
* }
|
|
106
|
+
*
|
|
107
|
+
* const result: MyEntity[] = await getBoEntity<MyEntity>({
|
|
108
|
+
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
109
|
+
* authSessionId: "3f3c428d452"
|
|
110
|
+
* },{
|
|
111
|
+
* modelName: "HOSPITALBASEDATA",
|
|
112
|
+
* pluralEntityName: "employees",
|
|
113
|
+
* entityKeyValue: "1"
|
|
114
|
+
* });
|
|
115
|
+
*
|
|
116
|
+
* console.log(entity.lastName); // Dorian
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
/* istanbul ignore next */
|
|
120
|
+
function getBoEntity(context, params) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
122
|
+
return __generator(this, function (_a) {
|
|
123
|
+
switch (_a.label) {
|
|
124
|
+
case 0: return [4 /*yield*/, _getBoEntityFactory(http_1._defaultHttpRequestFunction, _getBoEntityDefaultTransformFunction)(context, params)];
|
|
125
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
exports.getBoEntity = getBoEntity;
|
|
131
|
+
//# sourceMappingURL=get-entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-entity.js","sourceRoot":"","sources":["../../../src/entities/get-entity/get-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;AAYzF;;;;GAIG;AACH,SAAgB,oCAAoC,CAAoB,QAAsB,EAAE,CAAgB,EAAE,EAAqB;IACrI,8BAA8B;IAC9B,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,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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,0BAA0B;AAC1B,SAAsB,WAAW,CAAK,OAAsB,EAAE,MAAyB;;;;wBAC9E,qBAAM,mBAAmB,CAAI,kCAA2B,EAAE,oCAAoC,CAAC,CAAE,OAAO,EAAE,MAAM,CAAC,EAAA;wBAAxH,sBAAO,SAAiH,EAAC;;;;CAC1H;AAFD,kCAEC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DvelopContext } from "@dvelop-sdk/core";
|
|
2
|
+
import { HttpConfig, HttpResponse } from "../../utils/http";
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for the {@link updateBoEntity}-function.
|
|
5
|
+
* @category Entity
|
|
6
|
+
*/
|
|
7
|
+
export interface UpdateBoEntityParams {
|
|
8
|
+
modelName: string;
|
|
9
|
+
pluralEntityName: string;
|
|
10
|
+
entityKeyValue: string | number;
|
|
11
|
+
entityChange: Object;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Factory for {@link updateBoEntity}-function. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
15
|
+
* @typeparam
|
|
16
|
+
* @internal
|
|
17
|
+
* @category Entity
|
|
18
|
+
*/
|
|
19
|
+
export declare function _updateBoEntityFactory(httpRequestFunction: (context: DvelopContext, config: HttpConfig) => Promise<HttpResponse>, transformFunction: (response: HttpResponse, context: DvelopContext, params: UpdateBoEntityParams) => void): (context: DvelopContext, params: UpdateBoEntityParams) => Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Update a business object entity.
|
|
22
|
+
*
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
25
|
+
*
|
|
26
|
+
* await updateBoEntity({
|
|
27
|
+
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
28
|
+
* authSessionId: "3f3c428d452"
|
|
29
|
+
* },{
|
|
30
|
+
* modelName: "HOSPITALBASEDATA",
|
|
31
|
+
* pluralEntityName: "employees",
|
|
32
|
+
* entityKeyValue: 1,
|
|
33
|
+
* entityChange: {
|
|
34
|
+
* "firstName": "J.D."
|
|
35
|
+
* }
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
* ---
|
|
39
|
+
* You can also write your own function.
|
|
40
|
+
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
41
|
+
*
|
|
42
|
+
* const myUpdateFunction = _updateBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
|
|
43
|
+
* return "My own transform function message.";
|
|
44
|
+
* })
|
|
45
|
+
*
|
|
46
|
+
* const responseMessage = await myUpdateFunction({
|
|
47
|
+
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
48
|
+
* authSessionId: "3f3c428d452"
|
|
49
|
+
* },{
|
|
50
|
+
* modelName: "HOSPITALBASEDATA",
|
|
51
|
+
* pluralEntityName: "employees",
|
|
52
|
+
* entityKeyValue: 1,
|
|
53
|
+
* entityChange: {
|
|
54
|
+
* "firstName": "J.D."
|
|
55
|
+
* }
|
|
56
|
+
* });
|
|
57
|
+
* console.log(responseMessage); // My own transform function message
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function updateBoEntity(context: DvelopContext, params: UpdateBoEntityParams): Promise<void>;
|
|
61
|
+
//# sourceMappingURL=update-entity.d.ts.map
|
|
@@ -0,0 +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;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACjC,SAAS,EAAC,MAAM,CAAC;IACjB,gBAAgB,EAAC,MAAM,CAAC;IACxB,cAAc,EAAC,MAAM,GAAC,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;CACxB;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,CAkBzE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,wBAAsB,cAAc,CAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,GAAE,OAAO,CAAC,IAAI,CAAC,CAExG"}
|
|
@@ -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.updateBoEntity = exports._updateBoEntityFactory = void 0;
|
|
40
|
+
var http_1 = require("../../utils/http");
|
|
41
|
+
/**
|
|
42
|
+
* Factory for {@link updateBoEntity}-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 _updateBoEntityFactory(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: "PUT",
|
|
62
|
+
url: "/businessobjects/custom/" + params.modelName + "/" + params.pluralEntityName + "(" + urlEntityKeyValue + ")",
|
|
63
|
+
data: params.entityChange
|
|
64
|
+
})];
|
|
65
|
+
case 1:
|
|
66
|
+
response = _a.sent();
|
|
67
|
+
return [2 /*return*/, transformFunction(response, context, params)];
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}); };
|
|
71
|
+
}
|
|
72
|
+
exports._updateBoEntityFactory = _updateBoEntityFactory;
|
|
73
|
+
/**
|
|
74
|
+
* Update a business object entity.
|
|
75
|
+
*
|
|
76
|
+
* ```typescript
|
|
77
|
+
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
78
|
+
*
|
|
79
|
+
* await updateBoEntity({
|
|
80
|
+
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
81
|
+
* authSessionId: "3f3c428d452"
|
|
82
|
+
* },{
|
|
83
|
+
* modelName: "HOSPITALBASEDATA",
|
|
84
|
+
* pluralEntityName: "employees",
|
|
85
|
+
* entityKeyValue: 1,
|
|
86
|
+
* entityChange: {
|
|
87
|
+
* "firstName": "J.D."
|
|
88
|
+
* }
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
* ---
|
|
92
|
+
* You can also write your own function.
|
|
93
|
+
* import { updateBoEntity } from "@dvelop-sdk/business-objects";
|
|
94
|
+
*
|
|
95
|
+
* const myUpdateFunction = _updateBoEntityFactory(_defaultHttpRequestFunction, (response:HttpResponse)=> {
|
|
96
|
+
* return "My own transform function message.";
|
|
97
|
+
* })
|
|
98
|
+
*
|
|
99
|
+
* const responseMessage = await myUpdateFunction({
|
|
100
|
+
* systemBaseUri: "https://sacred-heart-hospital.d-velop.cloud",
|
|
101
|
+
* authSessionId: "3f3c428d452"
|
|
102
|
+
* },{
|
|
103
|
+
* modelName: "HOSPITALBASEDATA",
|
|
104
|
+
* pluralEntityName: "employees",
|
|
105
|
+
* entityKeyValue: 1,
|
|
106
|
+
* entityChange: {
|
|
107
|
+
* "firstName": "J.D."
|
|
108
|
+
* }
|
|
109
|
+
* });
|
|
110
|
+
* console.log(responseMessage); // My own transform function message
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
/* istanbul ignore next */
|
|
114
|
+
function updateBoEntity(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*/, _updateBoEntityFactory(http_1._defaultHttpRequestFunction, function () { })(context, params)];
|
|
119
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
exports.updateBoEntity = updateBoEntity;
|
|
125
|
+
//# sourceMappingURL=update-entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-entity.js","sourceRoot":"","sources":["../../../src/entities/update-entity/update-entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAyF;AAazF;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,mBAA0F,EAC1F,iBAAyG;IAF3G,iBAqBC;IAjBC,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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,0BAA0B;AAC1B,SAAsB,cAAc,CAAE,OAAsB,EAAE,MAA4B;;;;wBACjF,qBAAM,sBAAsB,CAAC,kCAA2B,EAAE,cAAK,CAAC,CAAC,CAAE,OAAO,EAAE,MAAM,CAAC,EAAA;wBAA1F,sBAAO,SAAmF,EAAC;;;;CAC5F;AAFD,wCAEC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -24,4 +24,7 @@
|
|
|
24
24
|
* @module business-objects
|
|
25
25
|
*/
|
|
26
26
|
export { DvelopContext, BadInputError, UnauthorizedError, ForbiddenError, NotFoundError } from "@dvelop-sdk/core";
|
|
27
|
+
export { BusinessObjectsError } from "./utils/http";
|
|
28
|
+
export * as internals from "./internal";
|
|
29
|
+
export { getBoEntities, GetBoEntitiesParams } from "./entities/get-entities/get-entities";
|
|
27
30
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAClH,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -24,12 +24,36 @@
|
|
|
24
24
|
</div>
|
|
25
25
|
* @module business-objects
|
|
26
26
|
*/
|
|
27
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}) : function(o, v) {
|
|
37
|
+
o["default"] = v;
|
|
38
|
+
});
|
|
39
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
27
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.BadInputError = void 0;
|
|
47
|
+
exports.getBoEntities = exports.internals = exports.BusinessObjectsError = exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.BadInputError = void 0;
|
|
29
48
|
//Utils
|
|
30
49
|
var core_1 = require("@dvelop-sdk/core");
|
|
31
50
|
Object.defineProperty(exports, "BadInputError", { enumerable: true, get: function () { return core_1.BadInputError; } });
|
|
32
51
|
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return core_1.UnauthorizedError; } });
|
|
33
52
|
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return core_1.ForbiddenError; } });
|
|
34
53
|
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return core_1.NotFoundError; } });
|
|
54
|
+
var http_1 = require("./utils/http");
|
|
55
|
+
Object.defineProperty(exports, "BusinessObjectsError", { enumerable: true, get: function () { return http_1.BusinessObjectsError; } });
|
|
56
|
+
exports.internals = __importStar(require("./internal"));
|
|
57
|
+
var get_entities_1 = require("./entities/get-entities/get-entities");
|
|
58
|
+
Object.defineProperty(exports, "getBoEntities", { enumerable: true, get: function () { return get_entities_1.getBoEntities; } });
|
|
35
59
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;;;;;;;;;;;;;;;;;;;;AAEH,OAAO;AACP,yCAAkH;AAA1F,qGAAA,aAAa,OAAA;AAAE,yGAAA,iBAAiB,OAAA;AAAE,sGAAA,cAAc,OAAA;AAAE,qGAAA,aAAa,OAAA;AACvF,qCAAoD;AAA3C,4GAAA,oBAAoB,OAAA;AAC7B,wDAAwC;AAExC,qEAA0F;AAAjF,6GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { _defaultHttpRequestFunctionFactory, _defaultHttpRequestFunction, BusinessObjectsErrorDto } from "./utils/http";
|
|
2
|
+
export { _getBoEntitiesDefaultTransformFunction, _getBoEntitiesFactory } from "./entities/get-entities/get-entities";
|
|
3
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACxH,OAAO,EAAE,sCAAsC,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC"}
|
package/lib/internal.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._getBoEntitiesFactory = exports._getBoEntitiesDefaultTransformFunction = exports._defaultHttpRequestFunction = exports._defaultHttpRequestFunctionFactory = void 0;
|
|
4
|
+
var http_1 = require("./utils/http");
|
|
5
|
+
Object.defineProperty(exports, "_defaultHttpRequestFunctionFactory", { enumerable: true, get: function () { return http_1._defaultHttpRequestFunctionFactory; } });
|
|
6
|
+
Object.defineProperty(exports, "_defaultHttpRequestFunction", { enumerable: true, get: function () { return http_1._defaultHttpRequestFunction; } });
|
|
7
|
+
var get_entities_1 = require("./entities/get-entities/get-entities");
|
|
8
|
+
Object.defineProperty(exports, "_getBoEntitiesDefaultTransformFunction", { enumerable: true, get: function () { return get_entities_1._getBoEntitiesDefaultTransformFunction; } });
|
|
9
|
+
Object.defineProperty(exports, "_getBoEntitiesFactory", { enumerable: true, get: function () { return get_entities_1._getBoEntitiesFactory; } });
|
|
10
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":";;;AAAA,qCAAwH;AAA/G,0HAAA,kCAAkC,OAAA;AAAE,mHAAA,2BAA2B,OAAA;AACxE,qEAAqH;AAA5G,sIAAA,sCAAsC,OAAA;AAAE,qHAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DvelopContext, DvelopHttpRequestConfig, DvelopHttpResponse, DvelopHttpClient, DvelopSdkError } from "@dvelop-sdk/core";
|
|
2
|
+
export { DvelopHttpRequestConfig as HttpConfig, DvelopHttpResponse as HttpResponse } from "@dvelop-sdk/core";
|
|
3
|
+
/**
|
|
4
|
+
* ErrorDto for BusinessObjects-App.
|
|
5
|
+
* @category Error
|
|
6
|
+
*/
|
|
7
|
+
export interface BusinessObjectsErrorDto {
|
|
8
|
+
error: {
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
details: {
|
|
12
|
+
code: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}[];
|
|
15
|
+
innerError: {
|
|
16
|
+
timestamp: string;
|
|
17
|
+
requestId: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generic Error for business-objects package.
|
|
23
|
+
* @category Error
|
|
24
|
+
*/
|
|
25
|
+
export declare class BusinessObjectsError extends DvelopSdkError {
|
|
26
|
+
message: string;
|
|
27
|
+
originalError?: Error | undefined;
|
|
28
|
+
constructor(message: string, originalError?: Error | undefined);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Factory used to create the default httpRequestFunction. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
32
|
+
* @internal
|
|
33
|
+
* @category Http
|
|
34
|
+
*/
|
|
35
|
+
export declare function _defaultHttpRequestFunctionFactory(httpClient: DvelopHttpClient): (context: DvelopContext, config: DvelopHttpRequestConfig) => Promise<DvelopHttpResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Default httpRequestFunction used in dms-package. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
38
|
+
* @internal
|
|
39
|
+
* @category Http
|
|
40
|
+
*/
|
|
41
|
+
export declare function _defaultHttpRequestFunction(context: DvelopContext, config: DvelopHttpRequestConfig): Promise<DvelopHttpResponse>;
|
|
42
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +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;AAUD;;;EAGE;AAEF,qBAAa,oBAAqB,SAAQ,cAAc;IAEnC,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,CAmCzK;AAGD;;;;GAIG;AAEH,wBAAsB,2BAA2B,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAEtI"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports._defaultHttpRequestFunction = exports._defaultHttpRequestFunctionFactory = exports.BusinessObjectsError = void 0;
|
|
55
|
+
var core_1 = require("@dvelop-sdk/core");
|
|
56
|
+
function getErrorString(error) {
|
|
57
|
+
if (error === null || error === void 0 ? void 0 : error.error) {
|
|
58
|
+
return error.error.message + " (" + error.error.code + "). See 'See 'originalError'-property for details.'";
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Generic Error for business-objects package.
|
|
66
|
+
* @category Error
|
|
67
|
+
*/
|
|
68
|
+
/* istanbul ignore next */
|
|
69
|
+
var BusinessObjectsError = /** @class */ (function (_super) {
|
|
70
|
+
__extends(BusinessObjectsError, _super);
|
|
71
|
+
// eslint-disable-next-line no-unused-vars
|
|
72
|
+
function BusinessObjectsError(message, originalError) {
|
|
73
|
+
var _this = _super.call(this, message) || this;
|
|
74
|
+
_this.message = message;
|
|
75
|
+
_this.originalError = originalError;
|
|
76
|
+
Object.setPrototypeOf(_this, BusinessObjectsError.prototype);
|
|
77
|
+
return _this;
|
|
78
|
+
}
|
|
79
|
+
return BusinessObjectsError;
|
|
80
|
+
}(core_1.DvelopSdkError));
|
|
81
|
+
exports.BusinessObjectsError = BusinessObjectsError;
|
|
82
|
+
/**
|
|
83
|
+
* Factory used to create the default httpRequestFunction. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
84
|
+
* @internal
|
|
85
|
+
* @category Http
|
|
86
|
+
*/
|
|
87
|
+
function _defaultHttpRequestFunctionFactory(httpClient) {
|
|
88
|
+
var _this = this;
|
|
89
|
+
return function (context, config) { return __awaiter(_this, void 0, void 0, function () {
|
|
90
|
+
var error_1;
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
switch (_a.label) {
|
|
93
|
+
case 0:
|
|
94
|
+
_a.trys.push([0, 2, , 3]);
|
|
95
|
+
return [4 /*yield*/, httpClient.request(context, config)];
|
|
96
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
97
|
+
case 2:
|
|
98
|
+
error_1 = _a.sent();
|
|
99
|
+
if (error_1.response) {
|
|
100
|
+
switch (error_1.response.status) {
|
|
101
|
+
case 400:
|
|
102
|
+
case 409: // Conflict
|
|
103
|
+
case 413: // Request Entity Too Large
|
|
104
|
+
case 414: // URI Too Long
|
|
105
|
+
case 429: // Too Many Requests
|
|
106
|
+
case 431: // Request Header Fields Too Large
|
|
107
|
+
throw new core_1.BadInputError(getErrorString(error_1.response.data) || "BusinessObjects-App responded with Status 400 indicating bad Request-Parameters. See 'originalError'-property for details.", error_1);
|
|
108
|
+
case 401:
|
|
109
|
+
throw new core_1.UnauthorizedError(getErrorString(error_1.response.data) || error_1.response.data || "BusinessObjects-App responded with Status 401 indicating bad authSessionId.", error_1);
|
|
110
|
+
case 403:
|
|
111
|
+
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
|
+
case 404:
|
|
113
|
+
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);
|
|
114
|
+
default:
|
|
115
|
+
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
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
throw new BusinessObjectsError("Request to BusinessObjects-App failed: " + error_1.message + ". See 'originalError'-property for details.", error_1);
|
|
120
|
+
}
|
|
121
|
+
return [3 /*break*/, 3];
|
|
122
|
+
case 3: return [2 /*return*/];
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}); };
|
|
126
|
+
}
|
|
127
|
+
exports._defaultHttpRequestFunctionFactory = _defaultHttpRequestFunctionFactory;
|
|
128
|
+
/**
|
|
129
|
+
* Default httpRequestFunction used in dms-package. See [Advanced Topics](https://github.com/d-velop/dvelop-sdk-node#advanced-topics) for more information.
|
|
130
|
+
* @internal
|
|
131
|
+
* @category Http
|
|
132
|
+
*/
|
|
133
|
+
/* istanbul ignore next */
|
|
134
|
+
function _defaultHttpRequestFunction(context, config) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
+
return __generator(this, function (_a) {
|
|
137
|
+
return [2 /*return*/, _defaultHttpRequestFunctionFactory(core_1.defaultDvelopHttpClientFactory())(context, config)];
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
exports._defaultHttpRequestFunction = _defaultHttpRequestFunction;
|
|
142
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAiO;AA8BjO,SAAS,cAAc,CAAC,KAA8B;IACpD,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,EAAE;QAChB,OAAU,KAAK,CAAC,KAAK,CAAC,OAAO,UAAK,KAAK,CAAC,KAAK,CAAC,IAAI,uDAAoD,CAAC;KACxG;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAED;;;EAGE;AACF,0BAA0B;AAC1B;IAA0C,wCAAc;IACtD,0CAA0C;IAC1C,8BAAmB,OAAe,EAAS,aAAqB;QAAhE,YACE,kBAAM,OAAO,CAAC,SAEf;QAHkB,aAAO,GAAP,OAAO,CAAQ;QAAS,mBAAa,GAAb,aAAa,CAAQ;QAE9D,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;;IAC9D,CAAC;IACH,2BAAC;AAAD,CAAC,AAND,CAA0C,qBAAc,GAMvD;AANY,oDAAoB;AAQjC;;;;GAIG;AACH,SAAgB,kCAAkC,CAAC,UAA4B;IAA/E,iBAmCC;IAlCC,OAAO,UAAO,OAAsB,EAAE,MAA+B;;;;;;oBAG1D,qBAAM,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAA;wBAAhD,sBAAO,SAAyC,EAAC;;;oBAGjD,IAAI,OAAK,CAAC,QAAQ,EAAE;wBAElB,QAAQ,OAAK,CAAC,QAAQ,CAAC,MAAM,EAAE;4BAC/B,KAAK,GAAG,CAAC;4BACT,KAAK,GAAG,CAAC,CAAC,WAAW;4BACrB,KAAK,GAAG,CAAC,CAAC,2BAA2B;4BACrC,KAAK,GAAG,CAAC,CAAC,eAAe;4BACzB,KAAK,GAAG,CAAC,CAAC,oBAAoB;4BAC9B,KAAK,GAAG,EAAE,kCAAkC;gCAC1C,MAAM,IAAI,oBAAa,CAAC,cAAc,CAAC,OAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,4HAA4H,EAAE,OAAK,CAAC,CAAC;4BAEtM,KAAK,GAAG;gCACN,MAAM,IAAI,wBAAiB,CAAC,cAAc,CAAC,OAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,OAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,6EAA6E,EAAE,OAAK,CAAC,CAAC;4BAElL,KAAK,GAAG;gCACN,MAAM,IAAI,qBAAc,CAAC,cAAc,CAAC,OAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,wHAAwH,EAAE,OAAK,CAAC,CAAC;4BAEnM,KAAK,GAAG;gCACN,MAAM,IAAI,oBAAa,CAAC,cAAc,CAAC,OAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,yIAAyI,EAAE,OAAK,CAAC,CAAC;4BAEnN;gCACE,MAAM,IAAI,oBAAoB,CAAC,cAAc,CAAC,OAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,+CAA6C,OAAK,CAAC,QAAQ,CAAC,MAAM,gDAA6C,EAAE,OAAK,CAAC,CAAC;yBAC/L;qBACF;yBAAM;wBACL,MAAM,IAAI,oBAAoB,CAAC,4CAA0C,OAAK,CAAC,OAAO,gDAA6C,EAAE,OAAK,CAAC,CAAC;qBAC7I;;;;;SAEJ,CAAC;AACJ,CAAC;AAnCD,gFAmCC;AAGD;;;;GAIG;AACH,0BAA0B;AAC1B,SAAsB,2BAA2B,CAAC,OAAsB,EAAE,MAA+B;;;YACvG,sBAAO,kCAAkC,CAAC,qCAA8B,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,EAAC;;;CAC9F;AAFD,kEAEC"}
|
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-
|
|
4
|
+
"version": "1.0.0-beta.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|