@deephaven/jsapi-utils 0.58.1-beta.5 → 0.59.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":"ConnectionUtils.d.ts","sourceRoot":"","sources":["../src/ConnectionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAGhC,yDAAyD;AACzD,eAAO,MAAM,aAAa,QAAS,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,aAAa,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,SAAgB,GACtB,OAAO,CAAC,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"ConnectionUtils.d.ts","sourceRoot":"","sources":["../src/ConnectionUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAGhC,yDAAyD;AACzD,eAAO,MAAM,aAAa,QAAS,CAAC;AAEpC;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,aAAa,EACzB,IAAI,EAAE,MAAM,EACZ,OAAO,SAAgB,GACtB,OAAO,CAAC,kBAAkB,CAAC,CA0B7B"}
|
package/dist/ConnectionUtils.js
CHANGED
|
@@ -17,7 +17,7 @@ export function fetchVariableDefinition(connection, name) {
|
|
|
17
17
|
var timeoutId = setTimeout(() => {
|
|
18
18
|
var _removeListener;
|
|
19
19
|
(_removeListener = removeListener) === null || _removeListener === void 0 ? void 0 : _removeListener();
|
|
20
|
-
reject(new TimeoutError("
|
|
20
|
+
reject(new TimeoutError("Timeout looking for variable ".concat(name)));
|
|
21
21
|
}, timeout);
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -25,12 +25,14 @@ export function fetchVariableDefinition(connection, name) {
|
|
|
25
25
|
* @param changes Variables changes that have occurred
|
|
26
26
|
*/
|
|
27
27
|
function handleFieldUpdates(changes) {
|
|
28
|
+
var _removeListener2;
|
|
28
29
|
var definition = changes.created.find(def => def.title === name);
|
|
30
|
+
clearTimeout(timeoutId);
|
|
31
|
+
(_removeListener2 = removeListener) === null || _removeListener2 === void 0 ? void 0 : _removeListener2();
|
|
29
32
|
if (definition != null) {
|
|
30
|
-
var _removeListener2;
|
|
31
|
-
clearTimeout(timeoutId);
|
|
32
|
-
(_removeListener2 = removeListener) === null || _removeListener2 === void 0 ? void 0 : _removeListener2();
|
|
33
33
|
resolve(definition);
|
|
34
|
+
} else {
|
|
35
|
+
reject(new Error("Variable ".concat(name, " not found")));
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
removeListener = connection.subscribeToFieldUpdates(handleFieldUpdates);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionUtils.js","names":["TimeoutError","FETCH_TIMEOUT","fetchVariableDefinition","connection","name","timeout","arguments","length","undefined","Promise","resolve","reject","removeListener","timeoutId","setTimeout","_removeListener","concat","handleFieldUpdates","changes","definition","created","find","def","title","
|
|
1
|
+
{"version":3,"file":"ConnectionUtils.js","names":["TimeoutError","FETCH_TIMEOUT","fetchVariableDefinition","connection","name","timeout","arguments","length","undefined","Promise","resolve","reject","removeListener","timeoutId","setTimeout","_removeListener","concat","handleFieldUpdates","changes","_removeListener2","definition","created","find","def","title","clearTimeout","Error","subscribeToFieldUpdates"],"sources":["../src/ConnectionUtils.ts"],"sourcesContent":["import type {\n IdeConnection,\n VariableChanges,\n VariableDefinition,\n} from '@deephaven/jsapi-types';\nimport { TimeoutError } from '@deephaven/utils';\n\n/** Default timeout for fetching a variable definition */\nexport const FETCH_TIMEOUT = 10_000;\n\n/**\n * Fetch the definition for a variable given a connection. Subscribes to field updates and triggers when the variable is found.\n * @param connection Connection to get the variable from\n * @param name Name of the definition to fetch\n * @param timeout Timeout for the fetch\n * @returns Promise the resolves to the variable definition if found, or rejects if there's an error or the timeout has exceeded\n */\nexport function fetchVariableDefinition(\n connection: IdeConnection,\n name: string,\n timeout = FETCH_TIMEOUT\n): Promise<VariableDefinition> {\n return new Promise<VariableDefinition>((resolve, reject) => {\n let removeListener: () => void;\n\n const timeoutId = setTimeout(() => {\n removeListener?.();\n reject(new TimeoutError(`Timeout looking for variable ${name}`));\n }, timeout);\n\n /**\n * Checks if the variable we're looking for is in the changes, and resolves the promise if it does\n * @param changes Variables changes that have occurred\n */\n function handleFieldUpdates(changes: VariableChanges): void {\n const definition = changes.created.find(def => def.title === name);\n clearTimeout(timeoutId);\n removeListener?.();\n if (definition != null) {\n resolve(definition);\n } else {\n reject(new Error(`Variable ${name} not found`));\n }\n }\n\n removeListener = connection.subscribeToFieldUpdates(handleFieldUpdates);\n });\n}\n"],"mappings":"AAKA,SAASA,YAAY,QAAQ,kBAAkB;;AAE/C;AACA,OAAO,IAAMC,aAAa,GAAG,KAAM;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CACrCC,UAAyB,EACzBC,IAAY,EAEiB;EAAA,IAD7BC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGL,aAAa;EAEvB,OAAO,IAAIQ,OAAO,CAAqB,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC1D,IAAIC,cAA0B;IAE9B,IAAMC,SAAS,GAAGC,UAAU,CAAC,MAAM;MAAA,IAAAC,eAAA;MACjC,CAAAA,eAAA,GAAAH,cAAc,cAAAG,eAAA,uBAAdA,eAAA,CAAiB,CAAC;MAClBJ,MAAM,CAAC,IAAIX,YAAY,iCAAAgB,MAAA,CAAiCZ,IAAI,CAAE,CAAC,CAAC;IAClE,CAAC,EAAEC,OAAO,CAAC;;IAEX;AACJ;AACA;AACA;IACI,SAASY,kBAAkBA,CAACC,OAAwB,EAAQ;MAAA,IAAAC,gBAAA;MAC1D,IAAMC,UAAU,GAAGF,OAAO,CAACG,OAAO,CAACC,IAAI,CAACC,GAAG,IAAIA,GAAG,CAACC,KAAK,KAAKpB,IAAI,CAAC;MAClEqB,YAAY,CAACZ,SAAS,CAAC;MACvB,CAAAM,gBAAA,GAAAP,cAAc,cAAAO,gBAAA,uBAAdA,gBAAA,CAAiB,CAAC;MAClB,IAAIC,UAAU,IAAI,IAAI,EAAE;QACtBV,OAAO,CAACU,UAAU,CAAC;MACrB,CAAC,MAAM;QACLT,MAAM,CAAC,IAAIe,KAAK,aAAAV,MAAA,CAAaZ,IAAI,eAAY,CAAC,CAAC;MACjD;IACF;IAEAQ,cAAc,GAAGT,UAAU,CAACwB,uBAAuB,CAACV,kBAAkB,CAAC;EACzE,CAAC,CAAC;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/jsapi-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "Deephaven JSAPI Utils",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@deephaven/filters": "^0.
|
|
25
|
-
"@deephaven/jsapi-types": "^0.
|
|
26
|
-
"@deephaven/log": "^0.
|
|
27
|
-
"@deephaven/utils": "^0.
|
|
24
|
+
"@deephaven/filters": "^0.59.0",
|
|
25
|
+
"@deephaven/jsapi-types": "^0.59.0",
|
|
26
|
+
"@deephaven/log": "^0.59.0",
|
|
27
|
+
"@deephaven/utils": "^0.59.0",
|
|
28
28
|
"lodash.clamp": "^4.0.3",
|
|
29
29
|
"shortid": "^2.2.16"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@deephaven/jsapi-shim": "^0.
|
|
32
|
+
"@deephaven/jsapi-shim": "^0.59.0"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "9d2fcaeb5b6ffd624df9eab1cfea6ce0a183a803"
|
|
42
42
|
}
|