@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,55 @@
1
+ import type { MapOptions } from '../../types';
2
+ import { EventEmitter } from 'events';
3
+ import Handles from './Handles';
4
+ import Controls from './Controls';
5
+ import Plugins, { type Plugin } from './Plugins';
6
+ export interface MSIInterface {
7
+ controls: Controls;
8
+ handles: Handles;
9
+ plugins: Plugins;
10
+ }
11
+ export default class MSI extends EventEmitter {
12
+ private isDev;
13
+ private baseURL;
14
+ private isConnected;
15
+ private options;
16
+ private chn?;
17
+ /**
18
+ * Mapbox control Client
19
+ *
20
+ * @param options - Initial options
21
+ */
22
+ constructor(options: MapOptions);
23
+ /**
24
+ * Listen to embedded iframe load
25
+ *
26
+ * @param e - DOM EventTarget object
27
+ */
28
+ private onload;
29
+ /**
30
+ * Embed the gateway into a web UI using
31
+ * an iframe.
32
+ */
33
+ private render;
34
+ /**
35
+ * Handle gateway embedding network error
36
+ */
37
+ private networkError;
38
+ /**
39
+ * Initiate embedding of gateway into current UI by
40
+ * check network and remote gateway availability.
41
+ */
42
+ load(): Promise<MSIInterface>;
43
+ /**
44
+ * @return - Boolean that tells whether the gateway is
45
+ * loaded and ready for interaction
46
+ */
47
+ isReady(): boolean | undefined;
48
+ /**
49
+ * Extend the kit's functionalities
50
+ *
51
+ * @param name - Name of the plugin that will be later used to access the plugin object interface
52
+ * @param fn - Function containing the logic of the plugin
53
+ */
54
+ plugin<T>(name: string, fn: Plugin<T>): void;
55
+ }
@@ -0,0 +1,155 @@
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 __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ var events_1 = require("events");
33
+ var iframe_io_1 = __importDefault(require("iframe.io"));
34
+ var Handles_1 = __importDefault(require("./Handles"));
35
+ var Controls_1 = __importDefault(require("./Controls"));
36
+ var Plugins_1 = __importDefault(require("./Plugins"));
37
+ var SANDBOX_RULES = ['allow-scripts', 'allow-same-origin'], REQUIRED_FEATURES = ['geolocation'], REGISTERED_PLUGINS = {};
38
+ var MSI = /** @class */ (function (_super) {
39
+ __extends(MSI, _super);
40
+ /**
41
+ * Mapbox control Client
42
+ *
43
+ * @param options - Initial options
44
+ */
45
+ function MSI(options) {
46
+ var _this = _super.call(this) || this;
47
+ _this.options = options;
48
+ if (!_this.options.accessToken)
49
+ throw new Error('Invalid Access Token');
50
+ _this.isDev = _this.options.env == 'dev' || false;
51
+ _this.baseURL = _this.isDev ? 'http://localhost:4800' : 'https://msi.dedot.io';
52
+ _this.isConnected = false;
53
+ return _this;
54
+ }
55
+ /**
56
+ * Listen to embedded iframe load
57
+ *
58
+ * @param e - DOM EventTarget object
59
+ */
60
+ MSI.prototype.onload = function (e) {
61
+ var _this = this;
62
+ var iframe = e.target;
63
+ // Remove all previous listeners when iframe reloaded
64
+ this.chn && this.chn.removeListeners();
65
+ this.chn = new iframe_io_1.default({ type: 'WINDOW' });
66
+ this.chn.initiate(iframe.contentWindow, this.baseURL);
67
+ this.chn
68
+ .once('connect', function () {
69
+ var _a;
70
+ (_a = _this.chn) === null || _a === void 0 ? void 0 : _a.emit('bind', __assign(__assign({}, _this.options), { origin: window.origin }), function (error) {
71
+ if (error)
72
+ return _this.emit('error', new Error(error));
73
+ _this.isConnected = true;
74
+ });
75
+ })
76
+ .on('error', function (error) { return _this.emit('error', typeof error == 'object' ? error : new Error(error)); })
77
+ .on('ready', function () {
78
+ console.log('Ready by ready-event');
79
+ _this.emit('ready');
80
+ _this.emit('loaded', _this.chn);
81
+ });
82
+ // .on('event', ( _event: string, ...args: any[] ) => this.emit( _event, ...args ) )
83
+ };
84
+ /**
85
+ * Embed the gateway into a web UI using
86
+ * an iframe.
87
+ */
88
+ MSI.prototype.render = function () {
89
+ var container = document.getElementById(this.options.element);
90
+ if (!container)
91
+ throw new Error("HTML Element Container <#".concat(this.options.element, "> Not Found"));
92
+ container.innerHTML = "<iframe id=\"de-sdk:map\"\n src=\"".concat(this.baseURL, "\"\n style=\"width:100%;height:100%;border:none;\"\n title=\"De.MSI Gateway\"\n importance=\"high\"\n referrerpolicy=\"origin\"\n allow=\"").concat(REQUIRED_FEATURES.join(), "\"\n sandbox=\"").concat(SANDBOX_RULES.join(' '), "\"></iframe>");
93
+ var element = document.getElementById('de-sdk:map');
94
+ if (!element)
95
+ throw new Error('Unexpected Error Occured. Check HTML Element selector');
96
+ element.onload = this.onload.bind(this);
97
+ };
98
+ /**
99
+ * Handle gateway embedding network error
100
+ */
101
+ MSI.prototype.networkError = function () {
102
+ this.isConnected = false;
103
+ this.emit('error', new Error('Internet network problem'));
104
+ };
105
+ /**
106
+ * Initiate embedding of gateway into current UI by
107
+ * check network and remote gateway availability.
108
+ */
109
+ MSI.prototype.load = function () {
110
+ var _this = this;
111
+ return new Promise(function (resolve, reject) {
112
+ var initializeAPI = function (chn) {
113
+ var
114
+ /**
115
+ * Manual controls of the map remotely
116
+ */
117
+ controls = new Controls_1.default(chn, _this.options),
118
+ /**
119
+ * Initialize handles
120
+ */
121
+ handles = new Handles_1.default(chn, controls, _this.options),
122
+ /**
123
+ * Initialize plugins & mount preloaded ones
124
+ */
125
+ plugins = new Plugins_1.default(chn, handles, controls, _this.options);
126
+ plugins.mount(REGISTERED_PLUGINS);
127
+ resolve({ controls: controls, handles: handles, plugins: plugins });
128
+ };
129
+ _this
130
+ .once('loaded', initializeAPI)
131
+ .once('error', reject);
132
+ window
133
+ .fetch(_this.baseURL, { mode: 'no-cors' })
134
+ .then(_this.render.bind(_this))
135
+ .catch(_this.networkError.bind(_this));
136
+ });
137
+ };
138
+ /**
139
+ * @return - Boolean that tells whether the gateway is
140
+ * loaded and ready for interaction
141
+ */
142
+ MSI.prototype.isReady = function () { return this.chn && this.isConnected; };
143
+ /**
144
+ * Extend the kit's functionalities
145
+ *
146
+ * @param name - Name of the plugin that will be later used to access the plugin object interface
147
+ * @param fn - Function containing the logic of the plugin
148
+ */
149
+ MSI.prototype.plugin = function (name, fn) {
150
+ REGISTERED_PLUGINS[name] = fn;
151
+ };
152
+ return MSI;
153
+ }(events_1.EventEmitter));
154
+ exports.default = MSI;
155
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/allend/MSI/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,iCAAqC;AACrC,wDAA2B;AAC3B,sDAA+B;AAC/B,wDAAiC;AACjC,sDAAgD;AAEhD,IACA,aAAa,GAAG,CAAC,eAAe,EAAE,mBAAmB,CAAC,EACtD,iBAAiB,GAAG,CAAC,aAAa,CAAC,EACnC,kBAAkB,GAAgC,EAAE,CAAA;AAQpD;IAAiC,uBAAY;IAO3C;;;;OAIG;IACH,aAAa,OAAmB;QAC9B,YAAA,MAAK,WAAE,SAAA;QAEP,KAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAI,CAAC,OAAO,CAAC,WAAW;YAC3B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QAEzC,KAAI,CAAC,KAAK,GAAG,KAAI,CAAC,OAAO,CAAC,GAAG,IAAI,KAAK,IAAI,KAAK,CAAA;QAC/C,KAAI,CAAC,OAAO,GAAG,KAAI,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,sBAAsB,CAAA;QAE5E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IAAI,iBAAO,CAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAI,CAAC,OAAO,CAAE,CAAA;gBAC7D,OAAO,CAAC,KAAK,CAAE,kBAAkB,CAAE,CAAA;gBAEnC,OAAO,CAAC,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAA;YACzC,CAAC,CAAA;YAED,KAAI;iBACH,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAE;iBAC9B,IAAI,CAAC,OAAO,EAAE,MAAM,CAAE,CAAA;YAEvB,MAAM;iBACL,KAAK,CAAE,KAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;iBACzC,IAAI,CAAE,KAAI,CAAC,MAAM,CAAC,IAAI,CAAE,KAAI,CAAE,CAAE;iBAChC,KAAK,CAAE,KAAI,CAAC,YAAY,CAAC,IAAI,CAAE,KAAI,CAAE,CAAE,CAAA;QAC1C,CAAC,CAAE,CAAA;IACL,CAAC;IAED;;;OAGG;IACH,qBAAO,GAAP,cAAW,OAAO,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,WAAW,CAAA,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,oBAAM,GAAN,UAAW,IAAY,EAAE,EAAa;QACpC,kBAAkB,CAAE,IAAI,CAAE,GAAG,EAAE,CAAA;IACjC,CAAC;IACH,UAAC;AAAD,CAAC,AA5ID,CAAiC,qBAAY,GA4I5C"}
@@ -0,0 +1,12 @@
1
+ import MSI, { type MSIInterface } from './MSI';
2
+ import Utils from '../utils';
3
+ import IoTClient, { type IoTClientOptions } from './IoTClient';
4
+ import Order from './DClient/Order';
5
+ import Event from './DClient/Event';
6
+ import Client from './DClient/Client';
7
+ declare const DClient: {
8
+ Client: typeof Client;
9
+ Order: typeof Order;
10
+ Event: typeof Event;
11
+ };
12
+ export { type MSIInterface, MSI, Utils, DClient, IoTClient, type IoTClientOptions };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.IoTClient = exports.DClient = exports.Utils = exports.MSI = void 0;
7
+ var MSI_1 = __importDefault(require("./MSI"));
8
+ exports.MSI = MSI_1.default;
9
+ var utils_1 = __importDefault(require("../utils"));
10
+ exports.Utils = utils_1.default;
11
+ var IoTClient_1 = __importDefault(require("./IoTClient"));
12
+ exports.IoTClient = IoTClient_1.default;
13
+ var Order_1 = __importDefault(require("./DClient/Order"));
14
+ var Event_1 = __importDefault(require("./DClient/Event"));
15
+ var Client_1 = __importDefault(require("./DClient/Client"));
16
+ var DClient = { Client: Client_1.default, Order: Order_1.default, Event: Event_1.default };
17
+ exports.DClient = DClient;
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/allend/index.ts"],"names":[],"mappings":";;;;;;AAAA,8CAA8C;AAY5C,cAZK,aAAG,CAYL;AAXL,mDAA4B;AAY1B,gBAZK,eAAK,CAYL;AAVP,0DAA8D;AAY5D,oBAZK,mBAAS,CAYL;AAXX,0DAAmC;AACnC,0DAAmC;AACnC,4DAAqC;AAErC,IAAM,OAAO,GAAG,EAAE,MAAM,kBAAA,EAAE,KAAK,iBAAA,EAAE,KAAK,iBAAA,EAAE,CAAA;AAMtC,0BAAO"}
@@ -0,0 +1,38 @@
1
+ import type { AuthCredentials, AuthOptions } from '../types/auth';
2
+ export default class Auth {
3
+ private version;
4
+ private options;
5
+ protected creds: AuthCredentials;
6
+ private refreshTimer?;
7
+ private autorefresh?;
8
+ private onNewToken?;
9
+ private baseURL;
10
+ private isRotating;
11
+ accessToken?: string;
12
+ constructor(creds: AuthCredentials, options?: AuthOptions);
13
+ private request;
14
+ private debug;
15
+ private error;
16
+ /**
17
+ * Schedule next token rotation
18
+ */
19
+ private scheduleRotation;
20
+ /**
21
+ * Clear rotation timer
22
+ */
23
+ private clearRotation;
24
+ getToken(): Promise<string>;
25
+ rotateToken(): Promise<string>;
26
+ /**
27
+ * Stop auto-refresh and clean up resources
28
+ */
29
+ stopAutoRefresh(): void;
30
+ /**
31
+ * Start auto-refresh
32
+ */
33
+ startAutoRefresh(): void;
34
+ /**
35
+ * Clean up all resources
36
+ */
37
+ destroy(): void;
38
+ }
@@ -0,0 +1,286 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ 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);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ 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;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __rest = (this && this.__rest) || function (s, e) {
50
+ var t = {};
51
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
52
+ t[p] = s[p];
53
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
54
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
55
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
56
+ t[p[i]] = s[p[i]];
57
+ }
58
+ return t;
59
+ };
60
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
61
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
62
+ if (ar || !(i in from)) {
63
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
64
+ ar[i] = from[i];
65
+ }
66
+ }
67
+ return to.concat(ar || Array.prototype.slice.call(from));
68
+ };
69
+ Object.defineProperty(exports, "__esModule", { value: true });
70
+ var baseUrl_1 = require("../baseUrl");
71
+ var ACCESS_TOKEN_EXPIRY = 3.75; // in 3 minutes 45 seconds
72
+ var Auth = /** @class */ (function () {
73
+ function Auth(creds, options) {
74
+ this.isRotating = false;
75
+ if (!creds)
76
+ throw new Error('Undefined Credentials. Check https://doc.dedot.io/sdk/auth');
77
+ if (!creds.context)
78
+ throw new Error('Undefined Context Reference. Check https://doc.dedot.io/sdk/auth');
79
+ if (!creds.remoteOrigin)
80
+ throw new Error('Undefined Remote Origin. Check https://doc.dedot.io/sdk/auth');
81
+ if (!creds.cid)
82
+ throw new Error('Undefined Connector ID. Check https://doc.dedot.io/sdk/auth');
83
+ if (!creds.secret)
84
+ throw new Error('Undefined Connector Secret. Check https://doc.dedot.io/sdk/auth');
85
+ this.creds = creds;
86
+ this.options = options || { env: 'dev' };
87
+ this.version = this.options.version || 1;
88
+ this.baseURL = baseUrl_1.API_SERVER_BASEURL[this.options.env || 'dev'];
89
+ this.autorefresh = this.options.autorefresh || false;
90
+ this.onNewToken = this.options.onNewToken;
91
+ }
92
+ Auth.prototype.request = function (_a) {
93
+ return __awaiter(this, void 0, void 0, function () {
94
+ var rawOptions, response;
95
+ var url = _a.url, options = __rest(_a, ["url"]);
96
+ return __generator(this, function (_b) {
97
+ switch (_b.label) {
98
+ case 0:
99
+ rawOptions = {
100
+ method: 'GET',
101
+ headers: {
102
+ /**
103
+ * Default User agent for SDK request calls
104
+ *
105
+ * NOTE: Later replace by latest SDK version
106
+ */
107
+ 'origin': this.creds.remoteOrigin,
108
+ 'de-user-agent': "De.remote/".concat(this.version, ".0")
109
+ }
110
+ };
111
+ if (this.accessToken)
112
+ rawOptions.headers.authorization = "Bearer ".concat(this.accessToken);
113
+ if (options.body) {
114
+ rawOptions.headers['content-type'] = 'application/json';
115
+ if (typeof options.body === 'object')
116
+ options.body = JSON.stringify(options.body);
117
+ }
118
+ options = __assign(__assign({}, rawOptions), options);
119
+ this.debug('Auth request', "".concat(this.baseURL, "/v").concat(this.version, "/").concat(url.replace(/^\//, '')), options);
120
+ return [4 /*yield*/, fetch("".concat(this.baseURL, "/v").concat(this.version, "/").concat(url.replace(/^\//, '')), options)];
121
+ case 1:
122
+ response = _b.sent();
123
+ return [4 /*yield*/, response.json()];
124
+ case 2: return [2 /*return*/, _b.sent()];
125
+ }
126
+ });
127
+ });
128
+ };
129
+ Auth.prototype.debug = function () {
130
+ var _a;
131
+ var args = [];
132
+ for (var _i = 0; _i < arguments.length; _i++) {
133
+ args[_i] = arguments[_i];
134
+ }
135
+ ((_a = this.options) === null || _a === void 0 ? void 0 : _a.env) === 'dev' && console.debug.apply(console, __spreadArray(['[Auth]'], args, false));
136
+ };
137
+ Auth.prototype.error = function () {
138
+ var args = [];
139
+ for (var _i = 0; _i < arguments.length; _i++) {
140
+ args[_i] = arguments[_i];
141
+ }
142
+ console.error.apply(console, __spreadArray(['[Auth]'], args, false));
143
+ };
144
+ /**
145
+ * Schedule next token rotation
146
+ */
147
+ Auth.prototype.scheduleRotation = function () {
148
+ var _this = this;
149
+ if (!this.autorefresh)
150
+ return;
151
+ this.clearRotation();
152
+ this.refreshTimer = setTimeout(function () { return _this.rotateToken(); }, ACCESS_TOKEN_EXPIRY * 60 * 1000);
153
+ };
154
+ /**
155
+ * Clear rotation timer
156
+ */
157
+ Auth.prototype.clearRotation = function () {
158
+ if (!this.refreshTimer)
159
+ return;
160
+ clearTimeout(this.refreshTimer);
161
+ this.refreshTimer = undefined;
162
+ };
163
+ Auth.prototype.getToken = function () {
164
+ return __awaiter(this, void 0, void 0, function () {
165
+ var options, _a, error, message, token;
166
+ return __generator(this, function (_b) {
167
+ switch (_b.label) {
168
+ case 0:
169
+ options = {
170
+ url: '/access/token',
171
+ method: 'POST',
172
+ body: this.creds
173
+ };
174
+ return [4 /*yield*/, this.request(options)];
175
+ case 1:
176
+ _a = _b.sent(), error = _a.error, message = _a.message, token = _a.token;
177
+ if (error)
178
+ throw new Error(message);
179
+ this.accessToken = token;
180
+ this.scheduleRotation(); // Schedule auto-refresh
181
+ return [2 /*return*/, token];
182
+ }
183
+ });
184
+ });
185
+ };
186
+ Auth.prototype.rotateToken = function () {
187
+ return __awaiter(this, void 0, void 0, function () {
188
+ var options, _a, error, message, token, error_1, newToken, fallbackError_1;
189
+ return __generator(this, function (_b) {
190
+ switch (_b.label) {
191
+ case 0:
192
+ // Prevent concurrent rotation attempts
193
+ if (this.isRotating) {
194
+ this.debug('Token rotation already in progress, skipping');
195
+ return [2 /*return*/, this.accessToken];
196
+ }
197
+ if (!this.accessToken)
198
+ throw new Error('No access token found');
199
+ this.isRotating = true;
200
+ _b.label = 1;
201
+ case 1:
202
+ _b.trys.push([1, 3, 8, 9]);
203
+ options = {
204
+ url: '/access/token/rotate',
205
+ method: 'PATCH',
206
+ body: { secret: this.creds.secret }
207
+ };
208
+ return [4 /*yield*/, this.request(options)];
209
+ case 2:
210
+ _a = _b.sent(), error = _a.error, message = _a.message, token = _a.token;
211
+ if (error)
212
+ throw new Error(message);
213
+ this.accessToken = token;
214
+ // Notify callback listener
215
+ if (typeof this.onNewToken === 'function')
216
+ try {
217
+ this.onNewToken(token);
218
+ }
219
+ catch (callbackError) {
220
+ this.error('[Auth] Error in onNewToken callback:', callbackError);
221
+ }
222
+ // Schedule next rotation
223
+ this.scheduleRotation();
224
+ this.debug('Token rotated successfully');
225
+ return [2 /*return*/, token];
226
+ case 3:
227
+ error_1 = _b.sent();
228
+ this.debug('Refresh access token failed:', error_1.message);
229
+ _b.label = 4;
230
+ case 4:
231
+ _b.trys.push([4, 6, , 7]);
232
+ return [4 /*yield*/, this.getToken()];
233
+ case 5:
234
+ newToken = _b.sent();
235
+ this.debug('Fallback to new token successful');
236
+ // Notify callback listener about new token
237
+ if (this.onNewToken)
238
+ try {
239
+ this.onNewToken(newToken);
240
+ }
241
+ catch (callbackError) {
242
+ this.error('Error in onNewToken callback:', callbackError);
243
+ }
244
+ return [2 /*return*/, newToken];
245
+ case 6:
246
+ fallbackError_1 = _b.sent();
247
+ this.error('Fallback to new token also failed:', fallbackError_1.message);
248
+ throw fallbackError_1;
249
+ case 7: return [3 /*break*/, 9];
250
+ case 8:
251
+ this.isRotating = false;
252
+ return [7 /*endfinally*/];
253
+ case 9: return [2 /*return*/];
254
+ }
255
+ });
256
+ });
257
+ };
258
+ /**
259
+ * Stop auto-refresh and clean up resources
260
+ */
261
+ Auth.prototype.stopAutoRefresh = function () {
262
+ this.debug('Stopping auto-refresh');
263
+ this.clearRotation();
264
+ this.autorefresh = false;
265
+ };
266
+ /**
267
+ * Start auto-refresh
268
+ */
269
+ Auth.prototype.startAutoRefresh = function () {
270
+ this.debug('Starting auto-refresh');
271
+ this.autorefresh = true;
272
+ this.scheduleRotation();
273
+ };
274
+ /**
275
+ * Clean up all resources
276
+ */
277
+ Auth.prototype.destroy = function () {
278
+ this.debug('Destroying Auth instance');
279
+ this.stopAutoRefresh();
280
+ this.accessToken = undefined;
281
+ this.onNewToken = undefined;
282
+ };
283
+ return Auth;
284
+ }());
285
+ exports.default = Auth;
286
+ //# sourceMappingURL=Auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Auth.js","sourceRoot":"","sources":["../../src/backend/Auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAA+C;AAG/C,IAAM,mBAAmB,GAAG,IAAI,CAAA,CAAC,0BAA0B;AAQ3D;IAWE,cAAa,KAAsB,EAAE,OAAqB;QAHlD,eAAU,GAAY,KAAK,CAAA;QAIjC,IAAI,CAAC,KAAK;YAAG,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAA;QAC1F,IAAI,CAAC,KAAK,CAAC,OAAO;YAAG,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAA;QACxG,IAAI,CAAC,KAAK,CAAC,YAAY;YAAG,M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AAG,KAAK,CAAA;;;;;;KAClC;IAED;;OAEG;IACH,8BAAe,GAAf;QACE,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;QAEnC,IAAI,CAAC,aAAa,EAAE,CAAA;QACpB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;IAC1B,CAAC;IAED;;OAEG;IACH,+BAAgB,GAAhB;QACE,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAA;QAEnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;QACvB,IAAI,CAAC,gBAAgB,EAAE,CAAA;IACzB,CAAC;IAED;;OAEG;IACH,sBAAO,GAAP;QACE,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACtC,IAAI,CAAC,eAAe,EAAE,CAAA;QAEtB,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;QAC5B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;IACH,WAAC;AAAD,CAAC,AA7LD,IA6LC"}
@@ -0,0 +1,12 @@
1
+ export declare const ASI_SERVER_BASEURL: {
2
+ dev: string;
3
+ prod: string;
4
+ };
5
+ export declare const API_SERVER_BASEURL: {
6
+ dev: string;
7
+ prod: string;
8
+ };
9
+ export declare const IOT_SERVER_BASEURL: {
10
+ dev: string;
11
+ prod: string;
12
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IOT_SERVER_BASEURL = exports.API_SERVER_BASEURL = exports.ASI_SERVER_BASEURL = void 0;
4
+ exports.ASI_SERVER_BASEURL = {
5
+ dev: 'http://localhost:44000',
6
+ prod: 'https://auth.dedot.io'
7
+ };
8
+ exports.API_SERVER_BASEURL = {
9
+ dev: 'http://localhost:24800',
10
+ prod: 'https://api.dedot.io'
11
+ };
12
+ exports.IOT_SERVER_BASEURL = {
13
+ dev: 'http://localhost:11011',
14
+ prod: 'https://iot.dedot.io'
15
+ };
16
+ //# sourceMappingURL=baseUrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseUrl.js","sourceRoot":"","sources":["../src/baseUrl.ts"],"names":[],"mappings":";;;AACa,QAAA,kBAAkB,GAAG;IAChC,GAAG,EAAE,wBAAwB;IAC7B,IAAI,EAAE,uBAAuB;CAC9B,CAAA;AACY,QAAA,kBAAkB,GAAG;IAChC,GAAG,EAAE,wBAAwB;IAC7B,IAAI,EAAE,sBAAsB;CAC7B,CAAA;AACY,QAAA,kBAAkB,GAAG;IAChC,GAAG,EAAE,wBAAwB;IAC7B,IAAI,EAAE,sBAAsB;CAC7B,CAAA"}