@superset-ui/query
Advanced tools
Comparing version 0.14.1 to 0.14.9
@@ -10,19 +10,20 @@ "use strict"; | ||
function fetchExploreJson({ | ||
async function fetchExploreJson({ | ||
client = _connection.SupersetClient, | ||
method = 'POST', | ||
requestConfig, | ||
url = '/superset/explore_json/', | ||
endpoint = '/superset/explore_json/', | ||
formData | ||
}) { | ||
const fetchFunc = method === 'GET' ? client.get : client.post; | ||
return fetchFunc(_extends({}, requestConfig, { | ||
const { | ||
json | ||
} = await client.request(_extends({}, requestConfig, { | ||
method, | ||
endpoint, | ||
// TODO: Have to transform formData as query string for GET | ||
url, | ||
postPayload: { | ||
form_data: formData | ||
} | ||
})).then(({ | ||
json | ||
}) => json); | ||
})); | ||
return json; | ||
} |
@@ -18,4 +18,6 @@ "use strict"; | ||
endpoint: "/api/v1/form_data/?slice_id=" + sliceId | ||
}, requestConfig)).then(response => response.json); | ||
}, requestConfig)).then(({ | ||
json | ||
}) => json); | ||
return overrideFormData ? promise.then(formData => _extends({}, formData, {}, overrideFormData)) : promise; | ||
} |
"use strict"; | ||
exports.__esModule = true; | ||
var _exportNames = { | ||
fetchExploreJson: true, | ||
getFormData: true, | ||
getDatasourceMetadata: true | ||
}; | ||
exports.getDatasourceMetadata = exports.getFormData = exports.fetchExploreJson = void 0; | ||
@@ -18,2 +23,10 @@ | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
exports[key] = _types[key]; | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
"use strict"; | ||
exports.__esModule = true; | ||
exports.postChartData = void 0; | ||
exports.default = exports.getChartData = void 0; | ||
var _postChartData = _interopRequireDefault(require("./postChartData")); | ||
var _makeApi = _interopRequireDefault(require("./makeApi")); | ||
exports.postChartData = _postChartData.default; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
const getChartData = (0, _makeApi.default)({ | ||
method: 'POST', | ||
endpoint: '/api/v1/chart/data' | ||
}); | ||
/** | ||
* All v1 API | ||
*/ | ||
exports.getChartData = getChartData; | ||
var _default = { | ||
getChartData | ||
}; | ||
exports.default = _default; |
@@ -1,1 +0,102 @@ | ||
"use strict"; | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.SupersetApiError = exports.SupersetApiErrorType = void 0; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
/* eslint-disable camelcase */ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
/** | ||
* Runtime options when calling a Superset API. Currently only allow overriding | ||
* SupersetClient instance. | ||
*/ | ||
/** | ||
* Superset API error types. | ||
* Ref: https://github.com/apache/incubator-superset/blob/318e5347bc6f88119725775baa4ab9a398a6f0b0/superset/errors.py#L24 | ||
* | ||
* TODO: migrate superset-frontend/src/components/ErrorMessage/types.ts over | ||
*/ | ||
let SupersetApiErrorType; | ||
/** | ||
* API Error json response from the backend (or fetch API in the frontend). | ||
* See SIP-40 and SIP-41: https://github.com/apache/incubator-superset/issues/9298 | ||
*/ | ||
exports.SupersetApiErrorType = SupersetApiErrorType; | ||
(function (SupersetApiErrorType) { | ||
SupersetApiErrorType["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; | ||
SupersetApiErrorType["FRONTEND_CSRF_ERROR"] = "FRONTEND_CSRF_ERROR"; | ||
SupersetApiErrorType["FRONTEND_NETWORK_ERROR"] = "FRONTEND_NETWORK_ERROR"; | ||
SupersetApiErrorType["FRONTEND_TIMEOUT_ERROR"] = "FRONTEND_TIMEOUT_ERROR"; | ||
SupersetApiErrorType["GENERIC_DB_ENGINE_ERROR"] = "GENERIC_DB_ENGINE_ERROR"; | ||
SupersetApiErrorType["VIZ_GET_DF_ERROR"] = "VIZ_GET_DF_ERROR"; | ||
SupersetApiErrorType["UNKNOWN_DATASOURCE_TYPE_ERROR"] = "UNKNOWN_DATASOURCE_TYPE_ERROR"; | ||
SupersetApiErrorType["FAILED_FETCHING_DATASOURCE_INFO_ERROR"] = "FAILED_FETCHING_DATASOURCE_INFO_ERROR"; | ||
SupersetApiErrorType["TABLE_SECURITY_ACCESS_ERROR"] = "TABLE_SECURITY_ACCESS_ERROR"; | ||
SupersetApiErrorType["DATASOURCE_SECURITY_ACCESS_ERROR"] = "DATASOURCE_SECURITY_ACCESS_ERROR"; | ||
SupersetApiErrorType["MISSING_OWNERSHIP_ERROR"] = "MISSING_OWNERSHIP_ERROR"; | ||
})(SupersetApiErrorType || (exports.SupersetApiErrorType = SupersetApiErrorType = {})); | ||
class SupersetApiError extends Error { | ||
constructor({ | ||
status, | ||
statusText, | ||
message, | ||
link, | ||
extra, | ||
stack, | ||
error_type: errorType, | ||
originalError | ||
}) { | ||
super(message); | ||
_defineProperty(this, "status", void 0); | ||
_defineProperty(this, "statusText", void 0); | ||
_defineProperty(this, "errorType", void 0); | ||
_defineProperty(this, "extra", void 0); | ||
_defineProperty(this, "originalError", void 0); | ||
const originalErrorStack = stack || (originalError instanceof Error ? originalError.stack : undefined); | ||
this.stack = originalErrorStack && this.stack ? [this.stack.split('\n')[0], ...originalErrorStack.split('\n').slice(1)].join('\n') : this.stack; | ||
this.name = 'SupersetApiError'; | ||
this.errorType = errorType || SupersetApiErrorType.UNKNOWN_ERROR; | ||
this.extra = extra || {}; | ||
if (link) { | ||
this.extra.link = link; | ||
} | ||
this.status = status; | ||
this.statusText = statusText; | ||
this.originalError = originalError; | ||
} | ||
} | ||
exports.SupersetApiError = SupersetApiError; |
@@ -27,3 +27,4 @@ "use strict"; | ||
const [key, residualValue] = entry; | ||
const normalizedKey = queryFieldAliases[key] || key; | ||
const normalizedKey = queryFieldAliases[key] || key; // eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
finalQueryFields[normalizedKey] = (finalQueryFields[normalizedKey] || []).concat(residualValue); | ||
@@ -30,0 +31,0 @@ }); |
@@ -10,6 +10,7 @@ "use strict"; | ||
DatasourceKey: true, | ||
makeApi: true, | ||
ApiLegacy: true, | ||
ApiV1: true | ||
}; | ||
exports.ApiV1 = exports.ApiLegacy = exports.DatasourceKey = exports.convertMetric = exports.convertFilter = exports.buildQueryObject = exports.buildQueryContext = void 0; | ||
exports.ApiV1 = exports.ApiLegacy = exports.makeApi = exports.DatasourceKey = exports.convertMetric = exports.convertFilter = exports.buildQueryObject = exports.buildQueryContext = void 0; | ||
@@ -84,3 +85,3 @@ var ApiLegacy = _interopRequireWildcard(require("./api/legacy")); | ||
var _types = require("./api/legacy/types"); | ||
var _types = require("./api/v1/types"); | ||
@@ -93,9 +94,5 @@ Object.keys(_types).forEach(function (key) { | ||
var _types2 = require("./api/v1/types"); | ||
var _makeApi = _interopRequireDefault(require("./api/v1/makeApi")); | ||
Object.keys(_types2).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
exports[key] = _types2[key]; | ||
}); | ||
exports.makeApi = _makeApi.default; | ||
@@ -102,0 +99,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -0,1 +1,2 @@ | ||
import { Method, Endpoint } from '@superset-ui/connection'; | ||
import { QueryFormData } from '../../types/QueryFormData'; | ||
@@ -5,7 +6,7 @@ import { LegacyChartDataResponse } from './types'; | ||
export interface Params extends BaseParams { | ||
method?: 'GET' | 'POST'; | ||
url?: string; | ||
method?: Method; | ||
endpoint?: Endpoint; | ||
formData: QueryFormData; | ||
} | ||
export default function fetchExploreJson({ client, method, requestConfig, url, formData, }: Params): Promise<LegacyChartDataResponse>; | ||
export default function fetchExploreJson({ client, method, requestConfig, endpoint, formData, }: Params): Promise<LegacyChartDataResponse>; | ||
//# sourceMappingURL=fetchExploreJson.d.ts.map |
@@ -10,19 +10,20 @@ "use strict"; | ||
function fetchExploreJson({ | ||
async function fetchExploreJson({ | ||
client = _connection.SupersetClient, | ||
method = 'POST', | ||
requestConfig, | ||
url = '/superset/explore_json/', | ||
endpoint = '/superset/explore_json/', | ||
formData | ||
}) { | ||
const fetchFunc = method === 'GET' ? client.get : client.post; | ||
return fetchFunc(_extends({}, requestConfig, { | ||
const { | ||
json | ||
} = await client.request(_extends({}, requestConfig, { | ||
method, | ||
endpoint, | ||
// TODO: Have to transform formData as query string for GET | ||
url, | ||
postPayload: { | ||
form_data: formData | ||
} | ||
})).then(({ | ||
json | ||
}) => json); | ||
})); | ||
return json; | ||
} |
@@ -18,4 +18,6 @@ "use strict"; | ||
endpoint: "/api/v1/form_data/?slice_id=" + sliceId | ||
}, requestConfig)).then(response => response.json); | ||
}, requestConfig)).then(({ | ||
json | ||
}) => json); | ||
return overrideFormData ? promise.then(formData => _extends({}, formData, {}, overrideFormData)) : promise; | ||
} |
export { default as fetchExploreJson } from './fetchExploreJson'; | ||
export { default as getFormData } from './getFormData'; | ||
export { default as getDatasourceMetadata } from './getDatasourceMetadata'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
exports.__esModule = true; | ||
var _exportNames = { | ||
fetchExploreJson: true, | ||
getFormData: true, | ||
getDatasourceMetadata: true | ||
}; | ||
exports.getDatasourceMetadata = exports.getFormData = exports.fetchExploreJson = void 0; | ||
@@ -18,2 +23,10 @@ | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
exports[key] = _types[key]; | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,5 +0,23 @@ | ||
import { V1ChartDataResponseResult } from '../v1/types'; | ||
export interface LegacyChartDataResponse extends Omit<V1ChartDataResponseResult, 'data'> { | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { ChartDataResponseResult } from '../v1/types'; | ||
export interface LegacyChartDataResponse extends Omit<ChartDataResponseResult, 'data'> { | ||
data: Record<string, unknown>[] | Record<string, unknown>; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -0,6 +1,24 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { RequestConfig, SupersetClientInterface, SupersetClientClass } from '@superset-ui/connection'; | ||
export interface BaseParams { | ||
client?: SupersetClientInterface | SupersetClientClass; | ||
requestConfig?: Partial<RequestConfig>; | ||
requestConfig?: RequestConfig; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,2 +0,21 @@ | ||
export { default as postChartData } from './postChartData'; | ||
import { QueryContext } from '../../types/Query'; | ||
import { ChartDataResponse } from './types'; | ||
export declare const getChartData: { | ||
(payload: QueryContext, { client }?: import("./types").SupersetApiRequestOptions): Promise<ChartDataResponse>; | ||
method: string | undefined; | ||
endpoint: string; | ||
requestType: "json" | "form" | "search"; | ||
}; | ||
declare const _default: { | ||
getChartData: { | ||
(payload: QueryContext, { client }?: import("./types").SupersetApiRequestOptions): Promise<ChartDataResponse>; | ||
method: string | undefined; | ||
endpoint: string; | ||
requestType: "json" | "form" | "search"; | ||
}; | ||
}; | ||
/** | ||
* All v1 API | ||
*/ | ||
export default _default; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
exports.__esModule = true; | ||
exports.postChartData = void 0; | ||
exports.default = exports.getChartData = void 0; | ||
var _postChartData = _interopRequireDefault(require("./postChartData")); | ||
var _makeApi = _interopRequireDefault(require("./makeApi")); | ||
exports.postChartData = _postChartData.default; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
const getChartData = (0, _makeApi.default)({ | ||
method: 'POST', | ||
endpoint: '/api/v1/chart/data' | ||
}); | ||
/** | ||
* All v1 API | ||
*/ | ||
exports.getChartData = getChartData; | ||
var _default = { | ||
getChartData | ||
}; | ||
exports.default = _default; |
@@ -1,2 +0,81 @@ | ||
export interface V1ChartDataResponseResult { | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { SupersetClientClass, SupersetClientInterface, StrictJsonObject, JsonValue, JsonObject } from '@superset-ui/connection'; | ||
export declare type ParsedResponseType<T> = T extends 'text' ? string : T extends 'raw' | null ? Response : JsonValue; | ||
/** | ||
* Runtime options when calling a Superset API. Currently only allow overriding | ||
* SupersetClient instance. | ||
*/ | ||
export interface SupersetApiRequestOptions { | ||
client?: SupersetClientInterface | SupersetClientClass; | ||
} | ||
/** | ||
* Superset API error types. | ||
* Ref: https://github.com/apache/incubator-superset/blob/318e5347bc6f88119725775baa4ab9a398a6f0b0/superset/errors.py#L24 | ||
* | ||
* TODO: migrate superset-frontend/src/components/ErrorMessage/types.ts over | ||
*/ | ||
export declare enum SupersetApiErrorType { | ||
UNKNOWN_ERROR = "UNKNOWN_ERROR", | ||
FRONTEND_CSRF_ERROR = "FRONTEND_CSRF_ERROR", | ||
FRONTEND_NETWORK_ERROR = "FRONTEND_NETWORK_ERROR", | ||
FRONTEND_TIMEOUT_ERROR = "FRONTEND_TIMEOUT_ERROR", | ||
GENERIC_DB_ENGINE_ERROR = "GENERIC_DB_ENGINE_ERROR", | ||
VIZ_GET_DF_ERROR = "VIZ_GET_DF_ERROR", | ||
UNKNOWN_DATASOURCE_TYPE_ERROR = "UNKNOWN_DATASOURCE_TYPE_ERROR", | ||
FAILED_FETCHING_DATASOURCE_INFO_ERROR = "FAILED_FETCHING_DATASOURCE_INFO_ERROR", | ||
TABLE_SECURITY_ACCESS_ERROR = "TABLE_SECURITY_ACCESS_ERROR", | ||
DATASOURCE_SECURITY_ACCESS_ERROR = "DATASOURCE_SECURITY_ACCESS_ERROR", | ||
MISSING_OWNERSHIP_ERROR = "MISSING_OWNERSHIP_ERROR" | ||
} | ||
/** | ||
* API Error json response from the backend (or fetch API in the frontend). | ||
* See SIP-40 and SIP-41: https://github.com/apache/incubator-superset/issues/9298 | ||
*/ | ||
export interface SupersetApiErrorPayload { | ||
message?: string; | ||
error_type?: SupersetApiErrorType; | ||
level?: 'error' | 'warn' | 'info'; | ||
extra?: StrictJsonObject; | ||
/** | ||
* Error message returned via `json_error_response`. | ||
* Ref https://github.com/apache/incubator-superset/blob/8e23d4f369f35724b34b14def8a5a8bafb1d2ecb/superset/views/base.py#L94 | ||
*/ | ||
error?: string | SupersetApiErrorPayload; | ||
link?: string; | ||
} | ||
export interface SupersetApiMultiErrorsPayload { | ||
errors: SupersetApiErrorPayload[]; | ||
} | ||
export declare class SupersetApiError extends Error { | ||
status?: number; | ||
statusText?: string; | ||
errorType: SupersetApiErrorType; | ||
extra: JsonObject; | ||
originalError?: Error | Response | JsonValue; | ||
constructor({ status, statusText, message, link, extra, stack, error_type: errorType, originalError, }: Omit<SupersetApiErrorPayload, 'error'> & { | ||
status?: number; | ||
statusText?: string; | ||
message: string; | ||
stack?: Error['stack']; | ||
originalError?: SupersetApiError['originalError']; | ||
}); | ||
} | ||
export interface ChartDataResponseResult { | ||
cache_key: string | null; | ||
@@ -13,5 +92,5 @@ cache_timeout: number | null; | ||
} | ||
export interface V1ChartDataResponse { | ||
result: V1ChartDataResponseResult[]; | ||
export interface ChartDataResponse { | ||
result: ChartDataResponseResult[]; | ||
} | ||
//# sourceMappingURL=types.d.ts.map |
@@ -1,1 +0,102 @@ | ||
"use strict"; | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.SupersetApiError = exports.SupersetApiErrorType = void 0; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
/* eslint-disable camelcase */ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
/** | ||
* Runtime options when calling a Superset API. Currently only allow overriding | ||
* SupersetClient instance. | ||
*/ | ||
/** | ||
* Superset API error types. | ||
* Ref: https://github.com/apache/incubator-superset/blob/318e5347bc6f88119725775baa4ab9a398a6f0b0/superset/errors.py#L24 | ||
* | ||
* TODO: migrate superset-frontend/src/components/ErrorMessage/types.ts over | ||
*/ | ||
let SupersetApiErrorType; | ||
/** | ||
* API Error json response from the backend (or fetch API in the frontend). | ||
* See SIP-40 and SIP-41: https://github.com/apache/incubator-superset/issues/9298 | ||
*/ | ||
exports.SupersetApiErrorType = SupersetApiErrorType; | ||
(function (SupersetApiErrorType) { | ||
SupersetApiErrorType["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; | ||
SupersetApiErrorType["FRONTEND_CSRF_ERROR"] = "FRONTEND_CSRF_ERROR"; | ||
SupersetApiErrorType["FRONTEND_NETWORK_ERROR"] = "FRONTEND_NETWORK_ERROR"; | ||
SupersetApiErrorType["FRONTEND_TIMEOUT_ERROR"] = "FRONTEND_TIMEOUT_ERROR"; | ||
SupersetApiErrorType["GENERIC_DB_ENGINE_ERROR"] = "GENERIC_DB_ENGINE_ERROR"; | ||
SupersetApiErrorType["VIZ_GET_DF_ERROR"] = "VIZ_GET_DF_ERROR"; | ||
SupersetApiErrorType["UNKNOWN_DATASOURCE_TYPE_ERROR"] = "UNKNOWN_DATASOURCE_TYPE_ERROR"; | ||
SupersetApiErrorType["FAILED_FETCHING_DATASOURCE_INFO_ERROR"] = "FAILED_FETCHING_DATASOURCE_INFO_ERROR"; | ||
SupersetApiErrorType["TABLE_SECURITY_ACCESS_ERROR"] = "TABLE_SECURITY_ACCESS_ERROR"; | ||
SupersetApiErrorType["DATASOURCE_SECURITY_ACCESS_ERROR"] = "DATASOURCE_SECURITY_ACCESS_ERROR"; | ||
SupersetApiErrorType["MISSING_OWNERSHIP_ERROR"] = "MISSING_OWNERSHIP_ERROR"; | ||
})(SupersetApiErrorType || (exports.SupersetApiErrorType = SupersetApiErrorType = {})); | ||
class SupersetApiError extends Error { | ||
constructor({ | ||
status, | ||
statusText, | ||
message, | ||
link, | ||
extra, | ||
stack, | ||
error_type: errorType, | ||
originalError | ||
}) { | ||
super(message); | ||
_defineProperty(this, "status", void 0); | ||
_defineProperty(this, "statusText", void 0); | ||
_defineProperty(this, "errorType", void 0); | ||
_defineProperty(this, "extra", void 0); | ||
_defineProperty(this, "originalError", void 0); | ||
const originalErrorStack = stack || (originalError instanceof Error ? originalError.stack : undefined); | ||
this.stack = originalErrorStack && this.stack ? [this.stack.split('\n')[0], ...originalErrorStack.split('\n').slice(1)].join('\n') : this.stack; | ||
this.name = 'SupersetApiError'; | ||
this.errorType = errorType || SupersetApiErrorType.UNKNOWN_ERROR; | ||
this.extra = extra || {}; | ||
if (link) { | ||
this.extra.link = link; | ||
} | ||
this.status = status; | ||
this.statusText = statusText; | ||
this.originalError = originalError; | ||
} | ||
} | ||
exports.SupersetApiError = SupersetApiError; |
@@ -27,3 +27,4 @@ "use strict"; | ||
const [key, residualValue] = entry; | ||
const normalizedKey = queryFieldAliases[key] || key; | ||
const normalizedKey = queryFieldAliases[key] || key; // eslint-disable-next-line @typescript-eslint/no-unsafe-call | ||
finalQueryFields[normalizedKey] = (finalQueryFields[normalizedKey] || []).concat(residualValue); | ||
@@ -30,0 +31,0 @@ }); |
@@ -0,1 +1,19 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import * as ApiLegacy from './api/legacy'; | ||
@@ -13,5 +31,5 @@ import * as ApiV1 from './api/v1'; | ||
export * from './types/Query'; | ||
export * from './api/v1/types'; | ||
export { default as makeApi } from './api/v1/makeApi'; | ||
export { ApiLegacy, ApiV1 }; | ||
export * from './api/legacy/types'; | ||
export * from './api/v1/types'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -10,6 +10,7 @@ "use strict"; | ||
DatasourceKey: true, | ||
makeApi: true, | ||
ApiLegacy: true, | ||
ApiV1: true | ||
}; | ||
exports.ApiV1 = exports.ApiLegacy = exports.DatasourceKey = exports.convertMetric = exports.convertFilter = exports.buildQueryObject = exports.buildQueryContext = void 0; | ||
exports.ApiV1 = exports.ApiLegacy = exports.makeApi = exports.DatasourceKey = exports.convertMetric = exports.convertFilter = exports.buildQueryObject = exports.buildQueryContext = void 0; | ||
@@ -84,3 +85,3 @@ var ApiLegacy = _interopRequireWildcard(require("./api/legacy")); | ||
var _types = require("./api/legacy/types"); | ||
var _types = require("./api/v1/types"); | ||
@@ -93,9 +94,5 @@ Object.keys(_types).forEach(function (key) { | ||
var _types2 = require("./api/v1/types"); | ||
var _makeApi = _interopRequireDefault(require("./api/v1/makeApi")); | ||
Object.keys(_types2).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
exports[key] = _types2[key]; | ||
}); | ||
exports.makeApi = _makeApi.default; | ||
@@ -102,0 +99,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -38,2 +38,4 @@ import { AdhocMetric } from './Metric'; | ||
row_limit?: string | number | null; | ||
/** row offset for server side pagination */ | ||
row_offset?: string | number | null; | ||
/** The metric used to order timeseries for limiting */ | ||
@@ -40,0 +42,0 @@ timeseries_limit_metric?: QueryFormResidualDataValue; |
{ | ||
"name": "@superset-ui/query", | ||
"version": "0.14.1", | ||
"version": "0.14.9", | ||
"description": "Superset UI query", | ||
@@ -36,3 +36,3 @@ "sideEffects": false, | ||
}, | ||
"gitHead": "cd10d30b50c69052d9c7ca2794b2e120788d876f" | ||
"gitHead": "92e0ccbec0e753335a03fb411b59242f4b624391" | ||
} |
@@ -6,3 +6,3 @@ ## @superset-ui/query | ||
Description | ||
Utility to build query object for chart data. | ||
@@ -17,9 +17,2 @@ #### Example usage | ||
`fn(args)` | ||
- Do something | ||
### Development | ||
`@data-ui/build-config` is used to manage the build configuration for this package including babel | ||
builds, jest testing, eslint, and prettier. | ||
TODO |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119211
115
2170
17