@difizen/libro-kernel 0.1.21 → 0.2.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/kernelspec/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/kernelspec/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,IAAI,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,KAAK,KAAK,UAAU,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD;;GAEG;AACH,qBACa,iBAAkB,SAAQ,WAAY,YAAW,UAAU,CAAC,QAAQ;IAE/E,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IAEvC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAE/C;;;;OAIG;;IAwBH;;OAEG;IAGH;;OAEG;IAKH;;OAEG;IAKH,IAAI,UAAU,yBAEb;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,WAAW,GAAG,IAAI,CAE9B;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,SAAS,CAAC,WAAW,CAAC,CAEzC;IAED;;OAEG;IACH,IAAa,iBAAiB,IAAI,SAAS,CAAC,KAAK,CAAC,CAEjD;IAED;;OAEG;IACM,OAAO,IAAI,IAAI;IAKxB;;;;;;;;OAQG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC;;OAEG;cACa,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB7C,UAAmB,wBAAwB,iBAAwB;IAEnE,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC;IAI3B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAQ;IAC5C,SAAS,CAAC,mBAAmB,uBAA8B;IAC3D,SAAS,CAAC,aAAa,wBAA+B;CACvD;AAED;;GAEG;AACH,yBAAiB,iBAAiB,CAAC;IACjC;;OAEG;IACH,UAAiB,QAAS,SAAQ,WAAW,CAAC,QAAQ;QACpD;;WAEG;QACH,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;KACzD;CACF"}
|
package/es/kernelspec/manager.js
CHANGED
|
@@ -21,6 +21,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
21
21
|
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; }
|
|
22
22
|
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.'); }
|
|
23
23
|
import { deepEqual, Poll } from '@difizen/libro-common';
|
|
24
|
+
import { getOrigin } from '@difizen/mana-app';
|
|
24
25
|
import { Emitter, Deferred } from '@difizen/mana-app';
|
|
25
26
|
import { inject, singleton } from '@difizen/mana-app';
|
|
26
27
|
import { prop } from '@difizen/mana-app';
|
|
@@ -43,8 +44,6 @@ export var KernelSpecManager = (_dec = singleton(), _dec2 = inject(ServerManager
|
|
|
43
44
|
var _this;
|
|
44
45
|
_classCallCheck(this, KernelSpecManager);
|
|
45
46
|
_this = _super.call(this);
|
|
46
|
-
|
|
47
|
-
// Initialize internal data.
|
|
48
47
|
_initializerDefineProperty(_this, "serverManager", _descriptor, _assertThisInitialized(_this));
|
|
49
48
|
_initializerDefineProperty(_this, "kernelSpecRestAPI", _descriptor2, _assertThisInitialized(_this));
|
|
50
49
|
// protected _isReady = false;
|
|
@@ -53,21 +52,6 @@ export var KernelSpecManager = (_dec = singleton(), _dec2 = inject(ServerManager
|
|
|
53
52
|
_initializerDefineProperty(_this, "_specs", _descriptor3, _assertThisInitialized(_this));
|
|
54
53
|
_this.specsChangedEmitter = new Emitter();
|
|
55
54
|
_this.specsDeferred = new Deferred();
|
|
56
|
-
_this._ready = Promise.all([_this.requestSpecs()])
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
|
-
.then(function (_) {
|
|
59
|
-
return undefined;
|
|
60
|
-
})
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
62
|
-
.catch(function (_) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}).then(function () {
|
|
65
|
-
if (_this.isDisposed) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
_this._isReady = true;
|
|
69
|
-
return;
|
|
70
|
-
});
|
|
71
55
|
_this._pollSpecs = new Poll({
|
|
72
56
|
auto: false,
|
|
73
57
|
factory: function factory() {
|
|
@@ -82,10 +66,27 @@ export var KernelSpecManager = (_dec = singleton(), _dec2 = inject(ServerManager
|
|
|
82
66
|
standby: 'when-hidden'
|
|
83
67
|
// standby: options.standby ?? 'when-hidden',
|
|
84
68
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return
|
|
88
|
-
|
|
69
|
+
// Initialize internal data.
|
|
70
|
+
_this._ready = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
71
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72
|
+
while (1) switch (_context.prev = _context.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
_context.next = 2;
|
|
75
|
+
return _this.serverManager.ready;
|
|
76
|
+
case 2:
|
|
77
|
+
_context.next = 4;
|
|
78
|
+
return getOrigin(_this._pollSpecs).start();
|
|
79
|
+
case 4:
|
|
80
|
+
_context.next = 6;
|
|
81
|
+
return getOrigin(_this._pollSpecs).tick;
|
|
82
|
+
case 6:
|
|
83
|
+
_this._isReady = true;
|
|
84
|
+
case 7:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee);
|
|
89
|
+
}))();
|
|
89
90
|
return _this;
|
|
90
91
|
}
|
|
91
92
|
|
|
@@ -162,20 +163,20 @@ export var KernelSpecManager = (_dec = singleton(), _dec2 = inject(ServerManager
|
|
|
162
163
|
}, {
|
|
163
164
|
key: "refreshSpecs",
|
|
164
165
|
value: (function () {
|
|
165
|
-
var _refreshSpecs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
166
|
-
return _regeneratorRuntime().wrap(function
|
|
167
|
-
while (1) switch (
|
|
166
|
+
var _refreshSpecs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
167
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
168
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
168
169
|
case 0:
|
|
169
|
-
|
|
170
|
+
_context2.next = 2;
|
|
170
171
|
return this._pollSpecs.refresh();
|
|
171
172
|
case 2:
|
|
172
|
-
|
|
173
|
+
_context2.next = 4;
|
|
173
174
|
return this._pollSpecs.tick;
|
|
174
175
|
case 4:
|
|
175
176
|
case "end":
|
|
176
|
-
return
|
|
177
|
+
return _context2.stop();
|
|
177
178
|
}
|
|
178
|
-
},
|
|
179
|
+
}, _callee2, this);
|
|
179
180
|
}));
|
|
180
181
|
function refreshSpecs() {
|
|
181
182
|
return _refreshSpecs.apply(this, arguments);
|
|
@@ -189,23 +190,23 @@ export var KernelSpecManager = (_dec = singleton(), _dec2 = inject(ServerManager
|
|
|
189
190
|
}, {
|
|
190
191
|
key: "requestSpecs",
|
|
191
192
|
value: (function () {
|
|
192
|
-
var _requestSpecs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
193
|
+
var _requestSpecs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
193
194
|
var specs;
|
|
194
|
-
return _regeneratorRuntime().wrap(function
|
|
195
|
-
while (1) switch (
|
|
195
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
196
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
196
197
|
case 0:
|
|
197
|
-
|
|
198
|
+
_context3.next = 2;
|
|
198
199
|
return this.kernelSpecRestAPI.getSpecs(this.serverSettings);
|
|
199
200
|
case 2:
|
|
200
|
-
specs =
|
|
201
|
+
specs = _context3.sent;
|
|
201
202
|
if (specs) {
|
|
202
203
|
this.specsDeferred.resolve(specs);
|
|
203
204
|
}
|
|
204
205
|
if (!this.isDisposed) {
|
|
205
|
-
|
|
206
|
+
_context3.next = 6;
|
|
206
207
|
break;
|
|
207
208
|
}
|
|
208
|
-
return
|
|
209
|
+
return _context3.abrupt("return");
|
|
209
210
|
case 6:
|
|
210
211
|
if (!this._specs || !deepEqual(specs, this._specs)) {
|
|
211
212
|
this._specs = specs;
|
|
@@ -213,9 +214,9 @@ export var KernelSpecManager = (_dec = singleton(), _dec2 = inject(ServerManager
|
|
|
213
214
|
}
|
|
214
215
|
case 7:
|
|
215
216
|
case "end":
|
|
216
|
-
return
|
|
217
|
+
return _context3.stop();
|
|
217
218
|
}
|
|
218
|
-
},
|
|
219
|
+
}, _callee3, this);
|
|
219
220
|
}));
|
|
220
221
|
function requestSpecs() {
|
|
221
222
|
return _requestSpecs.apply(this, arguments);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@difizen/libro-kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.
|
|
36
|
-
"@difizen/libro-core": "^0.
|
|
35
|
+
"@difizen/libro-common": "^0.2.0",
|
|
36
|
+
"@difizen/libro-core": "^0.2.0",
|
|
37
37
|
"@difizen/mana-app": "latest",
|
|
38
38
|
"minimist": "^1.2.8",
|
|
39
39
|
"query-string": "^8.1.0",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { deepEqual, Poll } from '@difizen/libro-common';
|
|
2
2
|
import type { Event as ManaEvent } from '@difizen/mana-app';
|
|
3
|
+
import { getOrigin } from '@difizen/mana-app';
|
|
3
4
|
import { Emitter, Deferred } from '@difizen/mana-app';
|
|
4
5
|
import { inject, singleton } from '@difizen/mana-app';
|
|
5
6
|
import { prop } from '@difizen/mana-app';
|
|
@@ -28,21 +29,6 @@ export class KernelSpecManager extends BaseManager implements KernelSpec.IManage
|
|
|
28
29
|
*/
|
|
29
30
|
constructor() {
|
|
30
31
|
super();
|
|
31
|
-
|
|
32
|
-
// Initialize internal data.
|
|
33
|
-
this._ready = Promise.all([this.requestSpecs()])
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
35
|
-
.then((_) => undefined)
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
37
|
-
.catch((_) => undefined)
|
|
38
|
-
.then(() => {
|
|
39
|
-
if (this.isDisposed) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
this._isReady = true;
|
|
43
|
-
return;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
32
|
this._pollSpecs = new Poll({
|
|
47
33
|
auto: false,
|
|
48
34
|
factory: () => this.requestSpecs(),
|
|
@@ -55,10 +41,13 @@ export class KernelSpecManager extends BaseManager implements KernelSpec.IManage
|
|
|
55
41
|
standby: 'when-hidden',
|
|
56
42
|
// standby: options.standby ?? 'when-hidden',
|
|
57
43
|
});
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
// Initialize internal data.
|
|
45
|
+
this._ready = (async () => {
|
|
46
|
+
await this.serverManager.ready;
|
|
47
|
+
await getOrigin(this._pollSpecs).start();
|
|
48
|
+
await getOrigin(this._pollSpecs).tick;
|
|
49
|
+
this._isReady = true;
|
|
50
|
+
})();
|
|
62
51
|
}
|
|
63
52
|
|
|
64
53
|
/**
|