@difizen/libro-kernel 0.1.10 → 0.1.11

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.
@@ -17,8 +17,8 @@ function _initializerDefineProperty(target, property, descriptor, context) { if
17
17
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
18
  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); } }
19
19
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
- 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); }
20
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
21
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
22
22
  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; }
23
23
  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.'); }
24
24
  import { Poll } from '@difizen/libro-common';
@@ -100,7 +100,7 @@ export var LibroSessionManager = (_dec = singleton(), _dec2 = inject(SessionRest
100
100
  LibroSessionManager = inject(LibroKernelManager)(LibroSessionManager, undefined, 0) || LibroSessionManager;
101
101
  _createClass(LibroSessionManager, [{
102
102
  key: "requestRunning",
103
- value: function () {
103
+ value: (function () {
104
104
  var _requestRunning = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
105
105
  var _this2 = this;
106
106
  var models, _err$response, _err$response2, _iterator, _step, _loop;
@@ -189,7 +189,7 @@ export var LibroSessionManager = (_dec = singleton(), _dec2 = inject(SessionRest
189
189
  return _requestRunning.apply(this, arguments);
190
190
  }
191
191
  return requestRunning;
192
- }()
192
+ }())
193
193
  }, {
194
194
  key: "connectionFailure",
195
195
  get:
@@ -250,7 +250,6 @@ export var LibroSessionManager = (_dec = singleton(), _dec2 = inject(SessionRest
250
250
  kernel: {
251
251
  kernelName: reuseKernelInfo ? reuseKernelInfo.name : ((_fileInfo$content$met = fileInfo.content.metadata.kernelspec) === null || _fileInfo$content$met === void 0 ? void 0 : _fileInfo$content$met.name) || firstKernelSpecName // 使用ipynb文件原本的kernel name,或者使用kernel spec轮询得到的第一个kernel name
252
252
  },
253
-
254
253
  path: fileInfo.path,
255
254
  type: fileInfo.type
256
255
  }, this.serverSettings);
@@ -379,7 +378,7 @@ export var LibroSessionManager = (_dec = singleton(), _dec2 = inject(SessionRest
379
378
  */
380
379
  }, {
381
380
  key: "refreshRunning",
382
- value: function () {
381
+ value: (function () {
383
382
  var _refreshRunning = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
384
383
  return _regeneratorRuntime().wrap(function _callee6$(_context7) {
385
384
  while (1) switch (_context7.prev = _context7.next) {
@@ -403,9 +402,10 @@ export var LibroSessionManager = (_dec = singleton(), _dec2 = inject(SessionRest
403
402
  /**
404
403
  * Send a PATCH to the server, updating the session path or the kernel.
405
404
  */
405
+ )
406
406
  }, {
407
407
  key: "_patch",
408
- value: function () {
408
+ value: (function () {
409
409
  var _patch2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(body, sessionId) {
410
410
  var model;
411
411
  return _regeneratorRuntime().wrap(function _callee7$(_context8) {
@@ -438,9 +438,10 @@ export var LibroSessionManager = (_dec = singleton(), _dec2 = inject(SessionRest
438
438
  * This shuts down the existing kernel and creates a new kernel,
439
439
  * keeping the existing session ID and session path.
440
440
  */
441
+ )
441
442
  }, {
442
443
  key: "changeKernel",
443
- value: function () {
444
+ value: (function () {
444
445
  var _changeKernel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(fileInfo, options) {
445
446
  var reuseSessionId, newSession, model, optionsForConnectKernel, kernelConnection;
446
447
  return _regeneratorRuntime().wrap(function _callee8$(_context9) {
@@ -516,7 +517,7 @@ export var LibroSessionManager = (_dec = singleton(), _dec2 = inject(SessionRest
516
517
  return _changeKernel.apply(this, arguments);
517
518
  }
518
519
  return changeKernel;
519
- }()
520
+ }())
520
521
  }]);
521
522
  return LibroSessionManager;
522
523
  }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "sessionRestAPI", [_dec2], {
@@ -2,8 +2,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
2
2
  var _dec, _class;
3
3
  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); } }
4
4
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- 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); }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
8
  import { transient, inject } from '@difizen/mana-app';
9
9
  import { SessionMetaOption } from "./libro-session-protocol.js";
@@ -10,8 +10,8 @@ function _initializerDefineProperty(target, property, descriptor, context) { if
10
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
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
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); }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
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
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
17
  // import { default as axios } from 'axios';
@@ -107,7 +107,7 @@ export var SessionRestAPI = (_dec = singleton(), _dec2 = inject(ServerConnection
107
107
  */
108
108
  }, {
109
109
  key: "listRunning",
110
- value: function () {
110
+ value: (function () {
111
111
  var _listRunning = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(serverSettings) {
112
112
  var settings, url, response, err, data;
113
113
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -158,9 +158,10 @@ export var SessionRestAPI = (_dec = singleton(), _dec2 = inject(ServerConnection
158
158
  /**
159
159
  * Send a PATCH to the server, updating the session path or the kernel.
160
160
  */
161
+ )
161
162
  }, {
162
163
  key: "updateSession",
163
- value: function () {
164
+ value: (function () {
164
165
  var _updateSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(model, serverSettings) {
165
166
  var settings, url, init, response, err, data;
166
167
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
@@ -203,7 +204,7 @@ export var SessionRestAPI = (_dec = singleton(), _dec2 = inject(ServerConnection
203
204
  return _updateSession.apply(this, arguments);
204
205
  }
205
206
  return updateSession;
206
- }()
207
+ }())
207
208
  }]);
208
209
  return SessionRestAPI;
209
210
  }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "serverConnection", [_dec2], {
@@ -2,7 +2,8 @@ import { validateModel as validateKernelModel } from "../kernel/validate.js";
2
2
  import { validateProperty } from "../validate-property.js";
3
3
  /**
4
4
  * Validate an `Session.IModel` object.
5
- */ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
5
+ */
6
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
6
7
  export function validateModel(data) {
7
8
  validateProperty(data, 'id', 'string');
8
9
  validateProperty(data, 'type', 'string');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-kernel",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "ai-infra",
@@ -32,8 +32,8 @@
32
32
  "src"
33
33
  ],
34
34
  "dependencies": {
35
- "@difizen/libro-common": "^0.1.10",
36
- "@difizen/libro-core": "^0.1.10",
35
+ "@difizen/libro-common": "^0.1.11",
36
+ "@difizen/libro-core": "^0.1.11",
37
37
  "@difizen/mana-app": "latest",
38
38
  "minimist": "^1.2.8",
39
39
  "query-string": "^8.1.0",