@emuanalytics/flow-engine-client 1.3.31 → 1.3.34
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/CHANGELOG.md +57 -0
- package/dist/bundle.js.map +1 -1
- package/esm/index.d.ts +7 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +7 -0
- package/esm/index.js.map +1 -0
- package/esm/lib/api-interfaces.d.ts +207 -0
- package/esm/lib/api-interfaces.d.ts.map +1 -0
- package/esm/lib/api-interfaces.js +5 -0
- package/esm/lib/api-interfaces.js.map +1 -0
- package/esm/lib/apikey.endpoints.d.ts +10 -0
- package/esm/lib/apikey.endpoints.d.ts.map +1 -0
- package/esm/lib/apikey.endpoints.js +28 -0
- package/esm/lib/apikey.endpoints.js.map +1 -0
- package/esm/lib/appconfig.endpoints.d.ts +10 -0
- package/esm/lib/appconfig.endpoints.d.ts.map +1 -0
- package/esm/lib/appconfig.endpoints.js +28 -0
- package/esm/lib/appconfig.endpoints.js.map +1 -0
- package/esm/lib/application.endpoints.d.ts +10 -0
- package/esm/lib/application.endpoints.d.ts.map +1 -0
- package/esm/lib/application.endpoints.js +28 -0
- package/esm/lib/application.endpoints.js.map +1 -0
- package/esm/lib/auth.edpoints.d.ts +19 -0
- package/esm/lib/auth.edpoints.d.ts.map +1 -0
- package/esm/lib/auth.edpoints.js +49 -0
- package/esm/lib/auth.edpoints.js.map +1 -0
- package/esm/lib/base.endpoints.d.ts +20 -0
- package/esm/lib/base.endpoints.d.ts.map +1 -0
- package/esm/lib/base.endpoints.js +71 -0
- package/esm/lib/base.endpoints.js.map +1 -0
- package/esm/lib/client.d.ts +49 -0
- package/esm/lib/client.d.ts.map +1 -0
- package/esm/lib/client.js +142 -0
- package/esm/lib/client.js.map +1 -0
- package/esm/lib/database.endpoints.d.ts +11 -0
- package/esm/lib/database.endpoints.d.ts.map +1 -0
- package/esm/lib/database.endpoints.js +36 -0
- package/esm/lib/database.endpoints.js.map +1 -0
- package/esm/lib/dataset.endpoints.d.ts +22 -0
- package/esm/lib/dataset.endpoints.d.ts.map +1 -0
- package/esm/lib/dataset.endpoints.js +72 -0
- package/esm/lib/dataset.endpoints.js.map +1 -0
- package/esm/lib/errors.d.ts +9 -0
- package/esm/lib/errors.d.ts.map +1 -0
- package/esm/lib/errors.js +33 -0
- package/esm/lib/errors.js.map +1 -0
- package/esm/lib/job.endpoints.d.ts +15 -0
- package/esm/lib/job.endpoints.d.ts.map +1 -0
- package/esm/lib/job.endpoints.js +43 -0
- package/esm/lib/job.endpoints.js.map +1 -0
- package/esm/lib/map.endoints.d.ts +11 -0
- package/esm/lib/map.endoints.d.ts.map +1 -0
- package/esm/lib/map.endoints.js +15 -0
- package/esm/lib/map.endoints.js.map +1 -0
- package/esm/lib/style.endpoint.d.ts +10 -0
- package/esm/lib/style.endpoint.d.ts.map +1 -0
- package/esm/lib/style.endpoint.js +28 -0
- package/esm/lib/style.endpoint.js.map +1 -0
- package/esm/lib/tile-source.endpoints.d.ts +11 -0
- package/esm/lib/tile-source.endpoints.d.ts.map +1 -0
- package/esm/lib/tile-source.endpoints.js +36 -0
- package/esm/lib/tile-source.endpoints.js.map +1 -0
- package/esm/lib/tile.endpoints.d.ts +12 -0
- package/esm/lib/tile.endpoints.d.ts.map +1 -0
- package/esm/lib/tile.endpoints.js +19 -0
- package/esm/lib/tile.endpoints.js.map +1 -0
- package/esm/lib/upload.endpoints.d.ts +23 -0
- package/esm/lib/upload.endpoints.d.ts.map +1 -0
- package/esm/lib/upload.endpoints.js +105 -0
- package/esm/lib/upload.endpoints.js.map +1 -0
- package/esm/lib/user.endpoints.d.ts +11 -0
- package/esm/lib/user.endpoints.d.ts.map +1 -0
- package/esm/lib/user.endpoints.js +33 -0
- package/esm/lib/user.endpoints.js.map +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +23 -0
- package/lib/index.js.map +1 -0
- package/lib/lib/api-interfaces.d.ts +207 -0
- package/lib/lib/api-interfaces.d.ts.map +1 -0
- package/lib/lib/api-interfaces.js +6 -0
- package/lib/lib/api-interfaces.js.map +1 -0
- package/lib/lib/apikey.endpoints.d.ts +10 -0
- package/lib/lib/apikey.endpoints.d.ts.map +1 -0
- package/lib/lib/apikey.endpoints.js +31 -0
- package/lib/lib/apikey.endpoints.js.map +1 -0
- package/lib/lib/appconfig.endpoints.d.ts +10 -0
- package/lib/lib/appconfig.endpoints.d.ts.map +1 -0
- package/lib/lib/appconfig.endpoints.js +31 -0
- package/lib/lib/appconfig.endpoints.js.map +1 -0
- package/lib/lib/application.endpoints.d.ts +10 -0
- package/lib/lib/application.endpoints.d.ts.map +1 -0
- package/lib/lib/application.endpoints.js +31 -0
- package/lib/lib/application.endpoints.js.map +1 -0
- package/lib/lib/auth.edpoints.d.ts +19 -0
- package/lib/lib/auth.edpoints.d.ts.map +1 -0
- package/lib/lib/auth.edpoints.js +52 -0
- package/lib/lib/auth.edpoints.js.map +1 -0
- package/lib/lib/base.endpoints.d.ts +20 -0
- package/lib/lib/base.endpoints.d.ts.map +1 -0
- package/lib/lib/base.endpoints.js +74 -0
- package/lib/lib/base.endpoints.js.map +1 -0
- package/lib/lib/client.d.ts +49 -0
- package/lib/lib/client.d.ts.map +1 -0
- package/lib/lib/client.js +148 -0
- package/lib/lib/client.js.map +1 -0
- package/lib/lib/database.endpoints.d.ts +11 -0
- package/lib/lib/database.endpoints.d.ts.map +1 -0
- package/lib/lib/database.endpoints.js +39 -0
- package/lib/lib/database.endpoints.js.map +1 -0
- package/lib/lib/dataset.endpoints.d.ts +22 -0
- package/lib/lib/dataset.endpoints.d.ts.map +1 -0
- package/lib/lib/dataset.endpoints.js +75 -0
- package/lib/lib/dataset.endpoints.js.map +1 -0
- package/lib/lib/errors.d.ts +9 -0
- package/lib/lib/errors.d.ts.map +1 -0
- package/lib/lib/errors.js +36 -0
- package/lib/lib/errors.js.map +1 -0
- package/lib/lib/job.endpoints.d.ts +15 -0
- package/lib/lib/job.endpoints.d.ts.map +1 -0
- package/lib/lib/job.endpoints.js +46 -0
- package/lib/lib/job.endpoints.js.map +1 -0
- package/lib/lib/map.endoints.d.ts +11 -0
- package/lib/lib/map.endoints.d.ts.map +1 -0
- package/lib/lib/map.endoints.js +18 -0
- package/lib/lib/map.endoints.js.map +1 -0
- package/lib/lib/style.endpoint.d.ts +10 -0
- package/lib/lib/style.endpoint.d.ts.map +1 -0
- package/lib/lib/style.endpoint.js +31 -0
- package/lib/lib/style.endpoint.js.map +1 -0
- package/lib/lib/tile-source.endpoints.d.ts +11 -0
- package/lib/lib/tile-source.endpoints.d.ts.map +1 -0
- package/lib/lib/tile-source.endpoints.js +39 -0
- package/lib/lib/tile-source.endpoints.js.map +1 -0
- package/lib/lib/tile.endpoints.d.ts +12 -0
- package/lib/lib/tile.endpoints.d.ts.map +1 -0
- package/lib/lib/tile.endpoints.js +22 -0
- package/lib/lib/tile.endpoints.js.map +1 -0
- package/lib/lib/upload.endpoints.d.ts +23 -0
- package/lib/lib/upload.endpoints.d.ts.map +1 -0
- package/lib/lib/upload.endpoints.js +111 -0
- package/lib/lib/upload.endpoints.js.map +1 -0
- package/lib/lib/user.endpoints.d.ts +11 -0
- package/lib/lib/user.endpoints.d.ts.map +1 -0
- package/lib/lib/user.endpoints.js +36 -0
- package/lib/lib/user.endpoints.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2018 Emu Analytics
|
|
4
|
+
*/
|
|
5
|
+
var __extends = (this && this.__extends) || (function () {
|
|
6
|
+
var extendStatics = function (d, b) {
|
|
7
|
+
extendStatics = Object.setPrototypeOf ||
|
|
8
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
9
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
10
|
+
return extendStatics(d, b);
|
|
11
|
+
};
|
|
12
|
+
return function (d, b) {
|
|
13
|
+
if (typeof b !== "function" && b !== null)
|
|
14
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
15
|
+
extendStatics(d, b);
|
|
16
|
+
function __() { this.constructor = d; }
|
|
17
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.ApplicationEndpoints = void 0;
|
|
22
|
+
var base_endpoints_1 = require("./base.endpoints");
|
|
23
|
+
var ApplicationEndpoints = /** @class */ (function (_super) {
|
|
24
|
+
__extends(ApplicationEndpoints, _super);
|
|
25
|
+
function ApplicationEndpoints(client) {
|
|
26
|
+
return _super.call(this, client, 'applications') || this;
|
|
27
|
+
}
|
|
28
|
+
return ApplicationEndpoints;
|
|
29
|
+
}(base_endpoints_1.BaseEndpoints));
|
|
30
|
+
exports.ApplicationEndpoints = ApplicationEndpoints;
|
|
31
|
+
//# sourceMappingURL=application.endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.endpoints.js","sourceRoot":"","sources":["../../src/lib/application.endpoints.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;AAGH,mDAAiD;AAGjD;IAA0C,wCAA2B;IACnE,8BAAY,MAAc;eACxB,kBAAM,MAAM,EAAE,cAAc,CAAC;IAC/B,CAAC;IACH,2BAAC;AAAD,CAAC,AAJD,CAA0C,8BAAa,GAItD;AAJY,oDAAoB","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { BaseEndpoints } from './base.endpoints';\nimport { IApplication } from './api-interfaces';\n\nexport class ApplicationEndpoints extends BaseEndpoints<IApplication> {\n constructor(client: Client) {\n super(client, 'applications');\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2018 Emu Analytics
|
|
3
|
+
*/
|
|
4
|
+
import { Client } from './client';
|
|
5
|
+
import { UserEndpoint } from './user.endpoints';
|
|
6
|
+
import { ILoginResponse, ITokenRefreshResponse } from './api-interfaces';
|
|
7
|
+
export declare class AuthEndpoints {
|
|
8
|
+
private readonly client;
|
|
9
|
+
users: UserEndpoint;
|
|
10
|
+
constructor(client: Client);
|
|
11
|
+
login(email: string, password: string, applicationId?: string): Promise<ILoginResponse>;
|
|
12
|
+
logout(accessToken: string, refreshToken: string): Promise<void>;
|
|
13
|
+
refresh(refreshToken: string, applicationId: string): Promise<ITokenRefreshResponse>;
|
|
14
|
+
changePassword(password: string, newPassword: string, token: string): Promise<void>;
|
|
15
|
+
signUp(firstName: string, lastName: string, email: string, password: string, applicationId: string, redirectUrl: string): Promise<void>;
|
|
16
|
+
requestPasswordReset(email: string, applicationId: string, redirectUrl: string): Promise<void>;
|
|
17
|
+
resetPassword(email: string, password: string, applicationId: string, token: string): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=auth.edpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.edpoints.d.ts","sourceRoot":"","sources":["../../src/lib/auth.edpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzE,qBAAa,aAAa;IAGZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,KAAK,eAAiC;gBAET,MAAM,EAAE,MAAM;IAE3C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAIvF,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUhE,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIpF,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAanF,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IAYhB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9F,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2018 Emu Analytics
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AuthEndpoints = void 0;
|
|
7
|
+
var user_endpoints_1 = require("./user.endpoints");
|
|
8
|
+
var AuthEndpoints = /** @class */ (function () {
|
|
9
|
+
function AuthEndpoints(client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
this.users = new user_endpoints_1.UserEndpoint(this.client);
|
|
12
|
+
}
|
|
13
|
+
AuthEndpoints.prototype.login = function (email, password, applicationId) {
|
|
14
|
+
return this.client._post('/api/v1/auth/login', { email: email, password: password, applicationId: applicationId });
|
|
15
|
+
};
|
|
16
|
+
AuthEndpoints.prototype.logout = function (accessToken, refreshToken) {
|
|
17
|
+
return this.client._post('/api/v1/auth/logout', { refreshToken: refreshToken }, {
|
|
18
|
+
headers: { Authorization: "Bearer ".concat(accessToken) }
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
AuthEndpoints.prototype.refresh = function (refreshToken, applicationId) {
|
|
22
|
+
return this.client._post('/api/v1/auth/refresh', { refreshToken: refreshToken, applicationId: applicationId });
|
|
23
|
+
};
|
|
24
|
+
AuthEndpoints.prototype.changePassword = function (password, newPassword, token) {
|
|
25
|
+
return this.client._post('/api/v1/auth/changepassword', {
|
|
26
|
+
password: password,
|
|
27
|
+
newPassword: newPassword
|
|
28
|
+
}, {
|
|
29
|
+
headers: { Authorization: "Bearer ".concat(token) }
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
AuthEndpoints.prototype.signUp = function (firstName, lastName, email, password, applicationId, redirectUrl) {
|
|
33
|
+
return this.client._post('/api/v1/auth/signup', {
|
|
34
|
+
firstName: firstName,
|
|
35
|
+
lastName: lastName,
|
|
36
|
+
email: email,
|
|
37
|
+
password: password,
|
|
38
|
+
applicationId: applicationId,
|
|
39
|
+
confirmUrl: "".concat(this.client.baseUrl, "/api/v1/auth/confirmsignup"),
|
|
40
|
+
redirectUrl: redirectUrl
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
AuthEndpoints.prototype.requestPasswordReset = function (email, applicationId, redirectUrl) {
|
|
44
|
+
return this.client._post('/api/v1/auth/requestpasswordreset', { email: email, applicationId: applicationId, redirectUrl: redirectUrl });
|
|
45
|
+
};
|
|
46
|
+
AuthEndpoints.prototype.resetPassword = function (email, password, applicationId, token) {
|
|
47
|
+
return this.client._post('/api/v1/auth/resetpassword', { email: email, password: password, applicationId: applicationId, token: token });
|
|
48
|
+
};
|
|
49
|
+
return AuthEndpoints;
|
|
50
|
+
}());
|
|
51
|
+
exports.AuthEndpoints = AuthEndpoints;
|
|
52
|
+
//# sourceMappingURL=auth.edpoints.js.map
|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B,WAAmB;QAEnB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,EAAE;YAC9C,SAAS,WAAA;YACT,QAAQ,UAAA;YACR,KAAK,OAAA;YACL,QAAQ,UAAA;YACR,aAAa,eAAA;YACb,UAAU,EAAE,UAAG,IAAI,CAAC,MAAM,CAAC,OAAO,+BAA4B;YAC9D,WAAW,aAAA;SACZ,CAAC,CAAC;IACL,CAAC;IAED,4CAAoB,GAApB,UAAqB,KAAa,EAAE,aAAqB,EAAE,WAAmB;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,EAAE,KAAK,OAAA,EAAE,aAAa,eAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;IACvG,CAAC;IAED,qCAAa,GAAb,UAAc,KAAa,EAAE,QAAgB,EAAE,aAAqB,EAAE,KAAa;QACjF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,KAAK,OAAA,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IACpG,CAAC;IACH,oBAAC;AAAD,CAAC,AA9DD,IA8DC;AA9DY,sCAAa","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { UserEndpoint } from './user.endpoints';\nimport { ILoginResponse, ITokenRefreshResponse } from './api-interfaces';\n\nexport class AuthEndpoints {\n users = new UserEndpoint(this.client);\n\n constructor(private readonly client: Client) {}\n\n login(email: string, password: string, applicationId?: string): Promise<ILoginResponse> {\n return this.client._post('/api/v1/auth/login', { email, password, applicationId });\n }\n\n logout(accessToken: string, refreshToken: string): Promise<void> {\n return this.client._post(\n '/api/v1/auth/logout',\n { refreshToken },\n {\n headers: { Authorization: `Bearer ${accessToken}` }\n }\n );\n }\n\n refresh(refreshToken: string, applicationId: string): Promise<ITokenRefreshResponse> {\n return this.client._post('/api/v1/auth/refresh', { refreshToken, applicationId });\n }\n\n changePassword(password: string, newPassword: string, token: string): Promise<void> {\n return this.client._post(\n '/api/v1/auth/changepassword',\n {\n password,\n newPassword\n },\n {\n headers: { Authorization: `Bearer ${token}` }\n }\n );\n }\n\n signUp(\n firstName: string,\n lastName: string,\n email: string,\n password: string,\n applicationId: string,\n redirectUrl: string\n ): Promise<void> {\n return this.client._post('/api/v1/auth/signup', {\n firstName,\n lastName,\n email,\n password,\n applicationId,\n confirmUrl: `${this.client.baseUrl}/api/v1/auth/confirmsignup`,\n redirectUrl\n });\n }\n\n requestPasswordReset(email: string, applicationId: string, redirectUrl: string): Promise<void> {\n return this.client._post('/api/v1/auth/requestpasswordreset', { email, applicationId, redirectUrl });\n }\n\n resetPassword(email: string, password: string, applicationId: string, token: string): Promise<void> {\n return this.client._post('/api/v1/auth/resetpassword', { email, password, applicationId, token });\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2018 Emu Analytics
|
|
3
|
+
*/
|
|
4
|
+
import { Client } from './client';
|
|
5
|
+
import { IBaseResource, IQuery } from './api-interfaces';
|
|
6
|
+
export declare class BaseEndpoints<T extends IBaseResource> {
|
|
7
|
+
protected readonly client: Client;
|
|
8
|
+
private readonly resourcePath;
|
|
9
|
+
constructor(client: Client, resourcePath: string);
|
|
10
|
+
protected get resourceEndpoint(): string;
|
|
11
|
+
list(params?: IQuery): Promise<T[]>;
|
|
12
|
+
get(id: string, params?: Record<string, any>): Promise<T>;
|
|
13
|
+
create(data: Partial<T>, params?: Record<string, any>): Promise<T>;
|
|
14
|
+
update(id: string, data: Partial<T>, params?: Record<string, any>): Promise<T>;
|
|
15
|
+
delete(id: string, params?: Record<string, any>): Promise<any>;
|
|
16
|
+
getMetadata(id: string, key?: string, params?: Record<string, any>): Promise<any>;
|
|
17
|
+
setMetadata(id: string, key: string, value: any, params?: Record<string, any>): Promise<any>;
|
|
18
|
+
deleteMetadata(id: string, key: string, params?: Record<string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AAE,GAAG,CAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAOrF,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAShG,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAQxF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2018 Emu Analytics
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.BaseEndpoints = void 0;
|
|
7
|
+
var BaseEndpoints = /** @class */ (function () {
|
|
8
|
+
function BaseEndpoints(client, resourcePath) {
|
|
9
|
+
this.client = client;
|
|
10
|
+
this.resourcePath = resourcePath;
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(BaseEndpoints.prototype, "resourceEndpoint", {
|
|
13
|
+
get: function () {
|
|
14
|
+
return "/api/v1/".concat(this.resourcePath);
|
|
15
|
+
},
|
|
16
|
+
enumerable: false,
|
|
17
|
+
configurable: true
|
|
18
|
+
});
|
|
19
|
+
BaseEndpoints.prototype.list = function (params) {
|
|
20
|
+
// Reformat filter for query string
|
|
21
|
+
if (params === null || params === void 0 ? void 0 : params.filter) {
|
|
22
|
+
var filter_1 = params.filter;
|
|
23
|
+
Object.keys(filter_1).forEach(function (key) {
|
|
24
|
+
params["filter[".concat(key, "]")] = filter_1[key];
|
|
25
|
+
});
|
|
26
|
+
delete params.filter;
|
|
27
|
+
}
|
|
28
|
+
return this.client._get(this.resourceEndpoint, { params: params });
|
|
29
|
+
};
|
|
30
|
+
BaseEndpoints.prototype.get = function (id, params) {
|
|
31
|
+
if (params === void 0) { params = {}; }
|
|
32
|
+
return this.client._get("".concat(this.resourceEndpoint, "/").concat(id), { params: params });
|
|
33
|
+
};
|
|
34
|
+
BaseEndpoints.prototype.create = function (data, params) {
|
|
35
|
+
if (params === void 0) { params = {}; }
|
|
36
|
+
return this.client._post("".concat(this.resourceEndpoint), data, { params: params });
|
|
37
|
+
};
|
|
38
|
+
BaseEndpoints.prototype.update = function (id, data, params) {
|
|
39
|
+
if (params === void 0) { params = {}; }
|
|
40
|
+
return this.client._put("".concat(this.resourceEndpoint, "/").concat(id), data, { params: params });
|
|
41
|
+
};
|
|
42
|
+
BaseEndpoints.prototype.delete = function (id, params) {
|
|
43
|
+
if (params === void 0) { params = {}; }
|
|
44
|
+
return this.client._delete("".concat(this.resourceEndpoint, "/").concat(id), { params: params });
|
|
45
|
+
};
|
|
46
|
+
BaseEndpoints.prototype.getMetadata = function (id, key, params) {
|
|
47
|
+
if (params === void 0) { params = {}; }
|
|
48
|
+
var endpoint = key
|
|
49
|
+
? "".concat(this.resourceEndpoint, "/").concat(id, "/metadata/").concat(key)
|
|
50
|
+
: "".concat(this.resourceEndpoint, "/").concat(id, "/metadata");
|
|
51
|
+
return this.client._get(endpoint, { params: params });
|
|
52
|
+
};
|
|
53
|
+
BaseEndpoints.prototype.setMetadata = function (id, key, value, params) {
|
|
54
|
+
if (params === void 0) { params = {}; }
|
|
55
|
+
return this.client._put("".concat(this.resourceEndpoint, "/").concat(id, "/metadata/").concat(key), value, {
|
|
56
|
+
headers: {
|
|
57
|
+
'Content-Type': 'application/json'
|
|
58
|
+
},
|
|
59
|
+
params: params
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
BaseEndpoints.prototype.deleteMetadata = function (id, key, params) {
|
|
63
|
+
if (params === void 0) { params = {}; }
|
|
64
|
+
return this.client._delete("".concat(this.resourceEndpoint, "/").concat(id, "/metadata/").concat(key), {
|
|
65
|
+
headers: {
|
|
66
|
+
'Content-Type': 'application/json'
|
|
67
|
+
},
|
|
68
|
+
params: params
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
return BaseEndpoints;
|
|
72
|
+
}());
|
|
73
|
+
exports.BaseEndpoints = BaseEndpoints;
|
|
74
|
+
//# sourceMappingURL=base.endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.endpoints.js","sourceRoot":"","sources":["../../src/lib/base.endpoints.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAKH;IACE,uBAA+B,MAAc,EAAmB,YAAoB;QAArD,WAAM,GAAN,MAAM,CAAQ;QAAmB,iBAAY,GAAZ,YAAY,CAAQ;IAAG,CAAC;IAExF,sBAAc,2CAAgB;aAA9B;YACE,OAAO,kBAAW,IAAI,CAAC,YAAY,CAAE,CAAC;QACxC,CAAC;;;OAAA;IAED,4BAAI,GAAJ,UAAK,MAAe;QAClB,mCAAmC;QACnC,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE;YAClB,IAAM,QAAM,GAAG,MAAM,CAAC,MAAM,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,QAAM,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;gBAC5B,MAAc,CAAC,iBAAU,GAAG,MAAG,CAAC,GAAG,QAAM,CAAC,GAAG,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;YACH,OAAO,MAAM,CAAC,MAAM,CAAC;SACtB;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,2BAAG,GAAH,UAAI,EAAU,EAAE,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,EAAE,CAAE,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IACxE,CAAC;IA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uBAAa,GAAG,CAAE,EAAE,KAAK,EAAE;YAC/E,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,QAAA;SACP,CAAC,CAAC;IACL,CAAC;IAED,sCAAc,GAAd,UAAe,EAAU,EAAE,GAAW,EAAE,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QACtE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,EAAE,uBAAa,GAAG,CAAE,EAAE;YAC3E,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,QAAA;SACP,CAAC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AA5DD,IA4DC;AA5DY,sCAAa","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { IBaseResource, IQuery } from './api-interfaces';\n\nexport class BaseEndpoints<T extends IBaseResource> {\n constructor(protected readonly client: Client, private readonly resourcePath: string) {}\n\n protected get resourceEndpoint(): string {\n return `/api/v1/${this.resourcePath}`;\n }\n\n list(params?: IQuery): Promise<T[]> {\n // Reformat filter for query string\n if (params?.filter) {\n const filter = params.filter;\n Object.keys(filter).forEach(key => {\n (params as any)[`filter[${key}]`] = filter[key];\n });\n delete params.filter;\n }\n\n return this.client._get(this.resourceEndpoint, { params });\n }\n\n get(id: string, params: Record<string, any> = {}): Promise<T> {\n return this.client._get(`${this.resourceEndpoint}/${id}`, { params });\n }\n\n create(data: Partial<T>, params: Record<string, any> = {}): Promise<T> {\n return this.client._post(`${this.resourceEndpoint}`, data, { params });\n }\n\n update(id: string, data: Partial<T>, params: Record<string, any> = {}): Promise<T> {\n return this.client._put(`${this.resourceEndpoint}/${id}`, data, { params });\n }\n\n delete(id: string, params: Record<string, any> = {}) {\n return this.client._delete(`${this.resourceEndpoint}/${id}`, { params });\n }\n\n getMetadata(id: string, key?: string, params: Record<string, any> = {}): Promise<any> {\n const endpoint = key\n ? `${this.resourceEndpoint}/${id}/metadata/${key}`\n : `${this.resourceEndpoint}/${id}/metadata`;\n return this.client._get(endpoint, { params });\n }\n\n setMetadata(id: string, key: string, value: any, params: Record<string, any> = {}): Promise<any> {\n return this.client._put(`${this.resourceEndpoint}/${id}/metadata/${key}`, value, {\n headers: {\n 'Content-Type': 'application/json'\n },\n params\n });\n }\n\n deleteMetadata(id: string, key: string, params: Record<string, any> = {}): Promise<any> {\n return this.client._delete(`${this.resourceEndpoint}/${id}/metadata/${key}`, {\n headers: {\n 'Content-Type': 'application/json'\n },\n params\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2018 Emu Analytics
|
|
3
|
+
*/
|
|
4
|
+
import { AuthEndpoints } from './auth.edpoints';
|
|
5
|
+
import { IConfig } from './api-interfaces';
|
|
6
|
+
import { TileEndpoints } from './tile.endpoints';
|
|
7
|
+
import { StyleEndpoints } from './style.endpoint';
|
|
8
|
+
import { MapEndpoints } from './map.endoints';
|
|
9
|
+
import { ApiKeyEndpoints } from './apikey.endpoints';
|
|
10
|
+
import { ApplicationEndpoints } from './application.endpoints';
|
|
11
|
+
import { DatabaseEndpoints } from './database.endpoints';
|
|
12
|
+
import { DatasetEndpoints } from './dataset.endpoints';
|
|
13
|
+
import { TileSourceEndpoints } from './tile-source.endpoints';
|
|
14
|
+
import { UploadEndpoints } from './upload.endpoints';
|
|
15
|
+
import { AppConfigEndpoints } from './appconfig.endpoints';
|
|
16
|
+
import { JobEndpoints } from './job.endpoints';
|
|
17
|
+
export declare class Client {
|
|
18
|
+
baseUrl: string;
|
|
19
|
+
readonly apiKey: string | null;
|
|
20
|
+
private readonly axios;
|
|
21
|
+
accessToken: string | null;
|
|
22
|
+
auth: AuthEndpoints;
|
|
23
|
+
tiles: TileEndpoints;
|
|
24
|
+
maps: MapEndpoints;
|
|
25
|
+
apiKeys: ApiKeyEndpoints;
|
|
26
|
+
applications: ApplicationEndpoints;
|
|
27
|
+
appconfig: AppConfigEndpoints;
|
|
28
|
+
databases: DatabaseEndpoints;
|
|
29
|
+
datasets: DatasetEndpoints;
|
|
30
|
+
styles: StyleEndpoints;
|
|
31
|
+
tileSources: TileSourceEndpoints;
|
|
32
|
+
uploads: UploadEndpoints;
|
|
33
|
+
jobs: JobEndpoints;
|
|
34
|
+
constructor(baseUrl: string, apiKey?: string | null);
|
|
35
|
+
config(): Promise<IConfig>;
|
|
36
|
+
_get(path: string, options?: any): Promise<any>;
|
|
37
|
+
_post(path: string, data: object, options?: any): Promise<any>;
|
|
38
|
+
_put(path: string, data: object, options?: any): Promise<any>;
|
|
39
|
+
_delete(path: string, options?: any): Promise<any>;
|
|
40
|
+
/**
|
|
41
|
+
* Normalize errors
|
|
42
|
+
* Throws a new error based on type of input error
|
|
43
|
+
*
|
|
44
|
+
* @param {AxiosError} e
|
|
45
|
+
*/
|
|
46
|
+
private handleError;
|
|
47
|
+
private headers;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC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"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2018 Emu Analytics
|
|
4
|
+
*/
|
|
5
|
+
var __assign = (this && this.__assign) || function () {
|
|
6
|
+
__assign = Object.assign || function(t) {
|
|
7
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
+
t[p] = s[p];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
return __assign.apply(this, arguments);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.Client = void 0;
|
|
21
|
+
var axios_1 = __importDefault(require("axios"));
|
|
22
|
+
var errors_1 = require("./errors");
|
|
23
|
+
var auth_edpoints_1 = require("./auth.edpoints");
|
|
24
|
+
var tile_endpoints_1 = require("./tile.endpoints");
|
|
25
|
+
var style_endpoint_1 = require("./style.endpoint");
|
|
26
|
+
var map_endoints_1 = require("./map.endoints");
|
|
27
|
+
var apikey_endpoints_1 = require("./apikey.endpoints");
|
|
28
|
+
var application_endpoints_1 = require("./application.endpoints");
|
|
29
|
+
var database_endpoints_1 = require("./database.endpoints");
|
|
30
|
+
var dataset_endpoints_1 = require("./dataset.endpoints");
|
|
31
|
+
var tile_source_endpoints_1 = require("./tile-source.endpoints");
|
|
32
|
+
var upload_endpoints_1 = require("./upload.endpoints");
|
|
33
|
+
var appconfig_endpoints_1 = require("./appconfig.endpoints");
|
|
34
|
+
var job_endpoints_1 = require("./job.endpoints");
|
|
35
|
+
var Client = /** @class */ (function () {
|
|
36
|
+
function Client(baseUrl, apiKey) {
|
|
37
|
+
if (apiKey === void 0) { apiKey = null; }
|
|
38
|
+
this.baseUrl = baseUrl;
|
|
39
|
+
this.apiKey = apiKey;
|
|
40
|
+
this.accessToken = null;
|
|
41
|
+
this.auth = new auth_edpoints_1.AuthEndpoints(this);
|
|
42
|
+
this.tiles = new tile_endpoints_1.TileEndpoints(this);
|
|
43
|
+
this.maps = new map_endoints_1.MapEndpoints(this);
|
|
44
|
+
this.apiKeys = new apikey_endpoints_1.ApiKeyEndpoints(this);
|
|
45
|
+
this.applications = new application_endpoints_1.ApplicationEndpoints(this);
|
|
46
|
+
this.appconfig = new appconfig_endpoints_1.AppConfigEndpoints(this);
|
|
47
|
+
this.databases = new database_endpoints_1.DatabaseEndpoints(this);
|
|
48
|
+
this.datasets = new dataset_endpoints_1.DatasetEndpoints(this);
|
|
49
|
+
this.styles = new style_endpoint_1.StyleEndpoints(this);
|
|
50
|
+
this.tileSources = new tile_source_endpoints_1.TileSourceEndpoints(this);
|
|
51
|
+
this.uploads = new upload_endpoints_1.UploadEndpoints(this);
|
|
52
|
+
this.jobs = new job_endpoints_1.JobEndpoints(this);
|
|
53
|
+
this.axios = axios_1.default.create({
|
|
54
|
+
baseURL: baseUrl,
|
|
55
|
+
maxContentLength: 524288000
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
Client.prototype.config = function () {
|
|
59
|
+
return this._get('/api/v1/config');
|
|
60
|
+
};
|
|
61
|
+
Client.prototype._get = function (path, options) {
|
|
62
|
+
var _a;
|
|
63
|
+
if (options === void 0) { options = {}; }
|
|
64
|
+
// Move apiKey from params
|
|
65
|
+
if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
|
|
66
|
+
options.apiKey = options.params.apiKey;
|
|
67
|
+
delete options.params.apiKey;
|
|
68
|
+
}
|
|
69
|
+
return this.axios(__assign(__assign({ method: 'get', url: path }, options), this.headers(options)))
|
|
70
|
+
.then(function (res) { return res.data; })
|
|
71
|
+
.catch(this.handleError);
|
|
72
|
+
};
|
|
73
|
+
Client.prototype._post = function (path, data, options) {
|
|
74
|
+
var _a;
|
|
75
|
+
if (options === void 0) { options = {}; }
|
|
76
|
+
// Move apiKey from params
|
|
77
|
+
if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
|
|
78
|
+
options.apiKey = options.params.apiKey;
|
|
79
|
+
delete options.params.apiKey;
|
|
80
|
+
}
|
|
81
|
+
return this.axios(__assign(__assign({ method: 'post', url: path, data: data, maxContentLength: Infinity, maxBodyLength: Infinity }, options), this.headers(options)))
|
|
82
|
+
.then(function (res) { return res.data; })
|
|
83
|
+
.catch(this.handleError);
|
|
84
|
+
};
|
|
85
|
+
Client.prototype._put = function (path, data, options) {
|
|
86
|
+
var _a;
|
|
87
|
+
if (options === void 0) { options = {}; }
|
|
88
|
+
// Move apiKey from params
|
|
89
|
+
if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
|
|
90
|
+
options.apiKey = options.params.apiKey;
|
|
91
|
+
delete options.params.apiKey;
|
|
92
|
+
}
|
|
93
|
+
return this.axios(__assign(__assign({ method: 'put', url: path, data: data }, options), this.headers(options)))
|
|
94
|
+
.then(function (res) { return res.data; })
|
|
95
|
+
.catch(this.handleError);
|
|
96
|
+
};
|
|
97
|
+
Client.prototype._delete = function (path, options) {
|
|
98
|
+
var _a;
|
|
99
|
+
if (options === void 0) { options = {}; }
|
|
100
|
+
// Move apiKey from params
|
|
101
|
+
if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
|
|
102
|
+
options.apiKey = options.params.apiKey;
|
|
103
|
+
delete options.params.apiKey;
|
|
104
|
+
}
|
|
105
|
+
return this.axios(__assign(__assign({ method: 'delete', url: path }, options), this.headers(options)))
|
|
106
|
+
.then(function (res) { return res.data; })
|
|
107
|
+
.catch(this.handleError);
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Normalize errors
|
|
111
|
+
* Throws a new error based on type of input error
|
|
112
|
+
*
|
|
113
|
+
* @param {AxiosError} e
|
|
114
|
+
*/
|
|
115
|
+
Client.prototype.handleError = function (e) {
|
|
116
|
+
// Flow API error
|
|
117
|
+
if (e.response && e.response.data) {
|
|
118
|
+
if (typeof e.response.data === 'object') {
|
|
119
|
+
var data = e.response.data;
|
|
120
|
+
throw new errors_1.FlowEngineError(data.message || data.error, data.error, e.response.status);
|
|
121
|
+
}
|
|
122
|
+
else if (typeof e.response.data === 'string') {
|
|
123
|
+
throw new errors_1.FlowEngineError(e.response.data, null, e.response.status);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Generic error
|
|
127
|
+
// Don't leak information in error
|
|
128
|
+
var cleanError = e;
|
|
129
|
+
delete cleanError.config;
|
|
130
|
+
delete cleanError.request;
|
|
131
|
+
delete cleanError.response;
|
|
132
|
+
throw new errors_1.FlowEngineError(cleanError.message, cleanError);
|
|
133
|
+
};
|
|
134
|
+
Client.prototype.headers = function (options) {
|
|
135
|
+
var headers = options.headers || {};
|
|
136
|
+
if (options.apiKey || this.apiKey) {
|
|
137
|
+
headers['X-Api-Key'] = options.apiKey || this.apiKey;
|
|
138
|
+
}
|
|
139
|
+
// Add default auth header if token supplied and not already set in options
|
|
140
|
+
if (this.accessToken) {
|
|
141
|
+
headers.Authorization = headers.Authorization || "Bearer ".concat(this.accessToken);
|
|
142
|
+
}
|
|
143
|
+
return { headers: headers };
|
|
144
|
+
};
|
|
145
|
+
return Client;
|
|
146
|
+
}());
|
|
147
|
+
exports.Client = Client;
|
|
148
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,gDAAyD;AACzD,mCAA2C;AAC3C,iDAAgD;AAEhD,mDAAiD;AACjD,mDAAkD;AAClD,+CAA8C;AAC9C,uDAAqD;AACrD,iEAA+D;AAC/D,2DAAyD;AACzD,yDAAuD;AACvD,iEAA8D;AAC9D,uDAAqD;AAC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AI,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;aACtF;iBAAM,IAAI,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAC9C,MAAM,IAAI,wBAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;aACrE;SACF;QAED,gBAAgB;QAEhB,kCAAkC;QAClC,IAAM,UAAU,GAAQ,CAAC,CAAC;QAC1B,OAAO,UAAU,CAAC,MAAM,CAAC;QACzB,OAAO,UAAU,CAAC,OAAO,CAAC;QAC1B,OAAO,UAAU,CAAC,QAAQ,CAAC;QAE3B,MAAM,IAAI,wBAAe,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5D,CAAC;IAEO,wBAAO,GAAf,UAAgB,OAAY;QAC1B,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QAEtC,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE;YACjC,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;SACtD;QAED,2EAA2E;QAC3E,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,iBAAU,IAAI,CAAC,WAAW,CAAE,CAAC;SAC/E;QAED,OAAO,EAAE,OAAO,SAAA,EAAE,CAAC;IACrB,CAAC;IACH,aAAC;AAAD,CAAC,AA/ID,IA+IC;AA/IY,wBAAM","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport Axios, { AxiosError, AxiosInstance } from 'axios';\nimport { FlowEngineError } from './errors';\nimport { AuthEndpoints } from './auth.edpoints';\nimport { IConfig } from './api-interfaces';\nimport { TileEndpoints } from './tile.endpoints';\nimport { StyleEndpoints } from './style.endpoint';\nimport { MapEndpoints } from './map.endoints';\nimport { ApiKeyEndpoints } from './apikey.endpoints';\nimport { ApplicationEndpoints } from './application.endpoints';\nimport { DatabaseEndpoints } from './database.endpoints';\nimport { DatasetEndpoints } from './dataset.endpoints';\nimport { TileSourceEndpoints } from './tile-source.endpoints';\nimport { UploadEndpoints } from './upload.endpoints';\nimport { AppConfigEndpoints } from './appconfig.endpoints';\nimport { JobEndpoints } from './job.endpoints';\n\nexport class Client {\n private readonly axios: AxiosInstance;\n\n accessToken: string | null = null;\n\n auth = new AuthEndpoints(this);\n tiles = new TileEndpoints(this);\n maps = new MapEndpoints(this);\n apiKeys = new ApiKeyEndpoints(this);\n applications = new ApplicationEndpoints(this);\n appconfig = new AppConfigEndpoints(this);\n databases = new DatabaseEndpoints(this);\n datasets = new DatasetEndpoints(this);\n styles = new StyleEndpoints(this);\n tileSources = new TileSourceEndpoints(this);\n uploads = new UploadEndpoints(this);\n jobs = new JobEndpoints(this);\n\n constructor(public baseUrl: string, public readonly apiKey: string | null = null) {\n this.axios = Axios.create({\n baseURL: baseUrl,\n maxContentLength: 524288000\n });\n }\n\n config(): Promise<IConfig> {\n return this._get('/api/v1/config');\n }\n\n _get(path: string, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'get',\n url: path,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n _post(path: string, data: object, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'post',\n url: path,\n data,\n maxContentLength: Infinity,\n maxBodyLength: Infinity,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n _put(path: string, data: object, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'put',\n url: path,\n data,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n _delete(path: string, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'delete',\n url: path,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n /**\n * Normalize errors\n * Throws a new error based on type of input error\n *\n * @param {AxiosError} e\n */\n private handleError(e: AxiosError) {\n // Flow API error\n if (e.response && e.response.data) {\n if (typeof e.response.data === 'object') {\n const data: any = e.response.data;\n throw new FlowEngineError(data.message || data.error, data.error, e.response.status);\n } else if (typeof e.response.data === 'string') {\n throw new FlowEngineError(e.response.data, null, e.response.status);\n }\n }\n\n // Generic error\n\n // Don't leak information in error\n const cleanError: any = e;\n delete cleanError.config;\n delete cleanError.request;\n delete cleanError.response;\n\n throw new FlowEngineError(cleanError.message, cleanError);\n }\n\n private headers(options: any) {\n const headers = options.headers || {};\n\n if (options.apiKey || this.apiKey) {\n headers['X-Api-Key'] = options.apiKey || this.apiKey;\n }\n\n // Add default auth header if token supplied and not already set in options\n if (this.accessToken) {\n headers.Authorization = headers.Authorization || `Bearer ${this.accessToken}`;\n }\n\n return { headers };\n }\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2018 Emu Analytics
|
|
3
|
+
*/
|
|
4
|
+
import { Client } from './client';
|
|
5
|
+
import { BaseEndpoints } from './base.endpoints';
|
|
6
|
+
import { IDatabase } from './api-interfaces';
|
|
7
|
+
export declare class DatabaseEndpoints extends BaseEndpoints<IDatabase> {
|
|
8
|
+
constructor(client: Client);
|
|
9
|
+
drivers(): Promise<string[]>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=database.endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.endpoints.d.ts","sourceRoot":"","sources":["../../src/lib/database.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,qBAAa,iBAAkB,SAAQ,aAAa,CAAC,SAAS,CAAC;gBACjD,MAAM,EAAE,MAAM;IAI1B,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAQ7B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2018 Emu Analytics
|
|
4
|
+
*/
|
|
5
|
+
var __extends = (this && this.__extends) || (function () {
|
|
6
|
+
var extendStatics = function (d, b) {
|
|
7
|
+
extendStatics = Object.setPrototypeOf ||
|
|
8
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
9
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
10
|
+
return extendStatics(d, b);
|
|
11
|
+
};
|
|
12
|
+
return function (d, b) {
|
|
13
|
+
if (typeof b !== "function" && b !== null)
|
|
14
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
15
|
+
extendStatics(d, b);
|
|
16
|
+
function __() { this.constructor = d; }
|
|
17
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.DatabaseEndpoints = void 0;
|
|
22
|
+
var base_endpoints_1 = require("./base.endpoints");
|
|
23
|
+
var DatabaseEndpoints = /** @class */ (function (_super) {
|
|
24
|
+
__extends(DatabaseEndpoints, _super);
|
|
25
|
+
function DatabaseEndpoints(client) {
|
|
26
|
+
return _super.call(this, client, 'databases') || this;
|
|
27
|
+
}
|
|
28
|
+
DatabaseEndpoints.prototype.drivers = function () {
|
|
29
|
+
return this.client._get("/api/v1/databases/drivers").catch(function (e) {
|
|
30
|
+
if (e.status === 404) {
|
|
31
|
+
// Backwards compatibility for pre-1.0.0 Flo.w
|
|
32
|
+
return ['postgis', 'postgis-mapnik'];
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return DatabaseEndpoints;
|
|
37
|
+
}(base_endpoints_1.BaseEndpoints));
|
|
38
|
+
exports.DatabaseEndpoints = DatabaseEndpoints;
|
|
39
|
+
//# sourceMappingURL=database.endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.endpoints.js","sourceRoot":"","sources":["../../src/lib/database.endpoints.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;AAGH,mDAAiD;AAGjD;IAAuC,qCAAwB;IAC7D,2BAAY,MAAc;eACxB,kBAAM,MAAM,EAAE,WAAW,CAAC;IAC5B,CAAC;IAED,mCAAO,GAAP;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,KAAK,CAAC,UAAA,CAAC;YAC1D,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE;gBACpB,8CAA8C;gBAC9C,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;aACtC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACH,wBAAC;AAAD,CAAC,AAbD,CAAuC,8BAAa,GAanD;AAbY,8CAAiB","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { BaseEndpoints } from './base.endpoints';\nimport { IDatabase } from './api-interfaces';\n\nexport class DatabaseEndpoints extends BaseEndpoints<IDatabase> {\n constructor(client: Client) {\n super(client, 'databases');\n }\n\n drivers(): Promise<string[]> {\n return this.client._get(`/api/v1/databases/drivers`).catch(e => {\n if (e.status === 404) {\n // Backwards compatibility for pre-1.0.0 Flo.w\n return ['postgis', 'postgis-mapnik'];\n }\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2018 Emu Analytics
|
|
3
|
+
*/
|
|
4
|
+
import { Client } from './client';
|
|
5
|
+
import { BaseEndpoints } from './base.endpoints';
|
|
6
|
+
import { IDataset, FileExportFormat } from './api-interfaces';
|
|
7
|
+
export interface DatasetQuery {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
declare type QueryOutputFormat = 'plain' | 'json' | 'csv' | 'geojson';
|
|
11
|
+
export interface DatasetQueryOptions {
|
|
12
|
+
[param: string]: any;
|
|
13
|
+
format?: QueryOutputFormat;
|
|
14
|
+
explain?: boolean | string;
|
|
15
|
+
}
|
|
16
|
+
export declare class DatasetEndpoints extends BaseEndpoints<IDataset> {
|
|
17
|
+
constructor(client: Client);
|
|
18
|
+
query(datasetId: string | DatasetQuery, query?: DatasetQuery, params?: DatasetQueryOptions | QueryOutputFormat): Promise<any>;
|
|
19
|
+
getExportUrl(datasetId: string, format: FileExportFormat): string;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=dataset.endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataset.endpoints.d.ts","sourceRoot":"","sources":["../../src/lib/dataset.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG9D,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,aAAK,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,qBAAa,gBAAiB,SAAQ,aAAa,CAAC,QAAQ,CAAC;gBAC/C,MAAM,EAAE,MAAM;IAI1B,KAAK,CACH,SAAS,EAAE,MAAM,GAAG,YAAY,EAChC,KAAK,GAAE,YAAiB,EACxB,MAAM,GAAE,mBAAmB,GAAG,iBAAsB,GACnD,OAAO,CAAC,GAAG,CAAC;IA+Bf,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,MAAM;CAMlE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright © 2018 Emu Analytics
|
|
4
|
+
*/
|
|
5
|
+
var __extends = (this && this.__extends) || (function () {
|
|
6
|
+
var extendStatics = function (d, b) {
|
|
7
|
+
extendStatics = Object.setPrototypeOf ||
|
|
8
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
9
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
10
|
+
return extendStatics(d, b);
|
|
11
|
+
};
|
|
12
|
+
return function (d, b) {
|
|
13
|
+
if (typeof b !== "function" && b !== null)
|
|
14
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
15
|
+
extendStatics(d, b);
|
|
16
|
+
function __() { this.constructor = d; }
|
|
17
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
var __assign = (this && this.__assign) || function () {
|
|
21
|
+
__assign = Object.assign || function(t) {
|
|
22
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
23
|
+
s = arguments[i];
|
|
24
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
25
|
+
t[p] = s[p];
|
|
26
|
+
}
|
|
27
|
+
return t;
|
|
28
|
+
};
|
|
29
|
+
return __assign.apply(this, arguments);
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.DatasetEndpoints = void 0;
|
|
33
|
+
var base_endpoints_1 = require("./base.endpoints");
|
|
34
|
+
var DatasetEndpoints = /** @class */ (function (_super) {
|
|
35
|
+
__extends(DatasetEndpoints, _super);
|
|
36
|
+
function DatasetEndpoints(client) {
|
|
37
|
+
return _super.call(this, client, 'datasets') || this;
|
|
38
|
+
}
|
|
39
|
+
DatasetEndpoints.prototype.query = function (datasetId, query, params) {
|
|
40
|
+
if (query === void 0) { query = {}; }
|
|
41
|
+
if (params === void 0) { params = {}; }
|
|
42
|
+
// Support Flo.w RDF-style query definition
|
|
43
|
+
if (typeof datasetId === 'object') {
|
|
44
|
+
params = __assign(__assign({}, datasetId.params), { format: datasetId.format || 'json' });
|
|
45
|
+
query = datasetId;
|
|
46
|
+
datasetId = query.datasetId;
|
|
47
|
+
delete query.datasetId;
|
|
48
|
+
delete query.format;
|
|
49
|
+
}
|
|
50
|
+
if (typeof params === 'string') {
|
|
51
|
+
params = { format: params };
|
|
52
|
+
}
|
|
53
|
+
return this.client
|
|
54
|
+
._post("/api/v1/datasets/".concat(datasetId, "/query"), query, {
|
|
55
|
+
params: __assign(__assign({}, params), { format: params.format || 'json', explain: params.explain || false })
|
|
56
|
+
})
|
|
57
|
+
.catch(function (e) {
|
|
58
|
+
if (e.message === 'Network Error') {
|
|
59
|
+
throw new Error('Query timed out');
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw e;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
DatasetEndpoints.prototype.getExportUrl = function (datasetId, format) {
|
|
67
|
+
var credentials = this.client.accessToken
|
|
68
|
+
? "accesstoken=".concat(this.client.accessToken)
|
|
69
|
+
: "apikey=".concat(this.client.apiKey);
|
|
70
|
+
return "".concat(this.client.baseUrl, "/api/v1/datasets/").concat(datasetId, "/export?format=").concat(format, "&").concat(credentials);
|
|
71
|
+
};
|
|
72
|
+
return DatasetEndpoints;
|
|
73
|
+
}(base_endpoints_1.BaseEndpoints));
|
|
74
|
+
exports.DatasetEndpoints = DatasetEndpoints;
|
|
75
|
+
//# sourceMappingURL=dataset.endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataset.endpoints.js","sourceRoot":"","sources":["../../src/lib/dataset.endpoints.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,mDAAiD;AAgBjD;IAAsC,oCAAuB;IAC3D,0BAAY,MAAc;eACxB,kBAAM,MAAM,EAAE,UAAU,CAAC;IAC3B,CAAC;IAED,gCAAK,GAAL,UACE,SAAgC,EAChC,KAAwB,EACxB,MAAoD;QADpD,sBAAA,EAAA,UAAwB;QACxB,uBAAA,EAAA,WAAoD;QAEpD,2CAA2C;QAC3C,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACjC,MAAM,yBAAQ,SAAS,CAAC,MAAM,KAAE,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,MAAM,GAAE,CAAC;YACrE,KAAK,GAAG,SAAS,CAAC;YAClB,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;YAC5B,OAAO,KAAK,CAAC,SAAS,CAAC;YACvB,OAAO,KAAK,CAAC,MAAM,CAAC;SACrB;QAED,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,MAAM,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;SAC7B;QAED,OAAO,IAAI,CAAC,MAAM;aACf,KAAK,CAAC,2BAAoB,SAAS,WAAQ,EAAE,KAAK,EAAE;YACnD,MAAM,wBACD,MAAM,KACT,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM,EAC/B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK,GACjC;SACF,CAAC;aACD,KAAK,CAAC,UAAA,CAAC;YACN,IAAI,CAAC,CAAC,OAAO,KAAK,eAAe,EAAE;gBACjC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;aACpC;iBAAM;gBACL,MAAM,CAAC,CAAC;aACT;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,uCAAY,GAAZ,UAAa,SAAiB,EAAE,MAAwB;QACtD,IAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW;YACzC,CAAC,CAAC,sBAAe,IAAI,CAAC,MAAM,CAAC,WAAW,CAAE;YAC1C,CAAC,CAAC,iBAAU,IAAI,CAAC,MAAM,CAAC,MAAM,CAAE,CAAC;QACnC,OAAO,UAAG,IAAI,CAAC,MAAM,CAAC,OAAO,8BAAoB,SAAS,4BAAkB,MAAM,cAAI,WAAW,CAAE,CAAC;IACtG,CAAC;IACH,uBAAC;AAAD,CAAC,AA9CD,CAAsC,8BAAa,GA8ClD;AA9CY,4CAAgB","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { BaseEndpoints } from './base.endpoints';\nimport { IDataset, FileExportFormat } from './api-interfaces';\nimport { type } from 'os';\n\nexport interface DatasetQuery {\n [key: string]: any;\n}\n\ntype QueryOutputFormat = 'plain' | 'json' | 'csv' | 'geojson';\n\nexport interface DatasetQueryOptions {\n [param: string]: any;\n format?: QueryOutputFormat;\n explain?: boolean | string;\n}\n\nexport class DatasetEndpoints extends BaseEndpoints<IDataset> {\n constructor(client: Client) {\n super(client, 'datasets');\n }\n\n query(\n datasetId: string | DatasetQuery,\n query: DatasetQuery = {},\n params: DatasetQueryOptions | QueryOutputFormat = {}\n ): Promise<any> {\n // Support Flo.w RDF-style query definition\n if (typeof datasetId === 'object') {\n params = { ...datasetId.params, format: datasetId.format || 'json' };\n query = datasetId;\n datasetId = query.datasetId;\n delete query.datasetId;\n delete query.format;\n }\n\n if (typeof params === 'string') {\n params = { format: params };\n }\n\n return this.client\n ._post(`/api/v1/datasets/${datasetId}/query`, query, {\n params: {\n ...params,\n format: params.format || 'json',\n explain: params.explain || false\n }\n })\n .catch(e => {\n if (e.message === 'Network Error') {\n throw new Error('Query timed out');\n } else {\n throw e;\n }\n });\n }\n\n getExportUrl(datasetId: string, format: FileExportFormat): string {\n const credentials = this.client.accessToken\n ? `accesstoken=${this.client.accessToken}`\n : `apikey=${this.client.apiKey}`;\n return `${this.client.baseUrl}/api/v1/datasets/${datasetId}/export?format=${format}&${credentials}`;\n }\n}\n"]}
|