@de./sdk 1.0.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/LICENSE +21 -0
- package/README.md +4391 -0
- package/dist/allend/Access.d.ts +15 -0
- package/dist/allend/Access.js +164 -0
- package/dist/allend/Access.js.map +1 -0
- package/dist/allend/DAuth/index.d.ts +20 -0
- package/dist/allend/DAuth/index.js +92 -0
- package/dist/allend/DAuth/index.js.map +1 -0
- package/dist/allend/DClient/Client.d.ts +10 -0
- package/dist/allend/DClient/Client.js +144 -0
- package/dist/allend/DClient/Client.js.map +1 -0
- package/dist/allend/DClient/Event.d.ts +18 -0
- package/dist/allend/DClient/Event.js +100 -0
- package/dist/allend/DClient/Event.js.map +1 -0
- package/dist/allend/DClient/Order.d.ts +49 -0
- package/dist/allend/DClient/Order.js +601 -0
- package/dist/allend/DClient/Order.js.map +1 -0
- package/dist/allend/IoTClient.d.ts +29 -0
- package/dist/allend/IoTClient.js +59 -0
- package/dist/allend/IoTClient.js.map +1 -0
- package/dist/allend/MSI/Controls.d.ts +256 -0
- package/dist/allend/MSI/Controls.js +763 -0
- package/dist/allend/MSI/Controls.js.map +1 -0
- package/dist/allend/MSI/Handles.d.ts +88 -0
- package/dist/allend/MSI/Handles.js +445 -0
- package/dist/allend/MSI/Handles.js.map +1 -0
- package/dist/allend/MSI/Plugins.d.ts +22 -0
- package/dist/allend/MSI/Plugins.js +38 -0
- package/dist/allend/MSI/Plugins.js.map +1 -0
- package/dist/allend/MSI/index.d.ts +55 -0
- package/dist/allend/MSI/index.js +155 -0
- package/dist/allend/MSI/index.js.map +1 -0
- package/dist/allend/index.d.ts +12 -0
- package/dist/allend/index.js +18 -0
- package/dist/allend/index.js.map +1 -0
- package/dist/backend/Auth.d.ts +38 -0
- package/dist/backend/Auth.js +286 -0
- package/dist/backend/Auth.js.map +1 -0
- package/dist/baseUrl.d.ts +12 -0
- package/dist/baseUrl.js +16 -0
- package/dist/baseUrl.js.map +1 -0
- package/dist/bundle.js +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/types/access.d.ts +8 -0
- package/dist/types/auth.d.ts +27 -0
- package/dist/types/index.d.ts +281 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/stream.d.ts +20 -0
- package/dist/utils/stream.js +63 -0
- package/dist/utils/stream.js.map +1 -0
- package/package.json +66 -0
- package/src/allend/Access.ts +78 -0
- package/src/allend/DAuth/index.ts +39 -0
- package/src/allend/DClient/Client.ts +76 -0
- package/src/allend/DClient/Event.ts +76 -0
- package/src/allend/DClient/Order.ts +452 -0
- package/src/allend/IoTClient.ts +68 -0
- package/src/allend/MSI/Controls.ts +760 -0
- package/src/allend/MSI/Handles.ts +387 -0
- package/src/allend/MSI/Plugins.ts +52 -0
- package/src/allend/MSI/index.ts +160 -0
- package/src/allend/index.ts +18 -0
- package/src/backend/Auth.ts +201 -0
- package/src/baseUrl.ts +13 -0
- package/src/index.ts +19 -0
- package/src/types/access.d.ts +8 -0
- package/src/types/auth.d.ts +27 -0
- package/src/types/index.d.ts +281 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/stream.ts +68 -0
|
@@ -0,0 +1,601 @@
|
|
|
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 = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
+
return g.next = verb(0), g["throw"] = verb(1), g["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 (g && (g = 0, op[0] && (_ = 0)), _) 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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
var Access_1 = __importDefault(require("../Access"));
|
|
58
|
+
var Order = /** @class */ (function (_super) {
|
|
59
|
+
__extends(Order, _super);
|
|
60
|
+
function Order(access) {
|
|
61
|
+
var _this = _super.call(this, access, 'API') || this;
|
|
62
|
+
_this.intentToken = '';
|
|
63
|
+
return _this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Order intent
|
|
67
|
+
*/
|
|
68
|
+
Order.prototype.intent = function (clientId) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
70
|
+
var options, _a, error, message, token;
|
|
71
|
+
return __generator(this, function (_b) {
|
|
72
|
+
switch (_b.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
if (!clientId)
|
|
75
|
+
throw new Error('<clientId> argument required');
|
|
76
|
+
options = {
|
|
77
|
+
url: '/order/intent',
|
|
78
|
+
method: 'POST',
|
|
79
|
+
body: { clientId: clientId }
|
|
80
|
+
};
|
|
81
|
+
return [4 /*yield*/, this.request(options)];
|
|
82
|
+
case 1:
|
|
83
|
+
_a = _b.sent(), error = _a.error, message = _a.message, token = _a.token;
|
|
84
|
+
if (error)
|
|
85
|
+
throw new Error(message);
|
|
86
|
+
this.intentToken = token;
|
|
87
|
+
return [2 /*return*/, token];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
Order.prototype.unintent = function (token) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
var options, _a, error, message;
|
|
95
|
+
return __generator(this, function (_b) {
|
|
96
|
+
switch (_b.label) {
|
|
97
|
+
case 0:
|
|
98
|
+
if (!token)
|
|
99
|
+
throw new Error('Undefined intent token');
|
|
100
|
+
options = {
|
|
101
|
+
url: '/order/intent',
|
|
102
|
+
method: 'DELETE',
|
|
103
|
+
headers: { 'de-intent-token': token }
|
|
104
|
+
};
|
|
105
|
+
return [4 /*yield*/, this.request(options)];
|
|
106
|
+
case 1:
|
|
107
|
+
_a = _b.sent(), error = _a.error, message = _a.message;
|
|
108
|
+
if (error)
|
|
109
|
+
throw new Error(message);
|
|
110
|
+
this.intentToken = '';
|
|
111
|
+
return [2 /*return*/, true];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Order waypoints
|
|
118
|
+
*/
|
|
119
|
+
Order.prototype.addWaypoint = function (list, token) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
var options, _a, error, message, waypoints;
|
|
122
|
+
return __generator(this, function (_b) {
|
|
123
|
+
switch (_b.label) {
|
|
124
|
+
case 0:
|
|
125
|
+
if (!list)
|
|
126
|
+
throw new Error('Expect <list> argument to be [Waypoint or Waypoint<array>]');
|
|
127
|
+
token = token || this.intentToken;
|
|
128
|
+
if (!token)
|
|
129
|
+
throw new Error('Expected intent order token');
|
|
130
|
+
options = {
|
|
131
|
+
url: '/order/waypoints/add',
|
|
132
|
+
method: 'PUT',
|
|
133
|
+
headers: { 'de-intent-token': token },
|
|
134
|
+
body: !Array.isArray(list) ? [list] : list
|
|
135
|
+
};
|
|
136
|
+
return [4 /*yield*/, this.request(options)];
|
|
137
|
+
case 1:
|
|
138
|
+
_a = _b.sent(), error = _a.error, message = _a.message, waypoints = _a.waypoints;
|
|
139
|
+
if (error)
|
|
140
|
+
throw new Error(message);
|
|
141
|
+
return [2 /*return*/, waypoints];
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
Order.prototype.getWaypoint = function (no, token) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
+
var options, _a, error, message, waypoint;
|
|
149
|
+
return __generator(this, function (_b) {
|
|
150
|
+
switch (_b.label) {
|
|
151
|
+
case 0:
|
|
152
|
+
if (!no)
|
|
153
|
+
throw new Error('Expected waypoint number');
|
|
154
|
+
token = token || this.intentToken;
|
|
155
|
+
if (!token)
|
|
156
|
+
throw new Error('Expected intent order token');
|
|
157
|
+
options = {
|
|
158
|
+
url: "/order/waypoints/".concat(no),
|
|
159
|
+
method: 'GET',
|
|
160
|
+
headers: { 'de-intent-token': token }
|
|
161
|
+
};
|
|
162
|
+
return [4 /*yield*/, this.request(options)];
|
|
163
|
+
case 1:
|
|
164
|
+
_a = _b.sent(), error = _a.error, message = _a.message, waypoint = _a.waypoint;
|
|
165
|
+
if (error)
|
|
166
|
+
throw new Error(message);
|
|
167
|
+
return [2 /*return*/, waypoint];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
Order.prototype.fetchWaypoints = function (token) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
var options, _a, error, message, waypoints;
|
|
175
|
+
return __generator(this, function (_b) {
|
|
176
|
+
switch (_b.label) {
|
|
177
|
+
case 0:
|
|
178
|
+
token = token || this.intentToken;
|
|
179
|
+
if (!token)
|
|
180
|
+
throw new Error('Expected intent order token');
|
|
181
|
+
options = {
|
|
182
|
+
url: "/order/waypoints",
|
|
183
|
+
method: 'GET',
|
|
184
|
+
headers: { 'de-intent-token': token }
|
|
185
|
+
};
|
|
186
|
+
return [4 /*yield*/, this.request(options)];
|
|
187
|
+
case 1:
|
|
188
|
+
_a = _b.sent(), error = _a.error, message = _a.message, waypoints = _a.waypoints;
|
|
189
|
+
if (error)
|
|
190
|
+
throw new Error(message);
|
|
191
|
+
return [2 /*return*/, waypoints];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
Order.prototype.updateWaypoint = function (no, updates, token) {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
198
|
+
var options, _a, error, message, waypoints;
|
|
199
|
+
return __generator(this, function (_b) {
|
|
200
|
+
switch (_b.label) {
|
|
201
|
+
case 0:
|
|
202
|
+
if (!no)
|
|
203
|
+
throw new Error('Expected waypoint number');
|
|
204
|
+
if (!updates)
|
|
205
|
+
throw new Error('Expect <updates: WaypointOptions> to be object');
|
|
206
|
+
token = token || this.intentToken;
|
|
207
|
+
if (!token)
|
|
208
|
+
throw new Error('Expected intent order token');
|
|
209
|
+
options = {
|
|
210
|
+
url: "/order/waypoints/".concat(no),
|
|
211
|
+
method: 'PATCH',
|
|
212
|
+
headers: { 'de-intent-token': token },
|
|
213
|
+
body: updates
|
|
214
|
+
};
|
|
215
|
+
return [4 /*yield*/, this.request(options)];
|
|
216
|
+
case 1:
|
|
217
|
+
_a = _b.sent(), error = _a.error, message = _a.message, waypoints = _a.waypoints;
|
|
218
|
+
if (error)
|
|
219
|
+
throw new Error(message);
|
|
220
|
+
return [2 /*return*/, waypoints];
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
Order.prototype.deleteWaypoint = function (no, token) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
+
var options, _a, error, message, waypoints;
|
|
228
|
+
return __generator(this, function (_b) {
|
|
229
|
+
switch (_b.label) {
|
|
230
|
+
case 0:
|
|
231
|
+
if (!no)
|
|
232
|
+
throw new Error('Expected waypoint number');
|
|
233
|
+
token = token || this.intentToken;
|
|
234
|
+
if (!token)
|
|
235
|
+
throw new Error('Expected intent order token');
|
|
236
|
+
options = {
|
|
237
|
+
url: "/order/waypoints/".concat(no),
|
|
238
|
+
method: 'DELETE',
|
|
239
|
+
headers: { 'de-intent-token': token }
|
|
240
|
+
};
|
|
241
|
+
return [4 /*yield*/, this.request(options)];
|
|
242
|
+
case 1:
|
|
243
|
+
_a = _b.sent(), error = _a.error, message = _a.message, waypoints = _a.waypoints;
|
|
244
|
+
if (error)
|
|
245
|
+
throw new Error(message);
|
|
246
|
+
return [2 /*return*/, waypoints];
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Order packages
|
|
253
|
+
*/
|
|
254
|
+
Order.prototype.addPackage = function (list, token) {
|
|
255
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
256
|
+
var options, _a, error, message, packages;
|
|
257
|
+
return __generator(this, function (_b) {
|
|
258
|
+
switch (_b.label) {
|
|
259
|
+
case 0:
|
|
260
|
+
if (!list)
|
|
261
|
+
throw new Error('Expect <list> argument to be [Package or Package<array>]');
|
|
262
|
+
token = token || this.intentToken;
|
|
263
|
+
if (!token)
|
|
264
|
+
throw new Error('Expected intent order token');
|
|
265
|
+
options = {
|
|
266
|
+
url: '/order/packages/add',
|
|
267
|
+
method: 'PUT',
|
|
268
|
+
headers: { 'de-intent-token': token },
|
|
269
|
+
body: !Array.isArray(list) ? [list] : list
|
|
270
|
+
};
|
|
271
|
+
return [4 /*yield*/, this.request(options)];
|
|
272
|
+
case 1:
|
|
273
|
+
_a = _b.sent(), error = _a.error, message = _a.message, packages = _a.packages;
|
|
274
|
+
if (error)
|
|
275
|
+
throw new Error(message);
|
|
276
|
+
return [2 /*return*/, packages];
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
Order.prototype.getPackage = function (PTC, token) {
|
|
282
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
283
|
+
var options, response;
|
|
284
|
+
return __generator(this, function (_a) {
|
|
285
|
+
switch (_a.label) {
|
|
286
|
+
case 0:
|
|
287
|
+
if (!PTC)
|
|
288
|
+
throw new Error('Expected <PTC> Package Tracking Code');
|
|
289
|
+
token = token || this.intentToken;
|
|
290
|
+
if (!token)
|
|
291
|
+
throw new Error('Expected intent order token');
|
|
292
|
+
options = {
|
|
293
|
+
url: "/order/packages/".concat(PTC),
|
|
294
|
+
method: 'GET',
|
|
295
|
+
headers: { 'de-intent-token': token }
|
|
296
|
+
};
|
|
297
|
+
return [4 /*yield*/, this.request(options)];
|
|
298
|
+
case 1:
|
|
299
|
+
response = _a.sent();
|
|
300
|
+
if (response.error)
|
|
301
|
+
throw new Error(response.message);
|
|
302
|
+
return [2 /*return*/, response.package];
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
};
|
|
307
|
+
Order.prototype.fetchPackages = function (token) {
|
|
308
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
309
|
+
var options, _a, error, message, packages;
|
|
310
|
+
return __generator(this, function (_b) {
|
|
311
|
+
switch (_b.label) {
|
|
312
|
+
case 0:
|
|
313
|
+
token = token || this.intentToken;
|
|
314
|
+
if (!token)
|
|
315
|
+
throw new Error('Expected intent order token');
|
|
316
|
+
options = {
|
|
317
|
+
url: "/order/packages",
|
|
318
|
+
method: 'GET',
|
|
319
|
+
headers: { 'de-intent-token': token }
|
|
320
|
+
};
|
|
321
|
+
return [4 /*yield*/, this.request(options)];
|
|
322
|
+
case 1:
|
|
323
|
+
_a = _b.sent(), error = _a.error, message = _a.message, packages = _a.packages;
|
|
324
|
+
if (error)
|
|
325
|
+
throw new Error(message);
|
|
326
|
+
return [2 /*return*/, packages];
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
};
|
|
331
|
+
Order.prototype.updatePackage = function (PTC, updates, token) {
|
|
332
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
333
|
+
var options, _a, error, message, packages;
|
|
334
|
+
return __generator(this, function (_b) {
|
|
335
|
+
switch (_b.label) {
|
|
336
|
+
case 0:
|
|
337
|
+
if (!PTC)
|
|
338
|
+
throw new Error('Expected Package Tracking Code');
|
|
339
|
+
if (!updates)
|
|
340
|
+
throw new Error('Expect <updates: PackageOptions> to be object');
|
|
341
|
+
token = token || this.intentToken;
|
|
342
|
+
if (!token)
|
|
343
|
+
throw new Error('Expected intent order token');
|
|
344
|
+
options = {
|
|
345
|
+
url: "/order/packages/".concat(PTC),
|
|
346
|
+
method: 'PATCH',
|
|
347
|
+
headers: { 'de-intent-token': token },
|
|
348
|
+
body: updates
|
|
349
|
+
};
|
|
350
|
+
return [4 /*yield*/, this.request(options)];
|
|
351
|
+
case 1:
|
|
352
|
+
_a = _b.sent(), error = _a.error, message = _a.message, packages = _a.packages;
|
|
353
|
+
if (error)
|
|
354
|
+
throw new Error(message);
|
|
355
|
+
return [2 /*return*/, packages];
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
};
|
|
360
|
+
Order.prototype.deletePackage = function (PTC, token) {
|
|
361
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
362
|
+
var options, _a, error, message, packages;
|
|
363
|
+
return __generator(this, function (_b) {
|
|
364
|
+
switch (_b.label) {
|
|
365
|
+
case 0:
|
|
366
|
+
if (!PTC)
|
|
367
|
+
throw new Error('Expected Package Tracking Code');
|
|
368
|
+
token = token || this.intentToken;
|
|
369
|
+
if (!token)
|
|
370
|
+
throw new Error('Expected intent order token');
|
|
371
|
+
options = {
|
|
372
|
+
url: "/order/packages/".concat(PTC),
|
|
373
|
+
method: 'DELETE',
|
|
374
|
+
headers: { 'de-intent-token': token }
|
|
375
|
+
};
|
|
376
|
+
return [4 /*yield*/, this.request(options)];
|
|
377
|
+
case 1:
|
|
378
|
+
_a = _b.sent(), error = _a.error, message = _a.message, packages = _a.packages;
|
|
379
|
+
if (error)
|
|
380
|
+
throw new Error(message);
|
|
381
|
+
return [2 /*return*/, packages];
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
/**
|
|
387
|
+
* Order service
|
|
388
|
+
*/
|
|
389
|
+
Order.prototype.initiate = function (payload, token) {
|
|
390
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
391
|
+
var options, _a, error, message, jrtoken;
|
|
392
|
+
return __generator(this, function (_b) {
|
|
393
|
+
switch (_b.label) {
|
|
394
|
+
case 0:
|
|
395
|
+
if (!payload)
|
|
396
|
+
throw new Error('Expect <payload> argument to be [OrderService]');
|
|
397
|
+
token = token || this.intentToken;
|
|
398
|
+
if (!token)
|
|
399
|
+
throw new Error('Expected intent order token');
|
|
400
|
+
options = {
|
|
401
|
+
url: '/order/service',
|
|
402
|
+
method: 'POST',
|
|
403
|
+
headers: { 'de-intent-token': token },
|
|
404
|
+
body: payload
|
|
405
|
+
};
|
|
406
|
+
return [4 /*yield*/, this.request(options)];
|
|
407
|
+
case 1:
|
|
408
|
+
_a = _b.sent(), error = _a.error, message = _a.message, jrtoken = _a.jrtoken;
|
|
409
|
+
if (error)
|
|
410
|
+
throw new Error(message);
|
|
411
|
+
return [2 /*return*/, jrtoken];
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
Order.prototype.getService = function (token) {
|
|
417
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
418
|
+
var options, _a, error, message, service;
|
|
419
|
+
return __generator(this, function (_b) {
|
|
420
|
+
switch (_b.label) {
|
|
421
|
+
case 0:
|
|
422
|
+
token = token || this.intentToken;
|
|
423
|
+
if (!token)
|
|
424
|
+
throw new Error('Expected intent order token');
|
|
425
|
+
options = {
|
|
426
|
+
url: "/order/service",
|
|
427
|
+
method: 'GET',
|
|
428
|
+
headers: { 'de-intent-token': token }
|
|
429
|
+
};
|
|
430
|
+
return [4 /*yield*/, this.request(options)];
|
|
431
|
+
case 1:
|
|
432
|
+
_a = _b.sent(), error = _a.error, message = _a.message, service = _a.service;
|
|
433
|
+
if (error)
|
|
434
|
+
throw new Error(message);
|
|
435
|
+
return [2 /*return*/, service];
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
Order.prototype.updateService = function (updates, token) {
|
|
441
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
442
|
+
var options, _a, error, message, service;
|
|
443
|
+
return __generator(this, function (_b) {
|
|
444
|
+
switch (_b.label) {
|
|
445
|
+
case 0:
|
|
446
|
+
if (!updates)
|
|
447
|
+
throw new Error('Expect <updates: OrderServiceOptions> to be object');
|
|
448
|
+
token = token || this.intentToken;
|
|
449
|
+
if (!token)
|
|
450
|
+
throw new Error('Expected intent order token');
|
|
451
|
+
options = {
|
|
452
|
+
url: "/order/service",
|
|
453
|
+
method: 'PATCH',
|
|
454
|
+
headers: { 'de-intent-token': token },
|
|
455
|
+
body: updates
|
|
456
|
+
};
|
|
457
|
+
return [4 /*yield*/, this.request(options)];
|
|
458
|
+
case 1:
|
|
459
|
+
_a = _b.sent(), error = _a.error, message = _a.message, service = _a.service;
|
|
460
|
+
if (error)
|
|
461
|
+
throw new Error(message);
|
|
462
|
+
return [2 /*return*/, service];
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
Order.prototype.rateService = function (rating, token) {
|
|
468
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
469
|
+
var options, _a, error, message;
|
|
470
|
+
return __generator(this, function (_b) {
|
|
471
|
+
switch (_b.label) {
|
|
472
|
+
case 0:
|
|
473
|
+
if (!rating)
|
|
474
|
+
throw new Error('Expect <rating> to be number betwee 0 to 5');
|
|
475
|
+
token = token || this.intentToken;
|
|
476
|
+
if (!token)
|
|
477
|
+
throw new Error('Expected intent order token');
|
|
478
|
+
options = {
|
|
479
|
+
url: "/order/service/rating",
|
|
480
|
+
method: 'POST',
|
|
481
|
+
headers: { 'de-intent-token': token },
|
|
482
|
+
body: { rating: rating }
|
|
483
|
+
};
|
|
484
|
+
return [4 /*yield*/, this.request(options)];
|
|
485
|
+
case 1:
|
|
486
|
+
_a = _b.sent(), error = _a.error, message = _a.message;
|
|
487
|
+
if (error)
|
|
488
|
+
throw new Error(message);
|
|
489
|
+
return [2 /*return*/, true];
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* Order operators
|
|
496
|
+
*/
|
|
497
|
+
Order.prototype.getOperator = function (type, token) {
|
|
498
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
499
|
+
var options, _a, error, message, operators;
|
|
500
|
+
return __generator(this, function (_b) {
|
|
501
|
+
switch (_b.label) {
|
|
502
|
+
case 0:
|
|
503
|
+
if (!['LSP', 'partner', 'warehouse', 'agent'].includes(type))
|
|
504
|
+
throw new Error('Unknown order operator');
|
|
505
|
+
token = token || this.intentToken;
|
|
506
|
+
if (!token)
|
|
507
|
+
throw new Error('Expected intent order token');
|
|
508
|
+
options = {
|
|
509
|
+
url: "/order/operators?type=".concat(type),
|
|
510
|
+
method: 'GET',
|
|
511
|
+
headers: { 'de-intent-token': token }
|
|
512
|
+
};
|
|
513
|
+
return [4 /*yield*/, this.request(options)];
|
|
514
|
+
case 1:
|
|
515
|
+
_a = _b.sent(), error = _a.error, message = _a.message, operators = _a.operators;
|
|
516
|
+
if (error)
|
|
517
|
+
throw new Error(message);
|
|
518
|
+
return [2 /*return*/, operators[type]];
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
Order.prototype.getOperators = function (token) {
|
|
524
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
525
|
+
var options, _a, error, message, operators;
|
|
526
|
+
return __generator(this, function (_b) {
|
|
527
|
+
switch (_b.label) {
|
|
528
|
+
case 0:
|
|
529
|
+
token = token || this.intentToken;
|
|
530
|
+
if (!token)
|
|
531
|
+
throw new Error('Expected intent order token');
|
|
532
|
+
options = {
|
|
533
|
+
url: '/order/operators',
|
|
534
|
+
method: 'GET',
|
|
535
|
+
headers: { 'de-intent-token': token }
|
|
536
|
+
};
|
|
537
|
+
return [4 /*yield*/, this.request(options)];
|
|
538
|
+
case 1:
|
|
539
|
+
_a = _b.sent(), error = _a.error, message = _a.message, operators = _a.operators;
|
|
540
|
+
if (error)
|
|
541
|
+
throw new Error(message);
|
|
542
|
+
return [2 /*return*/, operators];
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Order monitoring
|
|
549
|
+
*/
|
|
550
|
+
Order.prototype.getCurrentStage = function (token) {
|
|
551
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
552
|
+
var options, _a, error, message, stage;
|
|
553
|
+
return __generator(this, function (_b) {
|
|
554
|
+
switch (_b.label) {
|
|
555
|
+
case 0:
|
|
556
|
+
token = token || this.intentToken;
|
|
557
|
+
if (!token)
|
|
558
|
+
throw new Error('Expected intent order token');
|
|
559
|
+
options = {
|
|
560
|
+
url: '/order/stage',
|
|
561
|
+
method: 'GET',
|
|
562
|
+
headers: { 'de-intent-token': token }
|
|
563
|
+
};
|
|
564
|
+
return [4 /*yield*/, this.request(options)];
|
|
565
|
+
case 1:
|
|
566
|
+
_a = _b.sent(), error = _a.error, message = _a.message, stage = _a.stage;
|
|
567
|
+
if (error)
|
|
568
|
+
throw new Error(message);
|
|
569
|
+
return [2 /*return*/, stage];
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
};
|
|
574
|
+
Order.prototype.getCurrentRoute = function (token) {
|
|
575
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
576
|
+
var options, _a, error, message, route;
|
|
577
|
+
return __generator(this, function (_b) {
|
|
578
|
+
switch (_b.label) {
|
|
579
|
+
case 0:
|
|
580
|
+
token = token || this.intentToken;
|
|
581
|
+
if (!token)
|
|
582
|
+
throw new Error('Expected intent order token');
|
|
583
|
+
options = {
|
|
584
|
+
url: '/order/route',
|
|
585
|
+
method: 'GET',
|
|
586
|
+
headers: { 'de-intent-token': token }
|
|
587
|
+
};
|
|
588
|
+
return [4 /*yield*/, this.request(options)];
|
|
589
|
+
case 1:
|
|
590
|
+
_a = _b.sent(), error = _a.error, message = _a.message, route = _a.route;
|
|
591
|
+
if (error)
|
|
592
|
+
throw new Error(message);
|
|
593
|
+
return [2 /*return*/, route];
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
});
|
|
597
|
+
};
|
|
598
|
+
return Order;
|
|
599
|
+
}(Access_1.default));
|
|
600
|
+
exports.default = Order;
|
|
601
|
+
//# sourceMappingURL=Order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Order.js","sourceRoot":"","sources":["../../../src/allend/DClient/Order.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,qDAAqC;AAuCrC;IAAmC,yBAAa;IAG9C,eAAa,MAAqB;QAChC,YAAA,MAAK,YAAE,MAAM,EAAE,KAAK,CAAE,SAAA;QAEtB,KAAI,CAAC,WAAW,GAAG,EAAE,CAAA;;IACvB,CAAC;IAED;;OAEG;IAEG,sBAAM,GAAZ,UAAc,QAAgB;;;;;;wBAC5B,IAAI,CAAC,QAAQ;4BACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;wBAGjD,OAAO,GAAuB;4BAC5B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AAuB;4BAC5B,GAAG,EAAE,cAAc;4BACnB,MAAM,EAAE,KAAK;4BACb,OAAO,EAAE,EAAE,iBAAiB,EAAE,KAAK,EAAE;yBACtC;wBAC2B,qBAAM,IAAI,CAAC,OAAO,CAAwB,OAAO,CAAE,EAAA;;wBAA/E,KAA4B,SAAmD,EAA7E,KAAK,WAAA,EAAE,OAAO,aAAA,EAAE,KAAK,WAAA;wBACvB,IAAI,KAAK;4BAAG,MAAM,IAAI,KAAK,CAAE,OAAO,CAAE,CAAA;wBAEtC,sBAAO,KAAK,EAAA;;;;KACb;IACH,YAAC;AAAD,CAAC,AArZD,CAAmC,gBAAa,GAqZ/C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Socket } from 'socket.io-client';
|
|
2
|
+
export type IoTClientOptions = {
|
|
3
|
+
channel: string;
|
|
4
|
+
accessToken: string;
|
|
5
|
+
dev?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare class Record {
|
|
8
|
+
private socket;
|
|
9
|
+
constructor(socket: Socket);
|
|
10
|
+
get(id: string): Promise<unknown>;
|
|
11
|
+
delete(id: string): Promise<unknown>;
|
|
12
|
+
fetch(params: {
|
|
13
|
+
limit?: number;
|
|
14
|
+
page?: number;
|
|
15
|
+
}): Promise<unknown>;
|
|
16
|
+
find(query: string): Promise<unknown>;
|
|
17
|
+
}
|
|
18
|
+
export default class IoTClient {
|
|
19
|
+
private static instance;
|
|
20
|
+
private options;
|
|
21
|
+
constructor(options: IoTClientOptions);
|
|
22
|
+
static getInstance(options: IoTClientOptions): IoTClient;
|
|
23
|
+
connect(): {
|
|
24
|
+
socket: Socket<import("@socket.io/component-emitter").DefaultEventsMap, import("@socket.io/component-emitter").DefaultEventsMap>;
|
|
25
|
+
api: {
|
|
26
|
+
records: Record;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|