Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FE-10910] Update Thrift bindings with rename #179

Merged
merged 4 commits into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions dist/browser-connector.js

Large diffs are not rendered by default.

99 changes: 76 additions & 23 deletions dist/node-connector.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions scripts/fix-thrift-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ const filePathsBrowser = [
"thrift/browser/completion_hints_types.js",
"thrift/browser/common_types.js",
"thrift/browser/serialized_result_set_types.js",
"thrift/browser/mapd_types.js",
"thrift/browser/mapd.thrift.js",
"thrift/browser/omnisci_types.js",
"thrift/browser/OmniSci.js",
"thrift/browser/thrift.js"
]
const filePathsNode = [
"thrift/node/completion_hints_types.js",
"thrift/node/common_types.js",
"thrift/node/extension_functions_types.js",
"thrift/node/serialized_result_set_types.js",
"thrift/node/mapd_types.js",
"thrift/node/mapd.thrift.js"
"thrift/node/omnisci_types.js",
"thrift/node/OmniSci.js"
]
filePathsBrowser.forEach(declareWith("window."))
filePathsNode.forEach(declareWith("var "))
Expand Down
4 changes: 2 additions & 2 deletions src/mapd-client-v2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const MapDClient =
(typeof window !== "undefined" && window.MapDClient) ||
require("../build/thrift/node/mapd.thrift.js").Client // eslint-disable-line global-require
(typeof window !== "undefined" && window.OmniSciClient) ||
require("../build/thrift/node/OmniSci.js").Client // eslint-disable-line global-require

import { wrapWithErrorHandling } from "./wrap-with-error-handling"

Expand Down
8 changes: 4 additions & 4 deletions src/mapd-con-es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

const { TDatumType, TEncodingType } =
(isNodeRuntime() && require("../build/thrift/node/common_types.js")) || window // eslint-disable-line global-require
const { TPixel, TMapDException } =
(isNodeRuntime() && require("../build/thrift/node/mapd_types.js")) || window // eslint-disable-line global-require
const { TPixel, TOmniSciException } =
(isNodeRuntime() && require("../build/thrift/node/omnisci_types.js")) || window // eslint-disable-line global-require
const MapDThrift =
isNodeRuntime() && require("../build/thrift/node/mapd.thrift.js") // eslint-disable-line global-require
isNodeRuntime() && require("../build/thrift/node/OmniSci.js") // eslint-disable-line global-require
let Thrift = (isNodeRuntime() && require("thrift")) || window.Thrift // eslint-disable-line global-require
const thriftWrapper = Thrift
const parseUrl = isNodeRuntime() && require("url").parse // eslint-disable-line global-require
Expand Down Expand Up @@ -1936,7 +1936,7 @@ class MapdCon {

isTimeoutError(result) {
return (
result instanceof TMapDException &&
result instanceof TOmniSciException &&
(String(result.error_msg).indexOf("Session not valid.") !== -1 ||
String(result.error_msg).indexOf("User should re-authenticate.") !== -1)
)
Expand Down
8 changes: 4 additions & 4 deletions src/wrap-with-error-handling.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const MapDClient =
(typeof window !== "undefined" && window.MapDClient) ||
require("../build/thrift/node/mapd.thrift.js").Client // eslint-disable-line global-require
(typeof window !== "undefined" && window.OmniSciClient) ||
require("../build/thrift/node/OmniSci.js").Client // eslint-disable-line global-require
const TMapDException =
(typeof window !== "undefined" && window.TMapDException) ||
require("../build/thrift/node/mapd_types.js").TMapDException // eslint-disable-line global-require
(typeof window !== "undefined" && window.TOmniSciException) ||
require("../build/thrift/node/omnisci_types.js").TOmniSciException // eslint-disable-line global-require
const Thrift =
(typeof window !== "undefined" && window.Thrift) || require("thrift").Thrift // eslint-disable-line global-require

Expand Down
4 changes: 2 additions & 2 deletions test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import jsdom from "jsdom"
const scripts = `
<script>
${fs.readFileSync("./thrift/browser/thrift.js", "utf-8")}
${fs.readFileSync("./thrift/browser/mapd.thrift.js", "utf-8")}
${fs.readFileSync("./thrift/browser/mapd_types.js", "utf-8")}
${fs.readFileSync("./thrift/browser/OmniSci.js", "utf-8")}
${fs.readFileSync("./thrift/browser/omnisci_types.js", "utf-8")}
</script>
`
const doc = jsdom.jsdom(`<!doctype html><html>${scripts}<body></body></html>`)
Expand Down
8 changes: 4 additions & 4 deletions test/wrap-with-error-handling.unit.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from "chai"
import {
CREATE_LINK_ERROR_STRING,
isResultError,
isCreateLinkError
isCreateLinkError,
isResultError
} from "../src/wrap-with-error-handling"

describe("wrapWithErrorHandling", () => {
Expand All @@ -13,8 +13,8 @@ describe("wrapWithErrorHandling", () => {
it("should return true when result is instance of a Thrift.TException", () => {
expect(isResultError(new Thrift.TException())).to.equal(true)
})
it("should return true when result is instance of a TMapDException", () => {
expect(isResultError(new TMapDException())).to.equal(true)
it("should return true when result is instance of a TOmniSciException", () => {
expect(isResultError(new TOmniSciException())).to.equal(true)
})
it("should return false when result is a string", () => {
expect(isResultError("ERROR")).to.equal(false)
Expand Down