@difizen/libro-sql-cell 0.2.40-next.0 → 0.2.40
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/es/libro-formatter-sql-magic-contribution.d.ts +3 -0
- package/es/libro-formatter-sql-magic-contribution.d.ts.map +1 -1
- package/es/libro-formatter-sql-magic-contribution.js +5 -3
- package/es/libro-sql-cell-model.d.ts +1 -0
- package/es/libro-sql-cell-model.d.ts.map +1 -1
- package/es/libro-sql-cell-model.js +27 -19
- package/es/libro-sql-cell-protocol.d.ts +1 -0
- package/es/libro-sql-cell-protocol.d.ts.map +1 -1
- package/es/libro-sql-cell-script.d.ts.map +1 -1
- package/es/libro-sql-cell-script.js +1 -1
- package/es/libro-sql-cell-view.d.ts +2 -1
- package/es/libro-sql-cell-view.d.ts.map +1 -1
- package/es/libro-sql-cell-view.js +106 -62
- package/package.json +1 -1
- package/src/libro-formatter-sql-magic-contribution.ts +11 -21
|
@@ -2,6 +2,7 @@ import { FormatterContribution } from '@difizen/libro-jupyter';
|
|
|
2
2
|
import type { DefaultEncodedFormatter, DefaultDecodedFormatter } from '@difizen/libro-jupyter';
|
|
3
3
|
export interface SqlDecodedFormatter extends DefaultDecodedFormatter {
|
|
4
4
|
result_variable?: string;
|
|
5
|
+
db_id?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare class FormatterSqlMagicContribution implements FormatterContribution<SqlDecodedFormatter> {
|
|
7
8
|
formatter: string;
|
|
@@ -16,9 +17,11 @@ export declare class FormatterSqlMagicContribution implements FormatterContribut
|
|
|
16
17
|
decode: (formatterValue: DefaultEncodedFormatter) => {
|
|
17
18
|
result_variable: string;
|
|
18
19
|
value: string;
|
|
20
|
+
db_id: string;
|
|
19
21
|
} | {
|
|
20
22
|
value: string;
|
|
21
23
|
result_variable?: undefined;
|
|
24
|
+
db_id?: undefined;
|
|
22
25
|
};
|
|
23
26
|
validate: (source: SqlDecodedFormatter) => source is SqlDecodedFormatter;
|
|
24
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-formatter-sql-magic-contribution.d.ts","sourceRoot":"","sources":["../src/libro-formatter-sql-magic-contribution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAClE,eAAe,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-formatter-sql-magic-contribution.d.ts","sourceRoot":"","sources":["../src/libro-formatter-sql-magic-contribution.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,mBAAoB,SAAQ,uBAAuB;IAClE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBACa,6BACX,YAAW,qBAAqB,CAAC,mBAAmB,CAAC;IAErD,SAAS,SAAyB;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,SAAS,mBAAoB,MAAM,aAEjC;IACF,MAAM,WAAY,mBAAmB;;;;;MAQnC;IACF,MAAM,mBAAoB,uBAAuB;;;;;;;;MAiB/C;IAEF,QAAQ,WAAY,mBAAmB,mCAErC;CACH"}
|
|
@@ -20,7 +20,7 @@ export var FormatterSqlMagicContribution = (_dec = singleton({
|
|
|
20
20
|
return libroFormatter === _this.formatter ? 100 : 1;
|
|
21
21
|
};
|
|
22
22
|
this.encode = function (source) {
|
|
23
|
-
var sqlEncodedValue = "%%sql \n{\"result_variable\":\"".concat(source.result_variable, "\", \"sql_script\":\"").concat(source.value, "\"}");
|
|
23
|
+
var sqlEncodedValue = "%%sql \n{\"result_variable\":\"".concat(source.result_variable, "\", \"db_id\":\"").concat(source.db_id, "\",\"sql_script\":\"").concat(source.value, "\"}");
|
|
24
24
|
return {
|
|
25
25
|
source: sqlEncodedValue,
|
|
26
26
|
metadata: {
|
|
@@ -34,10 +34,12 @@ export var FormatterSqlMagicContribution = (_dec = singleton({
|
|
|
34
34
|
var run = value.split('%%sql \n')[1];
|
|
35
35
|
var runValue = JSON.parse(run);
|
|
36
36
|
var result_variable = runValue.result_variable;
|
|
37
|
+
var db_id = runValue.db_id;
|
|
37
38
|
var codeValue = runValue.sql_script;
|
|
38
39
|
return {
|
|
39
40
|
result_variable: result_variable,
|
|
40
|
-
value: codeValue
|
|
41
|
+
value: codeValue,
|
|
42
|
+
db_id: db_id
|
|
41
43
|
};
|
|
42
44
|
}
|
|
43
45
|
return {
|
|
@@ -45,6 +47,6 @@ export var FormatterSqlMagicContribution = (_dec = singleton({
|
|
|
45
47
|
};
|
|
46
48
|
};
|
|
47
49
|
this.validate = function (source) {
|
|
48
|
-
return 'result_variable' in source && 'sql_script' in source;
|
|
50
|
+
return 'result_variable' in source && 'sql_script' in source && 'db_id' in source;
|
|
49
51
|
};
|
|
50
52
|
})) || _class);
|
|
@@ -10,6 +10,7 @@ export interface SqlCellMetadata extends ICodeCellMetadata {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class LibroSqlCellModel extends LibroCellModel implements ExecutableCellModel {
|
|
12
12
|
resultVariable: string | undefined;
|
|
13
|
+
dbId: string | undefined;
|
|
13
14
|
executeCount: ExecutionCount;
|
|
14
15
|
executing: boolean;
|
|
15
16
|
hasOutputHidden: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-sql-cell-model.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAA2B,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,cAAc,EAAE,MAAM,CAAC;CACxB;AACD,qBACa,iBAAkB,SAAQ,cAAe,YAAW,mBAAmB;IAElF,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC,YAAY,EAAE,cAAc,CAAC;IAE7B,SAAS,EAAE,OAAO,CAAC;IAEnB,eAAe,EAAE,OAAO,CAAC;IAEzB,kBAAkB,EAAE,OAAO,CAAC;IAG5B,eAAe,UAAS;IAGxB,kBAAkB,UAAS;IAE3B,gBAAgB,UAAS;IAEhB,QAAQ,EAAE,OAAO,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC;IAEpD,aAAa,EAAE,mBAAmB,CAAC;IAG3C,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAE/B,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,CAE9B;IAED,WAAW,EAAE,WAAW,CAAC;gBAGF,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,WAAW;IAiBtC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;IAY7C,IAAa,YAAY,CAAC,IAAI,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"libro-sql-cell-model.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,KAAK,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAA2B,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAElF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,cAAc,EAAE,MAAM,CAAC;CACxB;AACD,qBACa,iBAAkB,SAAQ,cAAe,YAAW,mBAAmB;IAElF,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzB,YAAY,EAAE,cAAc,CAAC;IAE7B,SAAS,EAAE,OAAO,CAAC;IAEnB,eAAe,EAAE,OAAO,CAAC;IAEzB,kBAAkB,EAAE,OAAO,CAAC;IAG5B,eAAe,UAAS;IAGxB,kBAAkB,UAAS;IAE3B,gBAAgB,UAAS;IAEhB,QAAQ,EAAE,OAAO,CAAC,eAAe,GAAG,aAAa,CAAC,CAAC;IAEpD,aAAa,EAAE,mBAAmB,CAAC;IAG3C,gBAAgB,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAE/B,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,CAE9B;IAED,WAAW,EAAE,WAAW,CAAC;gBAGF,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,WAAW;IAiBtC,MAAM,IAAI,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC;IAY7C,IAAa,YAAY,CAAC,IAAI,EAAE,mBAAmB,EAKlD;IAED,IAAa,YAAY,IAPO,mBAAmB,CAclD;IAED,cAAc,aAKZ;IAEO,OAAO;IAKhB,SAAS;CAGV"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9;
|
|
2
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10;
|
|
3
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
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
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; }
|
|
@@ -22,7 +22,7 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con
|
|
|
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 { CellOptions, LibroCellModel } from '@difizen/libro-jupyter';
|
|
24
24
|
import { Emitter, inject, prop, transient, ViewManager } from '@difizen/mana-app';
|
|
25
|
-
export var LibroSqlCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec9 = prop(), _dec10 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_LibroCellModel) {
|
|
25
|
+
export var LibroSqlCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop(), _dec4 = prop(), _dec5 = prop(), _dec6 = prop(), _dec7 = prop(), _dec8 = prop(), _dec9 = prop(), _dec10 = prop(), _dec11 = prop(), _dec(_class = (_class2 = /*#__PURE__*/function (_LibroCellModel) {
|
|
26
26
|
_inherits(LibroSqlCellModel, _LibroCellModel);
|
|
27
27
|
var _super = _createSuper(LibroSqlCellModel);
|
|
28
28
|
function LibroSqlCellModel(options, viewManager) {
|
|
@@ -31,14 +31,15 @@ export var LibroSqlCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop
|
|
|
31
31
|
_classCallCheck(this, LibroSqlCellModel);
|
|
32
32
|
_this = _super.call(this, options);
|
|
33
33
|
_initializerDefineProperty(_this, "resultVariable", _descriptor, _assertThisInitialized(_this));
|
|
34
|
-
_initializerDefineProperty(_this, "
|
|
35
|
-
_initializerDefineProperty(_this, "
|
|
36
|
-
_initializerDefineProperty(_this, "
|
|
37
|
-
_initializerDefineProperty(_this, "
|
|
38
|
-
_initializerDefineProperty(_this, "
|
|
39
|
-
_initializerDefineProperty(_this, "
|
|
40
|
-
_initializerDefineProperty(_this, "
|
|
41
|
-
_initializerDefineProperty(_this, "
|
|
34
|
+
_initializerDefineProperty(_this, "dbId", _descriptor2, _assertThisInitialized(_this));
|
|
35
|
+
_initializerDefineProperty(_this, "executeCount", _descriptor3, _assertThisInitialized(_this));
|
|
36
|
+
_initializerDefineProperty(_this, "executing", _descriptor4, _assertThisInitialized(_this));
|
|
37
|
+
_initializerDefineProperty(_this, "hasOutputHidden", _descriptor5, _assertThisInitialized(_this));
|
|
38
|
+
_initializerDefineProperty(_this, "hasOutputsScrolled", _descriptor6, _assertThisInitialized(_this));
|
|
39
|
+
_initializerDefineProperty(_this, "kernelExecuting", _descriptor7, _assertThisInitialized(_this));
|
|
40
|
+
_initializerDefineProperty(_this, "hasExecutedSuccess", _descriptor8, _assertThisInitialized(_this));
|
|
41
|
+
_initializerDefineProperty(_this, "hasExecutedError", _descriptor9, _assertThisInitialized(_this));
|
|
42
|
+
_initializerDefineProperty(_this, "metadata", _descriptor10, _assertThisInitialized(_this));
|
|
42
43
|
// Emitter Msg
|
|
43
44
|
_this.msgChangeEmitter = void 0;
|
|
44
45
|
_this.viewManager = void 0;
|
|
@@ -86,12 +87,14 @@ export var LibroSqlCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop
|
|
|
86
87
|
get: function get() {
|
|
87
88
|
return _objectSpread(_objectSpread({}, this._decodeObject), {}, {
|
|
88
89
|
value: this.value,
|
|
89
|
-
result_variable: this.resultVariable || this._decodeObject.result_variable
|
|
90
|
+
result_variable: this.resultVariable || this._decodeObject.result_variable,
|
|
91
|
+
db_id: this.dbId || this._decodeObject.db_id
|
|
90
92
|
});
|
|
91
93
|
},
|
|
92
94
|
set: function set(data) {
|
|
93
95
|
this.value = data.value;
|
|
94
96
|
this.resultVariable = data.result_variable;
|
|
97
|
+
this.dbId = data.db_id;
|
|
95
98
|
this._decodeObject = data;
|
|
96
99
|
}
|
|
97
100
|
}, {
|
|
@@ -112,48 +115,53 @@ export var LibroSqlCellModel = (_dec = transient(), _dec2 = prop(), _dec3 = prop
|
|
|
112
115
|
enumerable: true,
|
|
113
116
|
writable: true,
|
|
114
117
|
initializer: null
|
|
115
|
-
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
118
|
+
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "dbId", [_dec3], {
|
|
116
119
|
configurable: true,
|
|
117
120
|
enumerable: true,
|
|
118
121
|
writable: true,
|
|
119
122
|
initializer: null
|
|
120
|
-
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
123
|
+
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "executeCount", [_dec4], {
|
|
121
124
|
configurable: true,
|
|
122
125
|
enumerable: true,
|
|
123
126
|
writable: true,
|
|
124
127
|
initializer: null
|
|
125
|
-
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
128
|
+
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "executing", [_dec5], {
|
|
126
129
|
configurable: true,
|
|
127
130
|
enumerable: true,
|
|
128
131
|
writable: true,
|
|
129
132
|
initializer: null
|
|
130
|
-
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
133
|
+
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "hasOutputHidden", [_dec6], {
|
|
131
134
|
configurable: true,
|
|
132
135
|
enumerable: true,
|
|
133
136
|
writable: true,
|
|
134
137
|
initializer: null
|
|
135
|
-
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "
|
|
138
|
+
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "hasOutputsScrolled", [_dec7], {
|
|
139
|
+
configurable: true,
|
|
140
|
+
enumerable: true,
|
|
141
|
+
writable: true,
|
|
142
|
+
initializer: null
|
|
143
|
+
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "kernelExecuting", [_dec8], {
|
|
136
144
|
configurable: true,
|
|
137
145
|
enumerable: true,
|
|
138
146
|
writable: true,
|
|
139
147
|
initializer: function initializer() {
|
|
140
148
|
return false;
|
|
141
149
|
}
|
|
142
|
-
}),
|
|
150
|
+
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "hasExecutedSuccess", [_dec9], {
|
|
143
151
|
configurable: true,
|
|
144
152
|
enumerable: true,
|
|
145
153
|
writable: true,
|
|
146
154
|
initializer: function initializer() {
|
|
147
155
|
return false;
|
|
148
156
|
}
|
|
149
|
-
}),
|
|
157
|
+
}), _descriptor9 = _applyDecoratedDescriptor(_class2.prototype, "hasExecutedError", [_dec10], {
|
|
150
158
|
configurable: true,
|
|
151
159
|
enumerable: true,
|
|
152
160
|
writable: true,
|
|
153
161
|
initializer: function initializer() {
|
|
154
162
|
return false;
|
|
155
163
|
}
|
|
156
|
-
}),
|
|
164
|
+
}), _descriptor10 = _applyDecoratedDescriptor(_class2.prototype, "metadata", [_dec11], {
|
|
157
165
|
configurable: true,
|
|
158
166
|
enumerable: true,
|
|
159
167
|
writable: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-sql-cell-protocol.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,iBAAiB,CAAC;AACnF,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,eAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
1
|
+
{"version":3,"file":"libro-sql-cell-protocol.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,iBAAiB,CAAC;AACnF,eAAO,MAAM,wBAAwB,eAAqC,CAAC;AAE3E,MAAM,WAAW,WAAW;IAC1B,eAAe,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAChE;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-sql-cell-script.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-script.ts"],"names":[],"mappings":"AAEA,qBACa,SAAS;IACpB,SAAgB,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"libro-sql-cell-script.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-script.ts"],"names":[],"mappings":"AAEA,qBACa,SAAS;IACpB,SAAgB,WAAW,EAAE,MAAM,CAAmF;CACvH"}
|
|
@@ -8,5 +8,5 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
8
8
|
import { singleton } from '@difizen/mana-app';
|
|
9
9
|
export var SqlScript = (_dec = singleton(), _dec(_class = /*#__PURE__*/_createClass(function SqlScript() {
|
|
10
10
|
_classCallCheck(this, SqlScript);
|
|
11
|
-
this.getDbConfig = "from libro_sql.database import db\
|
|
11
|
+
this.getDbConfig = "from libro_sql.database import db\nimport json\njson.dumps(db.to_dbs_array())";
|
|
12
12
|
})) || _class);
|
|
@@ -15,7 +15,7 @@ export declare class LibroSqlCellView extends LibroEditableExecutableCellView {
|
|
|
15
15
|
model: LibroSqlCellModel;
|
|
16
16
|
libroViewTracker: LibroViewTracker;
|
|
17
17
|
outputs: IOutput[];
|
|
18
|
-
|
|
18
|
+
databases: DatabaseConfig[];
|
|
19
19
|
editorStatus: EditorStatus;
|
|
20
20
|
editorAreaHeight: number;
|
|
21
21
|
noEditorAreaHeight: number;
|
|
@@ -31,6 +31,7 @@ export declare class LibroSqlCellView extends LibroEditableExecutableCellView {
|
|
|
31
31
|
onViewMount: () => Promise<void>;
|
|
32
32
|
setEditorHost(ref: any): void;
|
|
33
33
|
onViewResize: (size: ViewSize) => void;
|
|
34
|
+
handleDbChange(value: string): void;
|
|
34
35
|
toJSON(): LibroCell;
|
|
35
36
|
focus: (toEdit: boolean) => void;
|
|
36
37
|
clearExecution: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libro-sql-cell-view.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EACV,eAAe,EAGf,SAAS,EACT,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,WAAW,EACX,YAAY,EAEZ,+BAA+B,EAC/B,gBAAgB,EAIhB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,QAAQ,EAQR,WAAW,EAGZ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"libro-sql-cell-view.d.ts","sourceRoot":"","sources":["../src/libro-sql-cell-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAa,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,KAAK,EACV,eAAe,EAGf,SAAS,EACT,aAAa,EACd,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,WAAW,EACX,YAAY,EAEZ,+BAA+B,EAC/B,gBAAgB,EAIhB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,QAAQ,EAQR,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAsHvD,eAAO,MAAM,YAAY,sEA6ExB,CAAC;AAEF,qBAEa,gBAAiB,SAAQ,+BAA+B;IAC1D,IAAI,uEAAgB;IACrB,KAAK,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,OAAO,EAAE,OAAO,EAAE,CAAC;IAGnB,SAAS,EAAE,cAAc,EAAE,CAAM;IAGxB,YAAY,EAAE,YAAY,CAA0B;IAG7D,gBAAgB,SAAK;IAGZ,kBAAkB,SAAK;IAEb,SAAS,EAAE,SAAS,CAAC;IAExC,SAAS,CAAC,uBAAuB,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAwB;IAEzE,IAAI,WAAW,kBAEd;IAEQ,YAAY,uDAMnB;IAGO,gBAAgB;IAIzB,oBAAoB;IAuBpB,SAAS,CAAC,kBAAkB,4BAAmC;IAC/D,IAAI,eAAe,6BAElB;gBAGqB,OAAO,EAAE,eAAe,EACvB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACnB,gBAAgB,EAAE,gBAAgB,EACjC,iBAAiB,EAAE,iBAAiB;IAsCxD,WAAW,sBAElB;IAEF,aAAa,CAAC,GAAG,EAAE,GAAG;IAKb,YAAY,SAAU,QAAQ,KAAG,IAAI,CAK5C;IAEF,cAAc,CAAC,KAAK,EAAE,MAAM;IAInB,MAAM,IAAI,SAAS;IASnB,KAAK,WAAY,OAAO,UAU/B;IAEO,cAAc,aAGrB;IAEa,GAAG;IAqElB,KAAK,YACM,cAAc,kBAAkB,CAAC,SAAS,CAAC,oBAClC,cAAc,aAAa,KAAK,GAAG,6CAUrD;IAEF,mBAAmB,aACP,cAAc,aAAa,eACxB,MAAM,KAAK,IAAI,UA6B5B;IAEF,iBAAiB,gDAef;CACH"}
|
|
@@ -3,9 +3,6 @@ var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor
|
|
|
3
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
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
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
6
|
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
7
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
8
|
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); } }
|
|
@@ -23,6 +20,9 @@ function _superPropBase(object, property) { while (!Object.prototype.hasOwnPrope
|
|
|
23
20
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
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; }
|
|
25
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
|
+
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; }
|
|
24
|
+
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); } }
|
|
25
|
+
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); }); }; }
|
|
26
26
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
27
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
28
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -35,6 +35,7 @@ import { isOutput } from '@difizen/libro-common';
|
|
|
35
35
|
import { CellService, EditorStatus, LibroContextKey, LibroEditableExecutableCellView, LibroViewTracker, VirtualizedManagerHelper, KernelError, LibroJupyterModel, LibroOutputArea } from '@difizen/libro-jupyter';
|
|
36
36
|
import { Deferred, getOrigin, inject, prop, transient, useInject, view, ViewInstance, ViewManager, ViewOption, ViewRender } from '@difizen/mana-app';
|
|
37
37
|
import { l10n } from '@difizen/mana-l10n';
|
|
38
|
+
import { Select } from 'antd';
|
|
38
39
|
import { Input } from 'antd';
|
|
39
40
|
import React from 'react';
|
|
40
41
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
@@ -147,10 +148,24 @@ export var LibroSqlCell = /*#__PURE__*/React.forwardRef(function SqlEditorViewCo
|
|
|
147
148
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
148
149
|
edit = _useState6[0],
|
|
149
150
|
setEdit = _useState6[1];
|
|
151
|
+
var _useState7 = useState(instance.model.dbId || l10n.t('暂无内置数据库')),
|
|
152
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
153
|
+
selectedDb = _useState8[0],
|
|
154
|
+
setSelectedDb = _useState8[1];
|
|
150
155
|
var handCancelEdit = function handCancelEdit() {
|
|
151
156
|
contextKey.enableCommandMode();
|
|
152
157
|
setEdit(false);
|
|
153
158
|
};
|
|
159
|
+
useEffect(function () {
|
|
160
|
+
instance.getDatabaseConfig();
|
|
161
|
+
}, [instance]);
|
|
162
|
+
var handleChange = function handleChange(value) {
|
|
163
|
+
instance.handleDbChange(value);
|
|
164
|
+
if (instance.parent.model.onChange) {
|
|
165
|
+
instance.parent.model.onChange();
|
|
166
|
+
}
|
|
167
|
+
setSelectedDb(value);
|
|
168
|
+
};
|
|
154
169
|
return /*#__PURE__*/_jsxs("div", {
|
|
155
170
|
tabIndex: 10,
|
|
156
171
|
ref: ref,
|
|
@@ -162,9 +177,31 @@ export var LibroSqlCell = /*#__PURE__*/React.forwardRef(function SqlEditorViewCo
|
|
|
162
177
|
children: [/*#__PURE__*/_jsx("span", {
|
|
163
178
|
className: "libro-sql-source-title",
|
|
164
179
|
children: /*#__PURE__*/_jsx(DatabaseOutlined, {})
|
|
165
|
-
}), /*#__PURE__*/_jsx(
|
|
166
|
-
|
|
167
|
-
|
|
180
|
+
}), /*#__PURE__*/_jsx(Select, {
|
|
181
|
+
value: selectedDb,
|
|
182
|
+
style: {
|
|
183
|
+
minWidth: 160
|
|
184
|
+
},
|
|
185
|
+
onChange: handleChange,
|
|
186
|
+
options: instance.databases.map(function (db) {
|
|
187
|
+
return {
|
|
188
|
+
value: db.id,
|
|
189
|
+
label: db.db_type + ': ' + db.database
|
|
190
|
+
};
|
|
191
|
+
}),
|
|
192
|
+
bordered: false,
|
|
193
|
+
onFocus: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
194
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
195
|
+
while (1) switch (_context.prev = _context.next) {
|
|
196
|
+
case 0:
|
|
197
|
+
_context.next = 2;
|
|
198
|
+
return instance.getDatabaseConfig();
|
|
199
|
+
case 2:
|
|
200
|
+
case "end":
|
|
201
|
+
return _context.stop();
|
|
202
|
+
}
|
|
203
|
+
}, _callee);
|
|
204
|
+
}))
|
|
168
205
|
})]
|
|
169
206
|
}), /*#__PURE__*/_jsxs("div", {
|
|
170
207
|
className: "libro-sql-variable-name",
|
|
@@ -200,7 +237,7 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
200
237
|
_this.view = LibroSqlCell;
|
|
201
238
|
_this.libroViewTracker = void 0;
|
|
202
239
|
_this.outputs = void 0;
|
|
203
|
-
_initializerDefineProperty(_this, "
|
|
240
|
+
_initializerDefineProperty(_this, "databases", _descriptor, _assertThisInitialized(_this));
|
|
204
241
|
_initializerDefineProperty(_this, "editorStatus", _descriptor2, _assertThisInitialized(_this));
|
|
205
242
|
_initializerDefineProperty(_this, "editorAreaHeight", _descriptor3, _assertThisInitialized(_this));
|
|
206
243
|
_initializerDefineProperty(_this, "noEditorAreaHeight", _descriptor4, _assertThisInitialized(_this));
|
|
@@ -216,17 +253,17 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
216
253
|
}
|
|
217
254
|
};
|
|
218
255
|
_this.outputAreaDeferred = new Deferred();
|
|
219
|
-
_this.onViewMount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
220
|
-
return _regeneratorRuntime().wrap(function
|
|
221
|
-
while (1) switch (
|
|
256
|
+
_this.onViewMount = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
257
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
258
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
222
259
|
case 0:
|
|
223
|
-
|
|
260
|
+
_context2.next = 2;
|
|
224
261
|
return _this.createEditor();
|
|
225
262
|
case 2:
|
|
226
263
|
case "end":
|
|
227
|
-
return
|
|
264
|
+
return _context2.stop();
|
|
228
265
|
}
|
|
229
|
-
},
|
|
266
|
+
}, _callee2);
|
|
230
267
|
}));
|
|
231
268
|
_this.onViewResize = function (size) {
|
|
232
269
|
// 把 header 部分高度也放在这部分,用来撑开高度
|
|
@@ -251,14 +288,14 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
251
288
|
_this.outputArea.clear();
|
|
252
289
|
};
|
|
253
290
|
_this.fetch = /*#__PURE__*/function () {
|
|
254
|
-
var
|
|
291
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(content, ioCallback) {
|
|
255
292
|
var _this$parent;
|
|
256
293
|
var model, connection, future;
|
|
257
|
-
return _regeneratorRuntime().wrap(function
|
|
258
|
-
while (1) switch (
|
|
294
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
295
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
259
296
|
case 0:
|
|
260
297
|
model = (_this$parent = _this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.model;
|
|
261
|
-
|
|
298
|
+
_context3.next = 3;
|
|
262
299
|
return model.kcReady;
|
|
263
300
|
case 3:
|
|
264
301
|
connection = model.kernelConnection;
|
|
@@ -266,15 +303,15 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
266
303
|
future.onIOPub = function (msg) {
|
|
267
304
|
ioCallback(msg);
|
|
268
305
|
};
|
|
269
|
-
return
|
|
306
|
+
return _context3.abrupt("return", future.done);
|
|
270
307
|
case 7:
|
|
271
308
|
case "end":
|
|
272
|
-
return
|
|
309
|
+
return _context3.stop();
|
|
273
310
|
}
|
|
274
|
-
},
|
|
311
|
+
}, _callee3);
|
|
275
312
|
}));
|
|
276
313
|
return function (_x, _x2) {
|
|
277
|
-
return
|
|
314
|
+
return _ref4.apply(this, arguments);
|
|
278
315
|
};
|
|
279
316
|
}();
|
|
280
317
|
_this.handleQueryResponse = function (response, cb) {
|
|
@@ -307,27 +344,27 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
307
344
|
break;
|
|
308
345
|
}
|
|
309
346
|
};
|
|
310
|
-
_this.getDatabaseConfig = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
311
|
-
return _regeneratorRuntime().wrap(function
|
|
312
|
-
while (1) switch (
|
|
347
|
+
_this.getDatabaseConfig = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
348
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
349
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
313
350
|
case 0:
|
|
314
|
-
return
|
|
351
|
+
return _context4.abrupt("return", _this.fetch({
|
|
315
352
|
code: _this.sqlScript.getDbConfig,
|
|
316
353
|
store_history: false
|
|
317
354
|
}, function (msg) {
|
|
318
355
|
return _this.handleQueryResponse(msg, function (result) {
|
|
319
356
|
try {
|
|
320
|
-
_this.
|
|
321
|
-
} catch (
|
|
322
|
-
|
|
357
|
+
_this.databases = JSON.parse(result);
|
|
358
|
+
} catch (_unused) {
|
|
359
|
+
//
|
|
323
360
|
}
|
|
324
361
|
});
|
|
325
362
|
}));
|
|
326
363
|
case 1:
|
|
327
364
|
case "end":
|
|
328
|
-
return
|
|
365
|
+
return _context4.stop();
|
|
329
366
|
}
|
|
330
|
-
},
|
|
367
|
+
}, _callee4);
|
|
331
368
|
}));
|
|
332
369
|
_this.codeEditorManager = codeEditorManager;
|
|
333
370
|
_this.outputs = (_options$cell = options.cell) === null || _options$cell === void 0 ? void 0 : _options$cell.outputs;
|
|
@@ -336,31 +373,31 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
336
373
|
cellId: _this.id,
|
|
337
374
|
cell: _assertThisInitialized(_this)
|
|
338
375
|
}).then( /*#__PURE__*/function () {
|
|
339
|
-
var
|
|
376
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(outputArea) {
|
|
340
377
|
var output;
|
|
341
|
-
return _regeneratorRuntime().wrap(function
|
|
342
|
-
while (1) switch (
|
|
378
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
379
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
343
380
|
case 0:
|
|
344
381
|
_this.outputArea = outputArea;
|
|
345
382
|
output = _this.outputs;
|
|
346
383
|
if (!isOutput(output)) {
|
|
347
|
-
|
|
384
|
+
_context5.next = 5;
|
|
348
385
|
break;
|
|
349
386
|
}
|
|
350
|
-
|
|
387
|
+
_context5.next = 5;
|
|
351
388
|
return _this.outputArea.fromJSON(output);
|
|
352
389
|
case 5:
|
|
353
390
|
_this.outputAreaDeferred.resolve(outputArea);
|
|
354
391
|
_this.outputWatch();
|
|
355
|
-
return
|
|
392
|
+
return _context5.abrupt("return");
|
|
356
393
|
case 8:
|
|
357
394
|
case "end":
|
|
358
|
-
return
|
|
395
|
+
return _context5.stop();
|
|
359
396
|
}
|
|
360
|
-
},
|
|
397
|
+
}, _callee5);
|
|
361
398
|
}));
|
|
362
399
|
return function (_x3) {
|
|
363
|
-
return
|
|
400
|
+
return _ref6.apply(this, arguments);
|
|
364
401
|
};
|
|
365
402
|
}()).catch(function () {
|
|
366
403
|
//
|
|
@@ -423,6 +460,11 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
423
460
|
var editorHostId = this.parent.id + this.id;
|
|
424
461
|
this.codeEditorManager.setEditorHostRef(editorHostId, ref);
|
|
425
462
|
}
|
|
463
|
+
}, {
|
|
464
|
+
key: "handleDbChange",
|
|
465
|
+
value: function handleDbChange(value) {
|
|
466
|
+
this.model.dbId = value;
|
|
467
|
+
}
|
|
426
468
|
}, {
|
|
427
469
|
key: "toJSON",
|
|
428
470
|
value: function toJSON() {
|
|
@@ -436,22 +478,22 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
436
478
|
}, {
|
|
437
479
|
key: "run",
|
|
438
480
|
value: function () {
|
|
439
|
-
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
481
|
+
var _run = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
440
482
|
var _this2 = this;
|
|
441
483
|
var libroModel, kernelConnection, cellContent, future, startTimeStr, msgPromise, endTimeStr;
|
|
442
|
-
return _regeneratorRuntime().wrap(function
|
|
443
|
-
while (1) switch (
|
|
484
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
485
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
444
486
|
case 0:
|
|
445
487
|
libroModel = this.parent.model;
|
|
446
488
|
if (!(!libroModel || !(libroModel instanceof LibroJupyterModel) || !libroModel.kernelConnection || libroModel.kernelConnection.isDisposed)) {
|
|
447
|
-
|
|
489
|
+
_context6.next = 3;
|
|
448
490
|
break;
|
|
449
491
|
}
|
|
450
|
-
return
|
|
492
|
+
return _context6.abrupt("return", false);
|
|
451
493
|
case 3:
|
|
452
494
|
kernelConnection = getOrigin(libroModel.kernelConnection);
|
|
453
495
|
cellContent = this.model.source;
|
|
454
|
-
|
|
496
|
+
_context6.prev = 5;
|
|
455
497
|
// Promise.resolve().then(() => {
|
|
456
498
|
this.clearExecution();
|
|
457
499
|
// });
|
|
@@ -483,10 +525,10 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
483
525
|
_this2.model.hasExecutedError = true;
|
|
484
526
|
}
|
|
485
527
|
};
|
|
486
|
-
|
|
528
|
+
_context6.next = 14;
|
|
487
529
|
return future.done;
|
|
488
530
|
case 14:
|
|
489
|
-
msgPromise =
|
|
531
|
+
msgPromise = _context6.sent;
|
|
490
532
|
this.model.executing = false;
|
|
491
533
|
this.model.kernelExecuting = false;
|
|
492
534
|
this.model.hasExecutedSuccess = !this.model.hasExecutedError;
|
|
@@ -495,36 +537,36 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
495
537
|
this.model.metadata['execution']['shell.execute_reply.started'] = startTimeStr;
|
|
496
538
|
this.model.metadata['execution']['shell.execute_reply.end'] = endTimeStr;
|
|
497
539
|
if (msgPromise) {
|
|
498
|
-
|
|
540
|
+
_context6.next = 24;
|
|
499
541
|
break;
|
|
500
542
|
}
|
|
501
|
-
return
|
|
543
|
+
return _context6.abrupt("return", true);
|
|
502
544
|
case 24:
|
|
503
545
|
if (!(msgPromise.content.status === 'ok')) {
|
|
504
|
-
|
|
546
|
+
_context6.next = 28;
|
|
505
547
|
break;
|
|
506
548
|
}
|
|
507
|
-
return
|
|
549
|
+
return _context6.abrupt("return", true);
|
|
508
550
|
case 28:
|
|
509
551
|
throw new KernelError(msgPromise.content);
|
|
510
552
|
case 29:
|
|
511
|
-
|
|
553
|
+
_context6.next = 36;
|
|
512
554
|
break;
|
|
513
555
|
case 31:
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
if (!
|
|
517
|
-
|
|
556
|
+
_context6.prev = 31;
|
|
557
|
+
_context6.t0 = _context6["catch"](5);
|
|
558
|
+
if (!_context6.t0.message.startsWith('Canceled')) {
|
|
559
|
+
_context6.next = 35;
|
|
518
560
|
break;
|
|
519
561
|
}
|
|
520
|
-
return
|
|
562
|
+
return _context6.abrupt("return", false);
|
|
521
563
|
case 35:
|
|
522
|
-
throw
|
|
564
|
+
throw _context6.t0;
|
|
523
565
|
case 36:
|
|
524
566
|
case "end":
|
|
525
|
-
return
|
|
567
|
+
return _context6.stop();
|
|
526
568
|
}
|
|
527
|
-
},
|
|
569
|
+
}, _callee6, this, [[5, 31]]);
|
|
528
570
|
}));
|
|
529
571
|
function run() {
|
|
530
572
|
return _run.apply(this, arguments);
|
|
@@ -533,11 +575,13 @@ export var LibroSqlCellView = (_dec = transient(), _dec2 = view('libro-sql-cell-
|
|
|
533
575
|
}()
|
|
534
576
|
}]);
|
|
535
577
|
return LibroSqlCellView;
|
|
536
|
-
}(LibroEditableExecutableCellView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "
|
|
578
|
+
}(LibroEditableExecutableCellView), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "databases", [_dec3], {
|
|
537
579
|
configurable: true,
|
|
538
580
|
enumerable: true,
|
|
539
581
|
writable: true,
|
|
540
|
-
initializer:
|
|
582
|
+
initializer: function initializer() {
|
|
583
|
+
return [];
|
|
584
|
+
}
|
|
541
585
|
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "editorStatus", [_dec4], {
|
|
542
586
|
configurable: true,
|
|
543
587
|
enumerable: true,
|
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
2
|
import { concatMultilineString } from '@difizen/libro-common';
|
|
4
3
|
import { FormatterContribution } from '@difizen/libro-jupyter';
|
|
5
4
|
import type {
|
|
@@ -24,12 +23,7 @@ export class FormatterSqlMagicContribution
|
|
|
24
23
|
return libroFormatter === this.formatter ? 100 : 1;
|
|
25
24
|
};
|
|
26
25
|
encode = (source: SqlDecodedFormatter) => {
|
|
27
|
-
const
|
|
28
|
-
result_variable: source.result_variable,
|
|
29
|
-
db_id: source.db_id,
|
|
30
|
-
sql_script: source.value,
|
|
31
|
-
};
|
|
32
|
-
const sqlEncodedValue = `%%sql \n${JSON.stringify(sqlJson)}`;
|
|
26
|
+
const sqlEncodedValue = `%%sql \n{"result_variable":"${source.result_variable}", "db_id":"${source.db_id}","sql_script":"${source.value}"}`;
|
|
33
27
|
return {
|
|
34
28
|
source: sqlEncodedValue,
|
|
35
29
|
metadata: {
|
|
@@ -41,19 +35,15 @@ export class FormatterSqlMagicContribution
|
|
|
41
35
|
const value = concatMultilineString(formatterValue.source);
|
|
42
36
|
if (value.startsWith('%%sql \n')) {
|
|
43
37
|
const run = value.split('%%sql \n')[1];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
} catch (e) {
|
|
55
|
-
console.warn('🚀 ~ e:', e);
|
|
56
|
-
}
|
|
38
|
+
const runValue = JSON.parse(run);
|
|
39
|
+
const result_variable: string = runValue.result_variable;
|
|
40
|
+
const db_id: string = runValue.db_id;
|
|
41
|
+
const codeValue: string = runValue.sql_script;
|
|
42
|
+
return {
|
|
43
|
+
result_variable,
|
|
44
|
+
value: codeValue,
|
|
45
|
+
db_id,
|
|
46
|
+
};
|
|
57
47
|
}
|
|
58
48
|
return {
|
|
59
49
|
value: '',
|