@difizen/libro-terminal 0.1.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 +1 -0
- package/es/configuration.js +226 -0
- package/es/connection.d.ts +108 -0
- package/es/connection.d.ts.map +1 -0
- package/es/connection.js +385 -0
- package/es/index.d.ts +2 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +1 -0
- package/es/manager.d.ts +104 -0
- package/es/manager.d.ts.map +1 -0
- package/es/manager.js +469 -0
- package/es/module.d.ts +3 -0
- package/es/module.d.ts.map +1 -0
- package/es/module.js +22 -0
- package/es/protocol.d.ts +87 -0
- package/es/protocol.d.ts.map +1 -0
- package/es/protocol.js +16 -0
- package/es/restapi.d.ts +11 -0
- package/es/restapi.d.ts.map +1 -0
- package/es/restapi.js +181 -0
- package/es/theme-service.js +183 -0
- package/es/view.d.ts +85 -0
- package/es/view.d.ts.map +1 -0
- package/es/view.js +317 -0
- package/package.json +63 -0
- package/src/configuration.ts +276 -0
- package/src/connection.ts +347 -0
- package/src/index.spec.ts +8 -0
- package/src/index.ts +1 -0
- package/src/manager.ts +280 -0
- package/src/module.ts +29 -0
- package/src/protocol.ts +102 -0
- package/src/restapi.ts +75 -0
- package/src/theme-service.ts +180 -0
- package/src/view.tsx +327 -0
package/es/manager.js
ADDED
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
7
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
9
|
+
function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
|
|
10
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
15
|
+
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
|
|
16
|
+
function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
|
|
17
|
+
// Copyright (c) Jupyter Development Team.
|
|
18
|
+
// Distributed under the terms of the Modified BSD License.
|
|
19
|
+
|
|
20
|
+
import { Poll } from '@difizen/libro-common';
|
|
21
|
+
import { NetworkError } from '@difizen/libro-kernel';
|
|
22
|
+
import { singleton } from '@difizen/mana-app';
|
|
23
|
+
import { Emitter, inject } from '@difizen/mana-app';
|
|
24
|
+
import { TerminalConnectionFactory } from "./protocol.js";
|
|
25
|
+
import { TerminalRestAPI } from "./restapi.js";
|
|
26
|
+
export var TerminalManager = (_dec = singleton(), _dec2 = inject(TerminalRestAPI), _dec3 = inject(TerminalConnectionFactory), _dec(_class = (_class2 = /*#__PURE__*/function () {
|
|
27
|
+
/**
|
|
28
|
+
* Construct a new terminal manager.
|
|
29
|
+
*/
|
|
30
|
+
function TerminalManager() {
|
|
31
|
+
var _this = this;
|
|
32
|
+
_classCallCheck(this, TerminalManager);
|
|
33
|
+
this.disposed = false;
|
|
34
|
+
this._isReady = false;
|
|
35
|
+
this._terminalConnections = new Set();
|
|
36
|
+
this._runningChanged = new Emitter();
|
|
37
|
+
this._connectionFailure = new Emitter();
|
|
38
|
+
// As an optimization, we unwrap the models to just store the names.
|
|
39
|
+
this._names = [];
|
|
40
|
+
_initializerDefineProperty(this, "terminalRestAPI", _descriptor, this);
|
|
41
|
+
_initializerDefineProperty(this, "terminalConnectionFactory", _descriptor2, this);
|
|
42
|
+
this.getOrCreate = /*#__PURE__*/function () {
|
|
43
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
44
|
+
var name, cwd, connection, models;
|
|
45
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
46
|
+
while (1) switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
name = options.name, cwd = options.cwd;
|
|
49
|
+
if (!name) {
|
|
50
|
+
_context.next = 14;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
_context.next = 4;
|
|
54
|
+
return _this.terminalRestAPI.listRunning();
|
|
55
|
+
case 4:
|
|
56
|
+
models = _context.sent;
|
|
57
|
+
if (!models.map(function (d) {
|
|
58
|
+
return d.name;
|
|
59
|
+
}).includes(name)) {
|
|
60
|
+
_context.next = 9;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
// we are restoring a terminal widget and the corresponding terminal exists
|
|
64
|
+
// let's connect to it
|
|
65
|
+
connection = _this.connectTo({
|
|
66
|
+
name: name
|
|
67
|
+
});
|
|
68
|
+
_context.next = 12;
|
|
69
|
+
break;
|
|
70
|
+
case 9:
|
|
71
|
+
_context.next = 11;
|
|
72
|
+
return _this.startNew({
|
|
73
|
+
name: name,
|
|
74
|
+
cwd: cwd
|
|
75
|
+
});
|
|
76
|
+
case 11:
|
|
77
|
+
connection = _context.sent;
|
|
78
|
+
case 12:
|
|
79
|
+
_context.next = 17;
|
|
80
|
+
break;
|
|
81
|
+
case 14:
|
|
82
|
+
_context.next = 16;
|
|
83
|
+
return _this.startNew({
|
|
84
|
+
cwd: cwd
|
|
85
|
+
});
|
|
86
|
+
case 16:
|
|
87
|
+
connection = _context.sent;
|
|
88
|
+
case 17:
|
|
89
|
+
return _context.abrupt("return", connection);
|
|
90
|
+
case 18:
|
|
91
|
+
case "end":
|
|
92
|
+
return _context.stop();
|
|
93
|
+
}
|
|
94
|
+
}, _callee);
|
|
95
|
+
}));
|
|
96
|
+
return function (_x) {
|
|
97
|
+
return _ref.apply(this, arguments);
|
|
98
|
+
};
|
|
99
|
+
}();
|
|
100
|
+
// Start polling with exponential backoff.
|
|
101
|
+
this._pollModels = new Poll({
|
|
102
|
+
auto: false,
|
|
103
|
+
factory: function factory() {
|
|
104
|
+
return _this.requestRunning();
|
|
105
|
+
},
|
|
106
|
+
frequency: {
|
|
107
|
+
interval: 10 * 1000,
|
|
108
|
+
backoff: true,
|
|
109
|
+
max: 300 * 1000
|
|
110
|
+
},
|
|
111
|
+
name: "@jupyterlab/services:TerminalManager#models",
|
|
112
|
+
standby: 'when-hidden'
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Initialize internal data.
|
|
116
|
+
this._ready = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
117
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
118
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
_context2.next = 2;
|
|
121
|
+
return _this._pollModels.start();
|
|
122
|
+
case 2:
|
|
123
|
+
_context2.next = 4;
|
|
124
|
+
return _this._pollModels.tick;
|
|
125
|
+
case 4:
|
|
126
|
+
_this._isReady = true;
|
|
127
|
+
case 5:
|
|
128
|
+
case "end":
|
|
129
|
+
return _context2.stop();
|
|
130
|
+
}
|
|
131
|
+
}, _callee2);
|
|
132
|
+
}))();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The server settings of the manager.
|
|
137
|
+
*/
|
|
138
|
+
_createClass(TerminalManager, [{
|
|
139
|
+
key: "_models",
|
|
140
|
+
get: function get() {
|
|
141
|
+
return this._names.map(function (name) {
|
|
142
|
+
return {
|
|
143
|
+
name: name
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}, {
|
|
148
|
+
key: "isReady",
|
|
149
|
+
get:
|
|
150
|
+
/**
|
|
151
|
+
* Test whether the manager is ready.
|
|
152
|
+
*/
|
|
153
|
+
function get() {
|
|
154
|
+
return this._isReady;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* A promise that fulfills when the manager is ready.
|
|
159
|
+
*/
|
|
160
|
+
}, {
|
|
161
|
+
key: "ready",
|
|
162
|
+
get: function get() {
|
|
163
|
+
return this._ready;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* A signal emitted when the running terminals change.
|
|
168
|
+
*/
|
|
169
|
+
}, {
|
|
170
|
+
key: "runningChanged",
|
|
171
|
+
get: function get() {
|
|
172
|
+
return this._runningChanged.event;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A signal emitted when there is a connection failure.
|
|
177
|
+
*/
|
|
178
|
+
}, {
|
|
179
|
+
key: "connectionFailure",
|
|
180
|
+
get: function get() {
|
|
181
|
+
return this._connectionFailure.event;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Dispose of the resources used by the manager.
|
|
186
|
+
*/
|
|
187
|
+
}, {
|
|
188
|
+
key: "dispose",
|
|
189
|
+
value: function dispose() {
|
|
190
|
+
if (this.disposed) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this._names.length = 0;
|
|
194
|
+
this._terminalConnections.forEach(function (x) {
|
|
195
|
+
return x.dispose();
|
|
196
|
+
});
|
|
197
|
+
this._pollModels.dispose();
|
|
198
|
+
this.disposed = true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/*
|
|
202
|
+
* Connect to a running terminal.
|
|
203
|
+
*
|
|
204
|
+
* @param options - The options used to connect to the terminal.
|
|
205
|
+
*
|
|
206
|
+
* @returns The new terminal connection instance.
|
|
207
|
+
*
|
|
208
|
+
* #### Notes
|
|
209
|
+
* The manager `serverSettings` will be used.
|
|
210
|
+
*/
|
|
211
|
+
}, {
|
|
212
|
+
key: "connectTo",
|
|
213
|
+
value: function connectTo(options) {
|
|
214
|
+
var terminalConnection = this.terminalConnectionFactory(options);
|
|
215
|
+
this._onStarted(terminalConnection);
|
|
216
|
+
if (!this._names.includes(options.name)) {
|
|
217
|
+
// We trust the user to connect to an existing session, but we verify
|
|
218
|
+
// asynchronously.
|
|
219
|
+
void this.refreshRunning().catch(function () {
|
|
220
|
+
/* no-op */
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return terminalConnection;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Create an iterator over the most recent running terminals.
|
|
228
|
+
*
|
|
229
|
+
* @returns A new iterator over the running terminals.
|
|
230
|
+
*/
|
|
231
|
+
}, {
|
|
232
|
+
key: "running",
|
|
233
|
+
value: function running() {
|
|
234
|
+
return this._models[Symbol.iterator]();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Force a refresh of the running terminals.
|
|
239
|
+
*
|
|
240
|
+
* @returns A promise that with the list of running terminals.
|
|
241
|
+
*
|
|
242
|
+
* #### Notes
|
|
243
|
+
* This is intended to be called only in response to a user action,
|
|
244
|
+
* since the manager maintains its internal state.
|
|
245
|
+
*/
|
|
246
|
+
}, {
|
|
247
|
+
key: "refreshRunning",
|
|
248
|
+
value: function () {
|
|
249
|
+
var _refreshRunning = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
250
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
251
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
252
|
+
case 0:
|
|
253
|
+
_context3.next = 2;
|
|
254
|
+
return this._pollModels.refresh();
|
|
255
|
+
case 2:
|
|
256
|
+
_context3.next = 4;
|
|
257
|
+
return this._pollModels.tick;
|
|
258
|
+
case 4:
|
|
259
|
+
case "end":
|
|
260
|
+
return _context3.stop();
|
|
261
|
+
}
|
|
262
|
+
}, _callee3, this);
|
|
263
|
+
}));
|
|
264
|
+
function refreshRunning() {
|
|
265
|
+
return _refreshRunning.apply(this, arguments);
|
|
266
|
+
}
|
|
267
|
+
return refreshRunning;
|
|
268
|
+
}()
|
|
269
|
+
/**
|
|
270
|
+
* Create a new terminal session.
|
|
271
|
+
*
|
|
272
|
+
* @param options - The options used to create the terminal.
|
|
273
|
+
*
|
|
274
|
+
* @returns A promise that resolves with the terminal connection instance.
|
|
275
|
+
*
|
|
276
|
+
* #### Notes
|
|
277
|
+
* The manager `serverSettings` will be used unless overridden in the
|
|
278
|
+
* options.
|
|
279
|
+
*/
|
|
280
|
+
}, {
|
|
281
|
+
key: "startNew",
|
|
282
|
+
value: function () {
|
|
283
|
+
var _startNew = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(options) {
|
|
284
|
+
var model;
|
|
285
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
286
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
287
|
+
case 0:
|
|
288
|
+
_context4.next = 2;
|
|
289
|
+
return this.terminalRestAPI.startNew(options, this.serverSettings);
|
|
290
|
+
case 2:
|
|
291
|
+
model = _context4.sent;
|
|
292
|
+
_context4.next = 5;
|
|
293
|
+
return this.refreshRunning();
|
|
294
|
+
case 5:
|
|
295
|
+
return _context4.abrupt("return", this.connectTo(_objectSpread(_objectSpread({}, options), {}, {
|
|
296
|
+
name: model.name
|
|
297
|
+
})));
|
|
298
|
+
case 6:
|
|
299
|
+
case "end":
|
|
300
|
+
return _context4.stop();
|
|
301
|
+
}
|
|
302
|
+
}, _callee4, this);
|
|
303
|
+
}));
|
|
304
|
+
function startNew(_x2) {
|
|
305
|
+
return _startNew.apply(this, arguments);
|
|
306
|
+
}
|
|
307
|
+
return startNew;
|
|
308
|
+
}()
|
|
309
|
+
/**
|
|
310
|
+
* Shut down a terminal session by name.
|
|
311
|
+
*/
|
|
312
|
+
}, {
|
|
313
|
+
key: "shutdown",
|
|
314
|
+
value: function () {
|
|
315
|
+
var _shutdown = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(name) {
|
|
316
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
317
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
318
|
+
case 0:
|
|
319
|
+
_context5.next = 2;
|
|
320
|
+
return this.terminalRestAPI.shutdown(name, this.serverSettings);
|
|
321
|
+
case 2:
|
|
322
|
+
_context5.next = 4;
|
|
323
|
+
return this.refreshRunning();
|
|
324
|
+
case 4:
|
|
325
|
+
case "end":
|
|
326
|
+
return _context5.stop();
|
|
327
|
+
}
|
|
328
|
+
}, _callee5, this);
|
|
329
|
+
}));
|
|
330
|
+
function shutdown(_x3) {
|
|
331
|
+
return _shutdown.apply(this, arguments);
|
|
332
|
+
}
|
|
333
|
+
return shutdown;
|
|
334
|
+
}()
|
|
335
|
+
/**
|
|
336
|
+
* Shut down all terminal sessions.
|
|
337
|
+
*
|
|
338
|
+
* @returns A promise that resolves when all of the sessions are shut down.
|
|
339
|
+
*/
|
|
340
|
+
}, {
|
|
341
|
+
key: "shutdownAll",
|
|
342
|
+
value: function () {
|
|
343
|
+
var _shutdownAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
344
|
+
var _this2 = this;
|
|
345
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
346
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
347
|
+
case 0:
|
|
348
|
+
_context6.next = 2;
|
|
349
|
+
return this.refreshRunning();
|
|
350
|
+
case 2:
|
|
351
|
+
_context6.next = 4;
|
|
352
|
+
return Promise.all(this._names.map(function (name) {
|
|
353
|
+
return _this2.terminalRestAPI.shutdown(name, _this2.serverSettings);
|
|
354
|
+
}));
|
|
355
|
+
case 4:
|
|
356
|
+
_context6.next = 6;
|
|
357
|
+
return this.refreshRunning();
|
|
358
|
+
case 6:
|
|
359
|
+
case "end":
|
|
360
|
+
return _context6.stop();
|
|
361
|
+
}
|
|
362
|
+
}, _callee6, this);
|
|
363
|
+
}));
|
|
364
|
+
function shutdownAll() {
|
|
365
|
+
return _shutdownAll.apply(this, arguments);
|
|
366
|
+
}
|
|
367
|
+
return shutdownAll;
|
|
368
|
+
}()
|
|
369
|
+
/**
|
|
370
|
+
* Execute a request to the server to poll running terminals and update state.
|
|
371
|
+
*/
|
|
372
|
+
}, {
|
|
373
|
+
key: "requestRunning",
|
|
374
|
+
value: function () {
|
|
375
|
+
var _requestRunning = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
376
|
+
var models, _response, _response2, names;
|
|
377
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
378
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
379
|
+
case 0:
|
|
380
|
+
_context7.prev = 0;
|
|
381
|
+
_context7.next = 3;
|
|
382
|
+
return this.terminalRestAPI.listRunning(this.serverSettings);
|
|
383
|
+
case 3:
|
|
384
|
+
models = _context7.sent;
|
|
385
|
+
_context7.next = 10;
|
|
386
|
+
break;
|
|
387
|
+
case 6:
|
|
388
|
+
_context7.prev = 6;
|
|
389
|
+
_context7.t0 = _context7["catch"](0);
|
|
390
|
+
// Handle network errors, as well as cases where we are on a
|
|
391
|
+
// JupyterHub and the server is not running. JupyterHub returns a
|
|
392
|
+
// 503 (<2.0) or 424 (>2.0) in that case.
|
|
393
|
+
if (_context7.t0 instanceof NetworkError || ((_response = _context7.t0.response) === null || _response === void 0 ? void 0 : _response.status) === 503 || ((_response2 = _context7.t0.response) === null || _response2 === void 0 ? void 0 : _response2.status) === 424) {
|
|
394
|
+
this._connectionFailure.fire(_context7.t0);
|
|
395
|
+
}
|
|
396
|
+
throw _context7.t0;
|
|
397
|
+
case 10:
|
|
398
|
+
if (!this.disposed) {
|
|
399
|
+
_context7.next = 12;
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
return _context7.abrupt("return");
|
|
403
|
+
case 12:
|
|
404
|
+
names = models.map(function (_ref3) {
|
|
405
|
+
var name = _ref3.name;
|
|
406
|
+
return name;
|
|
407
|
+
}).sort();
|
|
408
|
+
if (!(names === this._names)) {
|
|
409
|
+
_context7.next = 15;
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
return _context7.abrupt("return");
|
|
413
|
+
case 15:
|
|
414
|
+
this._names = names;
|
|
415
|
+
this._terminalConnections.forEach(function (tc) {
|
|
416
|
+
if (!names.includes(tc.name)) {
|
|
417
|
+
tc.dispose();
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
this._runningChanged.fire(this._models);
|
|
421
|
+
case 18:
|
|
422
|
+
case "end":
|
|
423
|
+
return _context7.stop();
|
|
424
|
+
}
|
|
425
|
+
}, _callee7, this, [[0, 6]]);
|
|
426
|
+
}));
|
|
427
|
+
function requestRunning() {
|
|
428
|
+
return _requestRunning.apply(this, arguments);
|
|
429
|
+
}
|
|
430
|
+
return requestRunning;
|
|
431
|
+
}()
|
|
432
|
+
/**
|
|
433
|
+
* Handle a session starting.
|
|
434
|
+
*/
|
|
435
|
+
}, {
|
|
436
|
+
key: "_onStarted",
|
|
437
|
+
value: function _onStarted(terminalConnection) {
|
|
438
|
+
var _this3 = this;
|
|
439
|
+
this._terminalConnections.add(terminalConnection);
|
|
440
|
+
terminalConnection.onDisposed(function () {
|
|
441
|
+
_this3._onDisposed(terminalConnection);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Handle a session terminating.
|
|
447
|
+
*/
|
|
448
|
+
}, {
|
|
449
|
+
key: "_onDisposed",
|
|
450
|
+
value: function _onDisposed(terminalConnection) {
|
|
451
|
+
this._terminalConnections.delete(terminalConnection);
|
|
452
|
+
// Update the running models to make sure we reflect the server state
|
|
453
|
+
void this.refreshRunning().catch(function () {
|
|
454
|
+
/* no-op */
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
}]);
|
|
458
|
+
return TerminalManager;
|
|
459
|
+
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "terminalRestAPI", [_dec2], {
|
|
460
|
+
configurable: true,
|
|
461
|
+
enumerable: true,
|
|
462
|
+
writable: true,
|
|
463
|
+
initializer: null
|
|
464
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "terminalConnectionFactory", [_dec3], {
|
|
465
|
+
configurable: true,
|
|
466
|
+
enumerable: true,
|
|
467
|
+
writable: true,
|
|
468
|
+
initializer: null
|
|
469
|
+
})), _class2)) || _class);
|
package/es/module.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAW/C,eAAO,MAAM,cAAc,YAiB1B,CAAC"}
|
package/es/module.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ManaModule } from '@difizen/mana-app';
|
|
2
|
+
import { TerminalConfiguration } from "./configuration.js";
|
|
3
|
+
import { TerminalConnection } from "./connection.js";
|
|
4
|
+
import { TerminalManager } from "./manager.js";
|
|
5
|
+
import { TerminalOption } from "./protocol.js";
|
|
6
|
+
import { TerminalConnectionFactory } from "./protocol.js";
|
|
7
|
+
import { TerminalRestAPI } from "./restapi.js";
|
|
8
|
+
import { TerminalThemeService } from "./theme-service.js";
|
|
9
|
+
import { LibroTerminalView } from "./view.js";
|
|
10
|
+
export var TerminalModule = ManaModule.create().register(TerminalConnection, TerminalManager, TerminalRestAPI, {
|
|
11
|
+
token: TerminalConnectionFactory,
|
|
12
|
+
useFactory: function useFactory(ctx) {
|
|
13
|
+
return function (options) {
|
|
14
|
+
var child = ctx.container.createChild();
|
|
15
|
+
child.register({
|
|
16
|
+
token: TerminalOption,
|
|
17
|
+
useValue: options
|
|
18
|
+
});
|
|
19
|
+
return child.get(TerminalConnection);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}, TerminalConfiguration, TerminalThemeService, LibroTerminalView);
|
package/es/protocol.d.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { JSONPrimitive } from '@difizen/libro-common';
|
|
2
|
+
import type { TerminalConnection } from './connection.js';
|
|
3
|
+
/**
|
|
4
|
+
* The server model for a terminal session.
|
|
5
|
+
*/
|
|
6
|
+
export interface TerminalModel {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the terminal session.
|
|
9
|
+
*/
|
|
10
|
+
readonly name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TerminalOption {
|
|
13
|
+
name?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Current working directory.
|
|
16
|
+
*/
|
|
17
|
+
cwd?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const TerminalOption: unique symbol;
|
|
20
|
+
export declare const TerminalConnectionFactory: unique symbol;
|
|
21
|
+
export type TerminalConnectionFactory = (options: TerminalOption) => TerminalConnection;
|
|
22
|
+
/**
|
|
23
|
+
* A message from the terminal session.
|
|
24
|
+
*/
|
|
25
|
+
export interface TerminalMessage {
|
|
26
|
+
/**
|
|
27
|
+
* The type of the message.
|
|
28
|
+
*/
|
|
29
|
+
readonly type: TerminalMessageType;
|
|
30
|
+
/**
|
|
31
|
+
* The content of the message.
|
|
32
|
+
*/
|
|
33
|
+
readonly content?: JSONPrimitive[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Valid message types for the terminal.
|
|
37
|
+
*/
|
|
38
|
+
export type TerminalMessageType = 'stdout' | 'disconnect' | 'set_size' | 'stdin';
|
|
39
|
+
export type TerminalConnectionStatus = 'connected' | 'connecting' | 'disconnected';
|
|
40
|
+
export interface TerminalViewOption extends TerminalOption {
|
|
41
|
+
name: string;
|
|
42
|
+
/**
|
|
43
|
+
* Human readable terminal representation on the UI.
|
|
44
|
+
*/
|
|
45
|
+
readonly title?: string;
|
|
46
|
+
initialCommand?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Path to the executable shell. For example: `/bin/bash`, `bash`, `sh`.
|
|
49
|
+
*/
|
|
50
|
+
readonly shellPath?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Shell arguments to executable shell, for example: [`-l`] - without login.
|
|
53
|
+
*/
|
|
54
|
+
readonly shellArgs?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Environment variables for terminal.
|
|
57
|
+
*/
|
|
58
|
+
readonly env?: {
|
|
59
|
+
[key: string]: string | null;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* In case `destroyTermOnClose` is true - terminal process will be destroyed on close terminal widget, otherwise will be kept
|
|
63
|
+
* alive.
|
|
64
|
+
*/
|
|
65
|
+
readonly destroyOnClose?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Terminal server side can send to the client `terminal title` to display this value on the UI. If
|
|
68
|
+
* useServerTitle = true then display this title, otherwise display title defined by 'title' argument.
|
|
69
|
+
*/
|
|
70
|
+
readonly useServerTitle?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether it is a pseudo terminal where an extension controls its input and output.
|
|
73
|
+
*/
|
|
74
|
+
readonly isPseudoTerminal?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Terminal attributes. Can be useful to apply some implementation specific information.
|
|
77
|
+
*/
|
|
78
|
+
readonly attributes?: {
|
|
79
|
+
[key: string]: string | null;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Terminal kind that indicates whether a terminal is created by a user or by some extension for a user
|
|
83
|
+
*/
|
|
84
|
+
readonly kind?: 'user' | string;
|
|
85
|
+
}
|
|
86
|
+
export declare const TerminalViewOption: unique symbol;
|
|
87
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD,eAAO,MAAM,yBAAyB,eAAsC,CAAC;AAC7E,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,cAAc,KAAK,kBAAkB,CAAC;AAExF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAEnC;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;AAEjF,MAAM,MAAM,wBAAwB,GAAG,WAAW,GAAG,YAAY,GAAG,cAAc,CAAC;AAEnF,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IAE9B;;OAEG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAEhD;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAEvD;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACjC;AAED,eAAO,MAAM,kBAAkB,eAA+B,CAAC"}
|
package/es/protocol.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The server model for a terminal session.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export var TerminalOption = Symbol('TerminalOption');
|
|
6
|
+
export var TerminalConnectionFactory = Symbol('TerminalConnectionFactory');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A message from the terminal session.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Valid message types for the terminal.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export var TerminalViewOption = Symbol('TerminalViewOption');
|
package/es/restapi.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ISettings } from '@difizen/libro-kernel';
|
|
2
|
+
import { ServerConnection } from '@difizen/libro-kernel';
|
|
3
|
+
import type { TerminalModel, TerminalOption } from './protocol.js';
|
|
4
|
+
export declare const TERMINAL_SERVICE_URL = "api/terminals";
|
|
5
|
+
export declare class TerminalRestAPI {
|
|
6
|
+
serverConnection: ServerConnection;
|
|
7
|
+
startNew(options: TerminalOption, serverSettings?: Partial<ISettings>): Promise<TerminalModel>;
|
|
8
|
+
listRunning(serverSettings?: Partial<ISettings>): Promise<TerminalModel[]>;
|
|
9
|
+
shutdown(name: string, serverSettings?: Partial<ISettings>): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=restapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restapi.d.ts","sourceRoot":"","sources":["../src/restapi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEnE,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD,qBACa,eAAe;IACA,gBAAgB,EAAE,gBAAgB,CAAC;IAEvD,QAAQ,CACZ,OAAO,EAAE,cAAc,EACvB,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAClC,OAAO,CAAC,aAAa,CAAC;IAiBnB,WAAW,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAgB1E,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAwBjF"}
|