@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.
Files changed (74) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4391 -0
  3. package/dist/allend/Access.d.ts +15 -0
  4. package/dist/allend/Access.js +164 -0
  5. package/dist/allend/Access.js.map +1 -0
  6. package/dist/allend/DAuth/index.d.ts +20 -0
  7. package/dist/allend/DAuth/index.js +92 -0
  8. package/dist/allend/DAuth/index.js.map +1 -0
  9. package/dist/allend/DClient/Client.d.ts +10 -0
  10. package/dist/allend/DClient/Client.js +144 -0
  11. package/dist/allend/DClient/Client.js.map +1 -0
  12. package/dist/allend/DClient/Event.d.ts +18 -0
  13. package/dist/allend/DClient/Event.js +100 -0
  14. package/dist/allend/DClient/Event.js.map +1 -0
  15. package/dist/allend/DClient/Order.d.ts +49 -0
  16. package/dist/allend/DClient/Order.js +601 -0
  17. package/dist/allend/DClient/Order.js.map +1 -0
  18. package/dist/allend/IoTClient.d.ts +29 -0
  19. package/dist/allend/IoTClient.js +59 -0
  20. package/dist/allend/IoTClient.js.map +1 -0
  21. package/dist/allend/MSI/Controls.d.ts +256 -0
  22. package/dist/allend/MSI/Controls.js +763 -0
  23. package/dist/allend/MSI/Controls.js.map +1 -0
  24. package/dist/allend/MSI/Handles.d.ts +88 -0
  25. package/dist/allend/MSI/Handles.js +445 -0
  26. package/dist/allend/MSI/Handles.js.map +1 -0
  27. package/dist/allend/MSI/Plugins.d.ts +22 -0
  28. package/dist/allend/MSI/Plugins.js +38 -0
  29. package/dist/allend/MSI/Plugins.js.map +1 -0
  30. package/dist/allend/MSI/index.d.ts +55 -0
  31. package/dist/allend/MSI/index.js +155 -0
  32. package/dist/allend/MSI/index.js.map +1 -0
  33. package/dist/allend/index.d.ts +12 -0
  34. package/dist/allend/index.js +18 -0
  35. package/dist/allend/index.js.map +1 -0
  36. package/dist/backend/Auth.d.ts +38 -0
  37. package/dist/backend/Auth.js +286 -0
  38. package/dist/backend/Auth.js.map +1 -0
  39. package/dist/baseUrl.d.ts +12 -0
  40. package/dist/baseUrl.js +16 -0
  41. package/dist/baseUrl.js.map +1 -0
  42. package/dist/bundle.js +1 -0
  43. package/dist/index.d.ts +13 -0
  44. package/dist/index.js +20 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/types/access.d.ts +8 -0
  47. package/dist/types/auth.d.ts +27 -0
  48. package/dist/types/index.d.ts +281 -0
  49. package/dist/utils/index.d.ts +5 -0
  50. package/dist/utils/index.js +8 -0
  51. package/dist/utils/index.js.map +1 -0
  52. package/dist/utils/stream.d.ts +20 -0
  53. package/dist/utils/stream.js +63 -0
  54. package/dist/utils/stream.js.map +1 -0
  55. package/package.json +66 -0
  56. package/src/allend/Access.ts +78 -0
  57. package/src/allend/DAuth/index.ts +39 -0
  58. package/src/allend/DClient/Client.ts +76 -0
  59. package/src/allend/DClient/Event.ts +76 -0
  60. package/src/allend/DClient/Order.ts +452 -0
  61. package/src/allend/IoTClient.ts +68 -0
  62. package/src/allend/MSI/Controls.ts +760 -0
  63. package/src/allend/MSI/Handles.ts +387 -0
  64. package/src/allend/MSI/Plugins.ts +52 -0
  65. package/src/allend/MSI/index.ts +160 -0
  66. package/src/allend/index.ts +18 -0
  67. package/src/backend/Auth.ts +201 -0
  68. package/src/baseUrl.ts +13 -0
  69. package/src/index.ts +19 -0
  70. package/src/types/access.d.ts +8 -0
  71. package/src/types/auth.d.ts +27 -0
  72. package/src/types/index.d.ts +281 -0
  73. package/src/utils/index.ts +4 -0
  74. package/src/utils/stream.ts +68 -0
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Record = void 0;
4
+ var socket_io_client_1 = require("socket.io-client");
5
+ var Record = /** @class */ (function () {
6
+ function Record(socket) {
7
+ this.socket = socket;
8
+ }
9
+ Record.prototype.get = function (id) {
10
+ var _this = this;
11
+ return new Promise(function (resolve, reject) {
12
+ _this.socket.emit('@record:get', id, function (error, response) { return error ? reject(error) : resolve(response); });
13
+ });
14
+ };
15
+ Record.prototype.delete = function (id) {
16
+ var _this = this;
17
+ return new Promise(function (resolve, reject) {
18
+ _this.socket.emit('@record:del', id, function (error, response) { return error ? reject(error) : resolve(response); });
19
+ });
20
+ };
21
+ Record.prototype.fetch = function (params) {
22
+ var _this = this;
23
+ return new Promise(function (resolve, reject) {
24
+ _this.socket.emit('@record:fetch', params, function (error, response) { return error ? reject(error) : resolve(response); });
25
+ });
26
+ };
27
+ Record.prototype.find = function (query) {
28
+ var _this = this;
29
+ return new Promise(function (resolve, reject) {
30
+ _this.socket.emit('@record:find', query, function (error, response) { return error ? reject(error) : resolve(response); });
31
+ });
32
+ };
33
+ return Record;
34
+ }());
35
+ exports.Record = Record;
36
+ var IoTClient = /** @class */ (function () {
37
+ function IoTClient(options) {
38
+ if (!options.accessToken)
39
+ throw new Error('Undefined Access Token');
40
+ this.options = options;
41
+ }
42
+ IoTClient.getInstance = function (options) {
43
+ if (!IoTClient.instance)
44
+ IoTClient.instance = new IoTClient(options);
45
+ return IoTClient.instance;
46
+ };
47
+ IoTClient.prototype.connect = function () {
48
+ var baseURL = this.options.dev ? 'http://localhost:11011' : 'https://iot.dedot.io', socket = (0, socket_io_client_1.io)("".concat(baseURL, "/").concat(this.options.channel), { auth: { accessToken: this.options.accessToken } });
49
+ return {
50
+ socket: socket,
51
+ api: {
52
+ records: new Record(socket)
53
+ }
54
+ };
55
+ };
56
+ return IoTClient;
57
+ }());
58
+ exports.default = IoTClient;
59
+ //# sourceMappingURL=IoTClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IoTClient.js","sourceRoot":"","sources":["../../src/allend/IoTClient.ts"],"names":[],"mappings":";;;AACA,qDAA6C;AAQ7C;IACE,gBAAqB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEvC,oBAAG,GAAH,UAAK,EAAU;QAAf,iBAIC;QAHC,OAAO,IAAI,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M,CAAE,KAAK,CAAE,CAAC,CAAC,CAAC,OAAO,CAAE,QAAQ,CAAE,EAA7C,CAA6C,CAAE,CAAA;QAC7H,CAAC,CAAE,CAAA;IACL,CAAC;IACH,aAAC;AAAD,CAAC,AA1BD,IA0BC;AA1BY,wBAAM;AA4BnB;IAIE,mBAAa,OAAyB;QACpC,IAAI,CAAC,OAAO,CAAC,WAAW;YACtB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;QAE3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAEM,qBAAW,GAAlB,UAAoB,OAAyB;QAC3C,IAAI,CAAC,SAAS,CAAC,QAAQ;YACrB,SAAS,CAAC,QAAQ,GAAG,IAAI,SAAS,CAAE,OAAO,CAAE,CAAA;QAE/C,OAAO,SAAS,CAAC,QAAQ,CAAA;IAC3B,CAAC;IAED,2BAAO,GAAP;QACE,IACA,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,sBAAsB,EAC9E,MAAM,GAAG,IAAA,qBAAE,EAAC,UAAG,OAAO,cAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAE,EAAE,EAAE,IAAI,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;QAEtG,OAAO;YACL,MAAM,QAAA;YACN,GAAG,EAAE;gBACH,OAAO,EAAE,IAAI,MAAM,CAAE,MAAM,CAAE;aAC9B;SACF,CAAA;IACH,CAAC;IACH,gBAAC;AAAD,CAAC,AA9BD,IA8BC"}
@@ -0,0 +1,256 @@
1
+ import type { RTLocation, Coordinates, MapLayerStyle, Caption, MapOptions, SearchPlace, EntitySpecs, ActivePosition, UserLocationOptions, DragPickContentType, DragPickContent, MapWaypoint, Journey, RouteOptions, RoutesFitBoundsOptions } from '../../types';
2
+ import IOF, { Listener } from 'iframe.io';
3
+ export default class Controls {
4
+ private options;
5
+ private chn;
6
+ constructor(chn: IOF, options: MapOptions);
7
+ /**
8
+ * Listen to MSI events
9
+ */
10
+ on(event: string, listener: Listener): void;
11
+ /**
12
+ * Remove a listener of MSI events
13
+ */
14
+ off(event: string, listener: Listener): void;
15
+ /**
16
+ * Remove all listen of MSI events
17
+ */
18
+ removeListeners(listener: Listener): void;
19
+ /**
20
+ * Refresh access token to remove server
21
+ *
22
+ * @param token - Latest access token
23
+ */
24
+ refreshToken(token: string): void;
25
+ /**
26
+ * Update map style
27
+ *
28
+ * @param style - Map style ID
29
+ */
30
+ setMapStyle(style: MapLayerStyle): Promise<void>;
31
+ /**
32
+ * @return - User's current GPS location
33
+ */
34
+ getCurrentLocation(): Promise<RTLocation | null>;
35
+ /**
36
+ * Pin user's current location on the current active map
37
+ *
38
+ * @return - User's current GPS location coordinates or `null` when it failed
39
+ */
40
+ pinCurrentLocation(): Promise<Coordinates | null>;
41
+ /**
42
+ * Set live location tracking options
43
+ *
44
+ * @param options - User location tracking options
45
+ */
46
+ setLiveLocationOptions(options: UserLocationOptions): Promise<void>;
47
+ /**
48
+ * Start tracking user's live location
49
+ */
50
+ trackLiveLocation(): Promise<void>;
51
+ /**
52
+ * Stop tracking user's live location
53
+ */
54
+ untrackLiveLocation(): Promise<void>;
55
+ /**
56
+ * Enable drag pick functionality
57
+ *
58
+ * @param location - (Optional) Initial location for drag pick
59
+ */
60
+ enableDragPickLocation(location: Coordinates): Promise<void>;
61
+ /**
62
+ * Disable drag pick functionality
63
+ */
64
+ disableDragPickLocation(): Promise<void>;
65
+ /**
66
+ * Set drag pick content
67
+ *
68
+ * @param type - Content type for drag pick
69
+ * @param content - Content data for drag pick
70
+ */
71
+ setDragPickContent(type: DragPickContentType, content: DragPickContent): Promise<void>;
72
+ /**
73
+ * Get a location coordinates of placed that matched this name
74
+ *
75
+ * @param name - Place name to resolve
76
+ * @return - Array list of coordinates
77
+ */
78
+ resolvePlace(name: string): Promise<Coordinates | null>;
79
+ /**
80
+ * Get a location details of placed that matched this coordinates
81
+ *
82
+ * @param coords - Coordinates
83
+ * @return - Array list of geocoding data
84
+ */
85
+ resolveCoordinates(coords: Coordinates | string): Promise<Coordinates | null>;
86
+ /**
87
+ * Search a location or places
88
+ *
89
+ * @param input - Place in string
90
+ * @return - Autocompletion list matched places
91
+ */
92
+ searchQuery(input: string): Promise<string[]>;
93
+ /**
94
+ * Select a suggested place by the search
95
+ *
96
+ * @param index - Index of place in suggested list
97
+ * @return - More details of selected place
98
+ */
99
+ searchSelect(index: number): Promise<SearchPlace | null>;
100
+ /**
101
+ * Show nearby entities around coordinates
102
+ *
103
+ * @param list - Array of entity specifications
104
+ */
105
+ showNearby(list: EntitySpecs[]): Promise<void>;
106
+ /**
107
+ * Remove all displaying nearby entities
108
+ */
109
+ removeNearby(): Promise<void>;
110
+ /**
111
+ * Add a new nearby entity
112
+ *
113
+ * @param entity - Entity specification
114
+ */
115
+ addNearbyEntity(entity: EntitySpecs): Promise<void>;
116
+ /**
117
+ * Update a nearby entity position
118
+ *
119
+ * @param activePosition - Entity ID and new position
120
+ */
121
+ moveNearbyEntity(activePosition: ActivePosition): Promise<void>;
122
+ /**
123
+ * Remove a nearby entity
124
+ *
125
+ * @param id - Entity ID to remove
126
+ */
127
+ removeNearbyEntity(id: string): Promise<void>;
128
+ /**
129
+ * Set complete route with journey specifications
130
+ *
131
+ * @param journey - Journey specifications including route ID, origin, destination, waypoints, and options
132
+ */
133
+ setRoute(journey: Journey): Promise<void>;
134
+ /**
135
+ * Set route origin
136
+ *
137
+ * @param routeId - Route identifier
138
+ * @param point - Waypoint specification for origin
139
+ */
140
+ setRouteOrigin(routeId: string, point: MapWaypoint): Promise<void>;
141
+ /**
142
+ * Remove route origin
143
+ *
144
+ * @param routeId - Route identifier
145
+ */
146
+ removeRouteOrigin(routeId: string): Promise<void>;
147
+ /**
148
+ * Set route destination
149
+ *
150
+ * @param routeId - Route identifier
151
+ * @param point - Waypoint specification for destination
152
+ */
153
+ setRouteDestination(routeId: string, point: MapWaypoint): Promise<void>;
154
+ /**
155
+ * Remove route destination
156
+ *
157
+ * @param routeId - Route identifier
158
+ */
159
+ removeRouteDestination(routeId: string): Promise<void>;
160
+ /**
161
+ * Add a route waypoint
162
+ *
163
+ * @param routeId - Route identifier
164
+ * @param point - Waypoint specification
165
+ */
166
+ addRouteWaypoint(routeId: string, point: MapWaypoint): Promise<void>;
167
+ /**
168
+ * Update a route waypoint
169
+ *
170
+ * @param routeId - Route identifier
171
+ * @param point - Waypoint specification with index
172
+ */
173
+ updateRouteWaypoint(routeId: string, point: MapWaypoint): Promise<void>;
174
+ /**
175
+ * Remove a route waypoint
176
+ *
177
+ * @param routeId - Route identifier
178
+ * @param index - Waypoint index to remove
179
+ */
180
+ removeRouteWaypoint(routeId: string, index: number): Promise<void>;
181
+ /**
182
+ * Fit route bounds
183
+ *
184
+ * @param routeId - Route identifier
185
+ * @param margin - Margin in px
186
+ */
187
+ fitRouteBounds(routeId: string, margin?: number): Promise<void>;
188
+ /**
189
+ * Fit all/many routes bounds
190
+ *
191
+ * @param options - Routes fit bounds options
192
+ */
193
+ fitRoutesBounds(options: RoutesFitBoundsOptions): Promise<void>;
194
+ /**
195
+ * Set waypoint caption
196
+ *
197
+ * @param routeId - Route identifier
198
+ * @param id - Waypoint identifier (string or number)
199
+ * @param caption - Caption information to set
200
+ */
201
+ setWaypointCaption(routeId: string, id: string | number, caption: Caption): Promise<void>;
202
+ /**
203
+ * Update waypoint caption
204
+ *
205
+ * @param routeId - Route identifier
206
+ * @param id - Waypoint identifier (string or number)
207
+ * @param caption - Caption information to update
208
+ */
209
+ updateWaypointCaption(routeId: string, id: string | number, caption: Caption): Promise<void>;
210
+ /**
211
+ * Remove waypoint caption
212
+ *
213
+ * @param routeId - Route identifier
214
+ * @param id - Waypoint identifier (string or number)
215
+ */
216
+ removeWaypointCaption(routeId: string, id: string | number): Promise<void>;
217
+ /**
218
+ * Mount navigation route
219
+ *
220
+ * @param routeId - Route identifier for navigation
221
+ */
222
+ mountNavigation(routeId: string | number): Promise<void>;
223
+ /**
224
+ * Unmount navigation route
225
+ */
226
+ unmountNavigation(): Promise<void>;
227
+ /**
228
+ * Load navigation direction
229
+ */
230
+ loadNavigation(): Promise<void>;
231
+ /**
232
+ * Set initial navigation position
233
+ *
234
+ * @param position - Initial GPS location for navigation
235
+ */
236
+ setInitialNavigationPosition(position: RTLocation): Promise<void>;
237
+ /**
238
+ * Navigate to new position
239
+ *
240
+ * @param position - Current GPS location for navigation update
241
+ */
242
+ navigate(position: RTLocation): Promise<void>;
243
+ /**
244
+ * Upsert navigation direction data
245
+ *
246
+ * @param routeId - Route identifier for navigation
247
+ * @param direction - Direction data
248
+ * @param position - (Optional) Current GPS position
249
+ * @params options - Route options
250
+ */
251
+ casting(routeId: string | number, direction: any, position?: RTLocation, options?: RouteOptions): Promise<void>;
252
+ /**
253
+ * Dismiss navigation
254
+ */
255
+ dismissNavigation(): Promise<void>;
256
+ }