gooddata
Advanced tools
Comparing version 6.0.0-vaclavbohac-typescript-2018-03-26T15-54-41-233Z to 6.0.0-vaclavbohac-typescript-2018-03-27T12-06-54-526Z
@@ -1,2 +0,2 @@ | ||
import { XhrModule } from '../xhr'; | ||
import { XhrModule, ApiResponse } from '../xhr'; | ||
export declare const transformDataProduct: (item: any) => any; | ||
@@ -10,5 +10,5 @@ export declare class DataProductsModule { | ||
getDataProduct(contractId: string, dataProductId: string, include: any, stats: any, state: any): Promise<any>; | ||
createDataProduct(contractId: string, dataProductId: string, domainIds: string[]): Promise<any>; | ||
renameDataProduct(contractId: string, dataProductId: string, newDataProductId: string): Promise<any>; | ||
deleteDataProduct(contractId: string, dataProductId: string): Promise<any>; | ||
createDataProduct(contractId: string, dataProductId: string, domainIds: string[]): Promise<ApiResponse>; | ||
renameDataProduct(contractId: string, dataProductId: string, newDataProductId: string): Promise<ApiResponse>; | ||
deleteDataProduct(contractId: string, dataProductId: string): Promise<ApiResponse>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { XhrModule } from '../xhr'; | ||
import { XhrModule, ApiResponse } from '../xhr'; | ||
export declare const transformDomainSegment: (item: any) => any; | ||
@@ -10,8 +10,8 @@ export declare class DomainSegmentsModule { | ||
getDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string, query: any): Promise<any>; | ||
cloneDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string, newSegmentId: string, newDomainId: string): Promise<any>; | ||
deleteDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string): Promise<any>; | ||
renameDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string, newSegmentId: string): Promise<any>; | ||
syncDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string): Promise<any>; | ||
deployDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string, targetDomainId: string, synchronize: boolean): Promise<any>; | ||
cloneDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string, newSegmentId: string, newDomainId: string): Promise<ApiResponse>; | ||
deleteDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string): Promise<ApiResponse>; | ||
renameDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string, newSegmentId: string): Promise<ApiResponse>; | ||
syncDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string): Promise<ApiResponse>; | ||
deployDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string, targetDomainId: string, synchronize: boolean): Promise<ApiResponse>; | ||
updateDomainSegment(domainSegment: any): Promise<any>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { XhrModule } from '../xhr'; | ||
import { ApiResponse, XhrModule } from '../xhr'; | ||
export declare const transformSegment: (item: any) => any; | ||
@@ -10,5 +10,5 @@ export declare class SegmentsModule { | ||
}>; | ||
createSegment(contractId: string, dataProductId: string, segmentId: string, domainIds: string[]): Promise<any>; | ||
renameSegment(contractId: string, dataProductId: string, segmentId: string, newSegmentId: string): Promise<any>; | ||
deleteSegment(contractId: string, dataProductId: string, segmentId: string): Promise<any>; | ||
createSegment(contractId: string, dataProductId: string, segmentId: string, domainIds: string[]): Promise<ApiResponse>; | ||
renameSegment(contractId: string, dataProductId: string, segmentId: string, newSegmentId: string): Promise<ApiResponse>; | ||
deleteSegment(contractId: string, dataProductId: string, segmentId: string): Promise<ApiResponse>; | ||
} |
@@ -41,3 +41,4 @@ "use strict"; | ||
return this.sdk.xhr.get(uri) | ||
.then(function (visObject) { | ||
.then(function (response) { | ||
var visObject = response.data; | ||
_this.uri = uri; | ||
@@ -44,0 +45,0 @@ _this.visualizationObject = visObject; |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -11,2 +14,3 @@ // Copyright (C) 2007-2014, GoodData(R) Corporation. All rights reserved. | ||
exports.factory = factoryBrowser; | ||
__export(require("./interfaces")); | ||
exports.default = factoryBrowser(); |
@@ -0,1 +1,2 @@ | ||
export * from './xhr'; | ||
export declare type SortDirection = 'asc' | 'desc'; | ||
@@ -2,0 +3,0 @@ export interface IAccountInfo { |
"use strict"; | ||
// Copyright (C) 2007-2017, GoodData(R) Corporation. All rights reserved. | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./xhr")); |
@@ -1,2 +0,2 @@ | ||
import { XhrModule } from './xhr'; | ||
import { ApiResponse, XhrModule } from './xhr'; | ||
import { IGetObjectsByQueryOptions, IGetObjectUsingOptions, IValidElementsOptions } from './interfaces'; | ||
@@ -250,3 +250,3 @@ /** | ||
*/ | ||
deleteObject(uri: string): Promise<any>; | ||
deleteObject(uri: string): Promise<ApiResponse>; | ||
/** | ||
@@ -253,0 +253,0 @@ * Create object |
import { ITimezone, IColor } from './interfaces'; | ||
import { XhrModule } from './xhr'; | ||
import { XhrModule, ApiResponse } from './xhr'; | ||
export declare class ProjectModule { | ||
@@ -47,3 +47,3 @@ private xhr; | ||
*/ | ||
setColorPalette(projectId: string, colors: IColor[]): Promise<any>; | ||
setColorPalette(projectId: string, colors: IColor[]): Promise<ApiResponse>; | ||
/** | ||
@@ -81,3 +81,3 @@ * Gets current timezone and its offset. Example output: | ||
*/ | ||
deleteProject(projectId: string): Promise<any>; | ||
deleteProject(projectId: string): Promise<ApiResponse>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { XhrModule } from './xhr'; | ||
import { XhrModule, ApiResponse } from './xhr'; | ||
export declare class UserModule { | ||
@@ -31,3 +31,3 @@ private xhr; | ||
*/ | ||
loginSso(sessionId: string, serverUrl: string, targetUrl: string): Promise<any>; | ||
loginSso(sessionId: string, serverUrl: string, targetUrl: string): Promise<ApiResponse>; | ||
/** | ||
@@ -37,3 +37,3 @@ * Logs out current user | ||
*/ | ||
logout(): Promise<any>; | ||
logout(): Promise<ApiResponse | void>; | ||
/** | ||
@@ -45,3 +45,3 @@ * Updates user's profile settings | ||
*/ | ||
updateProfileSettings(profileId: string, profileSetting: any): Promise<any>; | ||
updateProfileSettings(profileId: string, profileSetting: any): Promise<ApiResponse>; | ||
/** | ||
@@ -48,0 +48,0 @@ * Returns info about currently logged in user from bootstrap resource |
@@ -1,2 +0,2 @@ | ||
export declare function handlePolling(url: string, settings: any, sendRequest: Function): Promise<{}>; | ||
export declare function handlePolling(url: string, settings: any, sendRequest: Function): Promise<ApiResponse>; | ||
export interface IPackageHeaders { | ||
@@ -41,19 +41,19 @@ name: string; | ||
ajaxSetup(settings: any): void; | ||
ajax(originalUrl: string, customSettings?: {}): Promise<any>; | ||
ajax(originalUrl: string, customSettings?: {}): Promise<ApiResponse>; | ||
/** | ||
* Wrapper for xhr.ajax method GET | ||
*/ | ||
get(url: string, settings?: any): Promise<any>; | ||
get(url: string, settings?: any): Promise<ApiResponse>; | ||
/** | ||
* Wrapper for xhr.ajax method POST | ||
*/ | ||
post(url: string, settings?: any): Promise<any>; | ||
post(url: string, settings?: any): Promise<ApiResponse>; | ||
/** | ||
* Wrapper for xhr.ajax method PUT | ||
*/ | ||
put(url: string, settings: any): Promise<any>; | ||
put(url: string, settings: any): Promise<ApiResponse>; | ||
/** | ||
* Wrapper for xhr.ajax method DELETE | ||
*/ | ||
del(url: string, settings?: any): Promise<any>; | ||
del(url: string, settings?: any): Promise<ApiResponse>; | ||
private createRequestSettings(customSettings); | ||
@@ -60,0 +60,0 @@ private continueAfterTokenRequest(url, settings); |
{ | ||
"name": "gooddata", | ||
"version": "6.0.0-vaclavbohac-typescript-2018-03-26T15-54-41-233Z", | ||
"version": "6.0.0-vaclavbohac-typescript-2018-03-27T12-06-54-526Z", | ||
"author": "GoodData", | ||
@@ -27,2 +27,3 @@ "description": "GoodData JavaScript SDK", | ||
"test": "jest --watch", | ||
"test-ci": "JEST_JUNIT_OUTPUT=./ci/results/test-results.xml jest --config jest.ci.json", | ||
"run-tslint": "tslint -p tsconfig.base.json", | ||
@@ -32,5 +33,3 @@ "tslint": "yarn run-tslint -t verbose $npm_package_config_tslint", | ||
"validate": "tsc -p tsconfig.base.json --noEmit && yarn tslint", | ||
"validate-ci": "tsc -p tsconfig.base.json --noEmit && yarn tslint-ci", | ||
"test:typings": "tsc --noEmit index.d.ts", | ||
"test:ci": "JEST_JUNIT_OUTPUT=./ci/results/test-results.xml jest --config jest.ci.json" | ||
"validate-ci": "tsc -p tsconfig.base.json --noEmit && yarn tslint-ci" | ||
}, | ||
@@ -37,0 +36,0 @@ "repository": { |
@@ -13,3 +13,3 @@ import { | ||
import * as domainDataProducts from './domainDataProducts'; | ||
import { XhrModule } from '../xhr'; | ||
import { XhrModule, ApiResponse } from '../xhr'; | ||
@@ -61,3 +61,3 @@ export const transformDataProduct = (item: any) => { | ||
public createDataProduct(contractId: string, dataProductId: string, domainIds: string[]) { | ||
public createDataProduct(contractId: string, dataProductId: string, domainIds: string[]): Promise<ApiResponse> { | ||
return this.xhr.post(interpolate(CONTRACT_DATA_PRODUCTS, { contractId }), { | ||
@@ -75,3 +75,7 @@ body: JSON.stringify({ | ||
public renameDataProduct(contractId: string, dataProductId: string, newDataProductId: string) { | ||
public renameDataProduct( | ||
contractId: string, | ||
dataProductId: string, | ||
newDataProductId: string | ||
): Promise<ApiResponse> { | ||
return this.xhr.post(interpolate(CONTRACT_DATA_PRODUCT_RENAME, { contractId, dataProductId }), { | ||
@@ -82,5 +86,5 @@ body: JSON.stringify({ dataProductRename: { id: newDataProductId } }) | ||
public deleteDataProduct(contractId: string, dataProductId: string) { | ||
public deleteDataProduct(contractId: string, dataProductId: string): Promise<ApiResponse> { | ||
return this.xhr.del(interpolate(CONTRACT_DATA_PRODUCT, { contractId, dataProductId })); | ||
} | ||
} |
@@ -13,3 +13,3 @@ import { omit } from 'lodash'; | ||
} from './routes'; | ||
import { XhrModule } from '../xhr'; | ||
import { XhrModule, ApiResponse } from '../xhr'; | ||
@@ -65,3 +65,3 @@ export const transformDomainSegment = (item: any) => { | ||
newDomainId: string | ||
) { | ||
): Promise<ApiResponse> { | ||
return this.xhr.post( | ||
@@ -83,3 +83,8 @@ interpolate( | ||
public deleteDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string) { | ||
public deleteDomainSegment( | ||
contractId: string, | ||
dataProductId: string, | ||
segmentId: string, | ||
domainId: string | ||
): Promise<ApiResponse> { | ||
return this.xhr.del( | ||
@@ -97,3 +102,3 @@ interpolate(CONTRACT_DATA_PRODUCT_DOMAIN_SEGMENT, | ||
newSegmentId: string | ||
) { | ||
): Promise<ApiResponse> { | ||
return this.xhr.post( | ||
@@ -114,3 +119,8 @@ interpolate( | ||
public syncDomainSegment(contractId: string, dataProductId: string, segmentId: string, domainId: string) { | ||
public syncDomainSegment( | ||
contractId: string, | ||
dataProductId: string, | ||
segmentId: string, | ||
domainId: string | ||
): Promise<ApiResponse> { | ||
return this.xhr.post(interpolate( | ||
@@ -129,3 +139,3 @@ CONTRACT_DATA_PRODUCT_DOMAIN_SEGMENT_SYNC, | ||
synchronize: boolean | ||
) { | ||
): Promise<ApiResponse> { | ||
return this.xhr.post( | ||
@@ -132,0 +142,0 @@ interpolate( |
@@ -5,2 +5,3 @@ import 'isomorphic-fetch'; | ||
import { factory, SDK } from '../../../gooddata'; | ||
import { ApiResponse } from '../../../xhr'; | ||
@@ -20,6 +21,8 @@ const sdk = factory(fetch)(); | ||
}; | ||
sdk.clone = () => sdk; // disable clone for spyOn to work | ||
jest.spyOn(sdk.xhr, 'get') | ||
.mockImplementation(() => Promise.resolve(visualizationObject)); | ||
.mockImplementation(() => | ||
Promise.resolve(new ApiResponse(new Response(), JSON.stringify(visualizationObject)))); | ||
@@ -26,0 +29,0 @@ return sdk; |
@@ -60,5 +60,8 @@ // (C) 2007-2018 GoodData Corporation | ||
return this.sdk.xhr.get(uri) | ||
.then((visObject: VisualizationObject.IVisualizationObjectResponse) => { | ||
.then((response) => { | ||
const visObject = response.data; | ||
this.uri = uri; | ||
this.visualizationObject = visObject; | ||
return visObject; | ||
@@ -65,0 +68,0 @@ }); |
// Copyright (C) 2007-2017, GoodData(R) Corporation. All rights reserved. | ||
export * from './xhr'; | ||
export type SortDirection = 'asc' | 'desc'; | ||
@@ -4,0 +6,0 @@ |
// Copyright (C) 2007-2017, GoodData(R) Corporation. All rights reserved. | ||
import { getIn, handlePolling } from './util'; | ||
import { ITimezone, IColor } from './interfaces'; | ||
import { XhrModule } from './xhr'; | ||
import { XhrModule, ApiResponse } from './xhr'; | ||
@@ -131,3 +131,3 @@ /** | ||
*/ | ||
public setColorPalette(projectId: string, colors: IColor[]) { | ||
public setColorPalette(projectId: string, colors: IColor[]): Promise<ApiResponse> { | ||
return this.xhr.put(`/gdc/projects/${projectId}/styleSettings`, { | ||
@@ -134,0 +134,0 @@ body: { |
// Copyright (C) 2007-2017, GoodData(R) Corporation. All rights reserved. | ||
import { XhrModule } from './xhr'; | ||
import { XhrModule, ApiResponseError, ApiResponse } from './xhr'; | ||
@@ -75,4 +75,4 @@ export class UserModule { | ||
*/ | ||
public logout() { | ||
return this.isLoggedIn().then((loggedIn: boolean) => { | ||
public logout(): Promise<ApiResponse | void> { | ||
return this.isLoggedIn().then((loggedIn: boolean): Promise<ApiResponse | void> => { | ||
if (loggedIn) { | ||
@@ -91,3 +91,3 @@ return this.xhr | ||
return Promise.resolve(); | ||
}, err => Promise.reject(err)); | ||
}, (err: ApiResponseError) => Promise.reject(err)); | ||
} | ||
@@ -101,3 +101,3 @@ | ||
*/ | ||
public updateProfileSettings(profileId: string, profileSetting: any) { // TODO | ||
public updateProfileSettings(profileId: string, profileSetting: any): Promise<ApiResponse> { // TODO | ||
return this.xhr.put(`/gdc/account/profile/${profileId}/settings`, { | ||
@@ -104,0 +104,0 @@ body: profileSetting |
@@ -54,3 +54,3 @@ // Copyright (C) 2007-2013, GoodData(R) Corporation. All rights reserved. | ||
export function handlePolling(url: string, settings: any, sendRequest: Function) { | ||
export function handlePolling(url: string, settings: any, sendRequest: Function): Promise<ApiResponse> { | ||
const pollingDelay = result(settings, 'pollDelay'); | ||
@@ -136,3 +136,3 @@ | ||
public async ajax(originalUrl: string, customSettings = {}) { | ||
public async ajax(originalUrl: string, customSettings = {}): Promise<ApiResponse> { | ||
// TODO refactor to: getRequestParams(originalUrl, customSettings); | ||
@@ -139,0 +139,0 @@ const firstSettings = this.createRequestSettings(customSettings); |
2
518027
169
13728