@emuanalytics/flow-engine-client 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +9 -3
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +668 -0
- package/dist/index.d.mts +668 -0
- package/dist/index.d.ts +668 -0
- package/dist/index.mjs +1 -0
- package/package.json +33 -40
- package/dist/bundle.js.map +0 -7
- package/dist/cjs/index.js +0 -25
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/lib/__mocks__/client.js +0 -57
- package/dist/cjs/lib/__mocks__/client.js.map +0 -1
- package/dist/cjs/lib/api-interfaces.js +0 -6
- package/dist/cjs/lib/api-interfaces.js.map +0 -1
- package/dist/cjs/lib/apikey.endpoints.js +0 -31
- package/dist/cjs/lib/apikey.endpoints.js.map +0 -1
- package/dist/cjs/lib/appconfig.endpoints.js +0 -49
- package/dist/cjs/lib/appconfig.endpoints.js.map +0 -1
- package/dist/cjs/lib/application.endpoints.js +0 -31
- package/dist/cjs/lib/application.endpoints.js.map +0 -1
- package/dist/cjs/lib/auth.edpoints.js +0 -60
- package/dist/cjs/lib/auth.edpoints.js.map +0 -1
- package/dist/cjs/lib/base.endpoints.js +0 -78
- package/dist/cjs/lib/base.endpoints.js.map +0 -1
- package/dist/cjs/lib/client.js +0 -198
- package/dist/cjs/lib/client.js.map +0 -1
- package/dist/cjs/lib/contact-point.endpoints.js +0 -46
- package/dist/cjs/lib/contact-point.endpoints.js.map +0 -1
- package/dist/cjs/lib/database.endpoints.js +0 -39
- package/dist/cjs/lib/database.endpoints.js.map +0 -1
- package/dist/cjs/lib/dataset.endpoints.js +0 -88
- package/dist/cjs/lib/dataset.endpoints.js.map +0 -1
- package/dist/cjs/lib/errors.js +0 -36
- package/dist/cjs/lib/errors.js.map +0 -1
- package/dist/cjs/lib/job.endpoints.js +0 -46
- package/dist/cjs/lib/job.endpoints.js.map +0 -1
- package/dist/cjs/lib/map.endoints.js +0 -18
- package/dist/cjs/lib/map.endoints.js.map +0 -1
- package/dist/cjs/lib/maplayer.endpoints.js +0 -34
- package/dist/cjs/lib/maplayer.endpoints.js.map +0 -1
- package/dist/cjs/lib/media.endpoints.js +0 -106
- package/dist/cjs/lib/media.endpoints.js.map +0 -1
- package/dist/cjs/lib/pipeline-component.endpoints.js +0 -37
- package/dist/cjs/lib/pipeline-component.endpoints.js.map +0 -1
- package/dist/cjs/lib/pipeline-metric.endpoint.js +0 -31
- package/dist/cjs/lib/pipeline-metric.endpoint.js.map +0 -1
- package/dist/cjs/lib/pipeline.endpoints.js +0 -87
- package/dist/cjs/lib/pipeline.endpoints.js.map +0 -1
- package/dist/cjs/lib/style.endpoint.js +0 -31
- package/dist/cjs/lib/style.endpoint.js.map +0 -1
- package/dist/cjs/lib/tile-source.endpoints.js +0 -39
- package/dist/cjs/lib/tile-source.endpoints.js.map +0 -1
- package/dist/cjs/lib/tile.endpoints.js +0 -22
- package/dist/cjs/lib/tile.endpoints.js.map +0 -1
- package/dist/cjs/lib/upload.endpoints.js +0 -121
- package/dist/cjs/lib/upload.endpoints.js.map +0 -1
- package/dist/cjs/lib/user.endpoints.js +0 -36
- package/dist/cjs/lib/user.endpoints.js.map +0 -1
- package/dist/cjs/lib/web-socket-gateway.js +0 -160
- package/dist/cjs/lib/web-socket-gateway.js.map +0 -1
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/lib/__mocks__/client.js +0 -54
- package/dist/esm/lib/__mocks__/client.js.map +0 -1
- package/dist/esm/lib/api-interfaces.js +0 -5
- package/dist/esm/lib/api-interfaces.js.map +0 -1
- package/dist/esm/lib/apikey.endpoints.js +0 -28
- package/dist/esm/lib/apikey.endpoints.js.map +0 -1
- package/dist/esm/lib/appconfig.endpoints.js +0 -46
- package/dist/esm/lib/appconfig.endpoints.js.map +0 -1
- package/dist/esm/lib/application.endpoints.js +0 -28
- package/dist/esm/lib/application.endpoints.js.map +0 -1
- package/dist/esm/lib/auth.edpoints.js +0 -57
- package/dist/esm/lib/auth.edpoints.js.map +0 -1
- package/dist/esm/lib/base.endpoints.js +0 -75
- package/dist/esm/lib/base.endpoints.js.map +0 -1
- package/dist/esm/lib/client.js +0 -192
- package/dist/esm/lib/client.js.map +0 -1
- package/dist/esm/lib/contact-point.endpoints.js +0 -43
- package/dist/esm/lib/contact-point.endpoints.js.map +0 -1
- package/dist/esm/lib/database.endpoints.js +0 -36
- package/dist/esm/lib/database.endpoints.js.map +0 -1
- package/dist/esm/lib/dataset.endpoints.js +0 -85
- package/dist/esm/lib/dataset.endpoints.js.map +0 -1
- package/dist/esm/lib/errors.js +0 -33
- package/dist/esm/lib/errors.js.map +0 -1
- package/dist/esm/lib/job.endpoints.js +0 -43
- package/dist/esm/lib/job.endpoints.js.map +0 -1
- package/dist/esm/lib/map.endoints.js +0 -15
- package/dist/esm/lib/map.endoints.js.map +0 -1
- package/dist/esm/lib/maplayer.endpoints.js +0 -31
- package/dist/esm/lib/maplayer.endpoints.js.map +0 -1
- package/dist/esm/lib/media.endpoints.js +0 -100
- package/dist/esm/lib/media.endpoints.js.map +0 -1
- package/dist/esm/lib/pipeline-component.endpoints.js +0 -34
- package/dist/esm/lib/pipeline-component.endpoints.js.map +0 -1
- package/dist/esm/lib/pipeline-metric.endpoint.js +0 -28
- package/dist/esm/lib/pipeline-metric.endpoint.js.map +0 -1
- package/dist/esm/lib/pipeline.endpoints.js +0 -84
- package/dist/esm/lib/pipeline.endpoints.js.map +0 -1
- package/dist/esm/lib/style.endpoint.js +0 -28
- package/dist/esm/lib/style.endpoint.js.map +0 -1
- package/dist/esm/lib/tile-source.endpoints.js +0 -36
- package/dist/esm/lib/tile-source.endpoints.js.map +0 -1
- package/dist/esm/lib/tile.endpoints.js +0 -19
- package/dist/esm/lib/tile.endpoints.js.map +0 -1
- package/dist/esm/lib/upload.endpoints.js +0 -115
- package/dist/esm/lib/upload.endpoints.js.map +0 -1
- package/dist/esm/lib/user.endpoints.js +0 -33
- package/dist/esm/lib/user.endpoints.js.map +0 -1
- package/dist/esm/lib/web-socket-gateway.js +0 -157
- package/dist/esm/lib/web-socket-gateway.js.map +0 -1
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/__mocks__/client.d.ts +0 -3
- package/dist/types/lib/__mocks__/client.d.ts.map +0 -1
- package/dist/types/lib/api-interfaces.d.ts +0 -314
- package/dist/types/lib/api-interfaces.d.ts.map +0 -1
- package/dist/types/lib/apikey.endpoints.d.ts +0 -10
- package/dist/types/lib/apikey.endpoints.d.ts.map +0 -1
- package/dist/types/lib/appconfig.endpoints.d.ts +0 -15
- package/dist/types/lib/appconfig.endpoints.d.ts.map +0 -1
- package/dist/types/lib/application.endpoints.d.ts +0 -10
- package/dist/types/lib/application.endpoints.d.ts.map +0 -1
- package/dist/types/lib/auth.edpoints.d.ts +0 -20
- package/dist/types/lib/auth.edpoints.d.ts.map +0 -1
- package/dist/types/lib/base.endpoints.d.ts +0 -20
- package/dist/types/lib/base.endpoints.d.ts.map +0 -1
- package/dist/types/lib/client.d.ts +0 -68
- package/dist/types/lib/client.d.ts.map +0 -1
- package/dist/types/lib/contact-point.endpoints.d.ts +0 -20
- package/dist/types/lib/contact-point.endpoints.d.ts.map +0 -1
- package/dist/types/lib/database.endpoints.d.ts +0 -11
- package/dist/types/lib/database.endpoints.d.ts.map +0 -1
- package/dist/types/lib/dataset.endpoints.d.ts +0 -26
- package/dist/types/lib/dataset.endpoints.d.ts.map +0 -1
- package/dist/types/lib/errors.d.ts +0 -9
- package/dist/types/lib/errors.d.ts.map +0 -1
- package/dist/types/lib/job.endpoints.d.ts +0 -15
- package/dist/types/lib/job.endpoints.d.ts.map +0 -1
- package/dist/types/lib/map.endoints.d.ts +0 -11
- package/dist/types/lib/map.endoints.d.ts.map +0 -1
- package/dist/types/lib/maplayer.endpoints.d.ts +0 -12
- package/dist/types/lib/maplayer.endpoints.d.ts.map +0 -1
- package/dist/types/lib/media.endpoints.d.ts +0 -20
- package/dist/types/lib/media.endpoints.d.ts.map +0 -1
- package/dist/types/lib/pipeline-component.endpoints.d.ts +0 -13
- package/dist/types/lib/pipeline-component.endpoints.d.ts.map +0 -1
- package/dist/types/lib/pipeline-metric.endpoint.d.ts +0 -10
- package/dist/types/lib/pipeline-metric.endpoint.d.ts.map +0 -1
- package/dist/types/lib/pipeline.endpoints.d.ts +0 -14
- package/dist/types/lib/pipeline.endpoints.d.ts.map +0 -1
- package/dist/types/lib/style.endpoint.d.ts +0 -10
- package/dist/types/lib/style.endpoint.d.ts.map +0 -1
- package/dist/types/lib/tile-source.endpoints.d.ts +0 -11
- package/dist/types/lib/tile-source.endpoints.d.ts.map +0 -1
- package/dist/types/lib/tile.endpoints.d.ts +0 -12
- package/dist/types/lib/tile.endpoints.d.ts.map +0 -1
- package/dist/types/lib/upload.endpoints.d.ts +0 -22
- package/dist/types/lib/upload.endpoints.d.ts.map +0 -1
- package/dist/types/lib/user.endpoints.d.ts +0 -11
- package/dist/types/lib/user.endpoints.d.ts.map +0 -1
- package/dist/types/lib/web-socket-gateway.d.ts +0 -42
- package/dist/types/lib/web-socket-gateway.d.ts.map +0 -1
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
27
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
-
function step(op) {
|
|
30
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
-
switch (op[0]) {
|
|
35
|
-
case 0: case 1: t = op; break;
|
|
36
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
-
default:
|
|
40
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
-
if (t[2]) _.ops.pop();
|
|
45
|
-
_.trys.pop(); continue;
|
|
46
|
-
}
|
|
47
|
-
op = body.call(thisArg, _);
|
|
48
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Copyright © 2018 Emu Analytics
|
|
54
|
-
*/
|
|
55
|
-
import FormData from 'form-data';
|
|
56
|
-
import { BaseEndpoints } from './base.endpoints';
|
|
57
|
-
var UploadEndpoints = /** @class */ (function (_super) {
|
|
58
|
-
__extends(UploadEndpoints, _super);
|
|
59
|
-
function UploadEndpoints(client) {
|
|
60
|
-
return _super.call(this, client, 'uploads') || this;
|
|
61
|
-
}
|
|
62
|
-
UploadEndpoints.prototype.upload = function (options_1) {
|
|
63
|
-
return __awaiter(this, arguments, void 0, function (options, params) {
|
|
64
|
-
var form, upload;
|
|
65
|
-
var _a, _b, _c;
|
|
66
|
-
if (params === void 0) { params = {}; }
|
|
67
|
-
return __generator(this, function (_d) {
|
|
68
|
-
switch (_d.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
form = new FormData();
|
|
71
|
-
if (options.datasetName) {
|
|
72
|
-
form.append('name', options.datasetName);
|
|
73
|
-
}
|
|
74
|
-
if (options.datasetDescription) {
|
|
75
|
-
form.append('description', options.datasetDescription);
|
|
76
|
-
}
|
|
77
|
-
if (options.attribution) {
|
|
78
|
-
form.append('attribution', options.attribution);
|
|
79
|
-
}
|
|
80
|
-
if (options.datasetId) {
|
|
81
|
-
form.append('datasetId', options.datasetId);
|
|
82
|
-
}
|
|
83
|
-
if (options.sourceSrid) {
|
|
84
|
-
form.append('sourceSrid', options.sourceSrid);
|
|
85
|
-
}
|
|
86
|
-
if (options.targetSrid) {
|
|
87
|
-
form.append('targetSrid', options.targetSrid);
|
|
88
|
-
}
|
|
89
|
-
if (options.schema) {
|
|
90
|
-
form.append('schema', options.schema);
|
|
91
|
-
}
|
|
92
|
-
if (options.metadata) {
|
|
93
|
-
form.append('metadata', JSON.stringify(options.metadata));
|
|
94
|
-
}
|
|
95
|
-
form.append('file', options.data, options.filename);
|
|
96
|
-
return [4 /*yield*/, this.client._post(this.resourceEndpoint, form, {
|
|
97
|
-
// Note - only Node FormData supports getHeaders
|
|
98
|
-
headers: (_b = (_a = form.getHeaders) === null || _a === void 0 ? void 0 : _a.call(form)) !== null && _b !== void 0 ? _b : { 'Content-Type': 'multipart/form-data' },
|
|
99
|
-
// Add abort signal
|
|
100
|
-
signal: (_c = options.abortController) === null || _c === void 0 ? void 0 : _c.signal,
|
|
101
|
-
params: params,
|
|
102
|
-
// Note that progress only works in the browser!!
|
|
103
|
-
onUploadProgress: options.progress
|
|
104
|
-
})];
|
|
105
|
-
case 1:
|
|
106
|
-
upload = _d.sent();
|
|
107
|
-
return [2 /*return*/, upload];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
return UploadEndpoints;
|
|
113
|
-
}(BaseEndpoints));
|
|
114
|
-
export { UploadEndpoints };
|
|
115
|
-
//# sourceMappingURL=upload.endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.endpoints.js","sourceRoot":"","sources":["../../../src/lib/upload.endpoints.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAA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BACD,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;4BACrB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;wBAC5D,CAAC;wBACD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;wBAE5B,qBAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE;gCAC3E,gDAAgD;gCAChD,OAAO,EAAE,MAAA,MAAA,IAAI,CAAC,UAAU,oDAAI,mCAAI,EAAE,cAAc,EAAE,qBAAqB,EAAE;gCACzE,mBAAmB;gCACnB,MAAM,EAAE,MAAA,OAAO,CAAC,eAAe,0CAAE,MAAM;gCACvC,MAAM,QAAA;gCACN,iDAAiD;gCACjD,gBAAgB,EAAE,OAAO,CAAC,QAAQ;6BACnC,CAAC,EAAA;;wBARI,MAAM,GAAY,SAQtB;wBAEF,sBAAO,MAAM,EAAC;;;;KACf;IACH,sBAAC;AAAD,CAAC,AA7CD,CAAqC,aAAa,GA6CjD","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\nimport FormData from 'form-data';\nimport { IUpload } from './api-interfaces';\nimport { BaseEndpoints } from './base.endpoints';\nimport { Client } from './client';\n\ndeclare var process: any;\n\nexport interface UploadOptions {\n data: any;\n filename: string;\n datasetId?: string;\n datasetName?: string;\n datasetDescription?: string;\n attribution?: string;\n sourceSrid?: number;\n targetSrid?: number;\n schema?: string;\n metadata?: any;\n abortController?: AbortController;\n progress?: (event: any) => void;\n}\n\nexport class UploadEndpoints extends BaseEndpoints<IUpload> {\n constructor(client: Client) {\n super(client, 'uploads');\n }\n\n async upload(options: UploadOptions, params: Record<string, any> = {}): Promise<IUpload> {\n const form = new FormData();\n if (options.datasetName) {\n form.append('name', options.datasetName);\n }\n if (options.datasetDescription) {\n form.append('description', options.datasetDescription);\n }\n if (options.attribution) {\n form.append('attribution', options.attribution);\n }\n if (options.datasetId) {\n form.append('datasetId', options.datasetId);\n }\n if (options.sourceSrid) {\n form.append('sourceSrid', options.sourceSrid);\n }\n if (options.targetSrid) {\n form.append('targetSrid', options.targetSrid);\n }\n if (options.schema) {\n form.append('schema', options.schema);\n }\n if (options.metadata) {\n form.append('metadata', JSON.stringify(options.metadata));\n }\n form.append('file', options.data, options.filename);\n\n const upload: IUpload = await this.client._post(this.resourceEndpoint, form, {\n // Note - only Node FormData supports getHeaders\n headers: form.getHeaders?.() ?? { 'Content-Type': 'multipart/form-data' },\n // Add abort signal\n signal: options.abortController?.signal,\n params,\n // Note that progress only works in the browser!!\n onUploadProgress: options.progress\n });\n\n return upload;\n }\n}\n"]}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2018 Emu Analytics
|
|
3
|
-
*/
|
|
4
|
-
var __extends = (this && this.__extends) || (function () {
|
|
5
|
-
var extendStatics = function (d, b) {
|
|
6
|
-
extendStatics = Object.setPrototypeOf ||
|
|
7
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
-
return extendStatics(d, b);
|
|
10
|
-
};
|
|
11
|
-
return function (d, b) {
|
|
12
|
-
if (typeof b !== "function" && b !== null)
|
|
13
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
-
extendStatics(d, b);
|
|
15
|
-
function __() { this.constructor = d; }
|
|
16
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
-
};
|
|
18
|
-
})();
|
|
19
|
-
import { BaseEndpoints } from './base.endpoints';
|
|
20
|
-
var UserEndpoint = /** @class */ (function (_super) {
|
|
21
|
-
__extends(UserEndpoint, _super);
|
|
22
|
-
function UserEndpoint(client) {
|
|
23
|
-
return _super.call(this, client, 'auth/users') || this;
|
|
24
|
-
}
|
|
25
|
-
UserEndpoint.prototype.me = function (token) {
|
|
26
|
-
return this.client._get("".concat(this.resourceEndpoint, "/me"), {
|
|
27
|
-
headers: { Authorization: "Bearer ".concat(token) }
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
return UserEndpoint;
|
|
31
|
-
}(BaseEndpoints));
|
|
32
|
-
export { UserEndpoint };
|
|
33
|
-
//# sourceMappingURL=user.endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.endpoints.js","sourceRoot":"","sources":["../../../src/lib/user.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;IAAkC,gCAAoB;IACpD,sBAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,YAAY,CAAC,SAAC;IAC9B,CAAC;IAED,yBAAE,GAAF,UAAG,KAAa;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAG,IAAI,CAAC,gBAAgB,QAAK,EAAE;YACrD,OAAO,EAAE,EAAE,aAAa,EAAE,iBAAU,KAAK,CAAE,EAAE;SAC9C,CAAC,CAAC;IACL,CAAC;IACH,mBAAC;AAAD,CAAC,AAVD,CAAkC,aAAa,GAU9C","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { IUser, UsersMeResponse } from './api-interfaces';\nimport { BaseEndpoints } from './base.endpoints';\n\nexport class UserEndpoint extends BaseEndpoints<IUser> {\n constructor(client: Client) {\n super(client, 'auth/users');\n }\n\n me(token: string): Promise<UsersMeResponse> {\n return this.client._get(`${this.resourceEndpoint}/me`, {\n headers: { Authorization: `Bearer ${token}` }\n });\n }\n}\n"]}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { io } from 'socket.io-client';
|
|
13
|
-
export var WebSocketChannel;
|
|
14
|
-
(function (WebSocketChannel) {
|
|
15
|
-
WebSocketChannel["System"] = "system";
|
|
16
|
-
WebSocketChannel["AppConfig"] = "appconfig";
|
|
17
|
-
WebSocketChannel["Dataset"] = "dataset/";
|
|
18
|
-
})(WebSocketChannel || (WebSocketChannel = {}));
|
|
19
|
-
var WebSocketGateway = /** @class */ (function () {
|
|
20
|
-
function WebSocketGateway(client, options) {
|
|
21
|
-
this.client = client;
|
|
22
|
-
this.options = options;
|
|
23
|
-
this.connected = false;
|
|
24
|
-
this.subscribedChannels = new Set();
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(WebSocketGateway.prototype, "isConnected", {
|
|
27
|
-
get: function () {
|
|
28
|
-
return this.connected;
|
|
29
|
-
},
|
|
30
|
-
enumerable: false,
|
|
31
|
-
configurable: true
|
|
32
|
-
});
|
|
33
|
-
WebSocketGateway.prototype.connect = function () {
|
|
34
|
-
var _this = this;
|
|
35
|
-
if (this.isConnected) {
|
|
36
|
-
return Promise.resolve();
|
|
37
|
-
}
|
|
38
|
-
return new Promise(function (resolve, reject) {
|
|
39
|
-
var socket = io(_this.client.baseUrl, __assign(__assign({}, _this.options), { autoConnect: false, auth: function (cb) {
|
|
40
|
-
var authHeaders = {};
|
|
41
|
-
if (_this.client.apiKey) {
|
|
42
|
-
authHeaders['x-api-key'] = _this.client.apiKey;
|
|
43
|
-
}
|
|
44
|
-
if (_this.client.accessToken) {
|
|
45
|
-
authHeaders['x-socket-token'] = "Bearer ".concat(_this.client.accessToken);
|
|
46
|
-
}
|
|
47
|
-
cb(authHeaders);
|
|
48
|
-
} }));
|
|
49
|
-
socket.on('connect', function () {
|
|
50
|
-
_this.client.debug("Socket connected: ".concat(socket.id));
|
|
51
|
-
if (_this.subscribedChannels.size) {
|
|
52
|
-
_this.subscribedChannels.forEach(function (channel) {
|
|
53
|
-
socket.emit('subscribe', { channel: channel }, function (resp) {
|
|
54
|
-
if (resp.status === 'error') {
|
|
55
|
-
console.error("Error re-subscribing to channel '".concat(channel), resp);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
_this.client.debug("Re-subscribed to channel '".concat(channel));
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
socket.io.on('reconnect_attempt', function (attempt) {
|
|
65
|
-
_this.client.debug("Socket reconnect attempt: ".concat(attempt));
|
|
66
|
-
});
|
|
67
|
-
socket.io.on('reconnect_error', function (error) {
|
|
68
|
-
_this.client.debug("Socket reconnect error: ".concat(error.message));
|
|
69
|
-
});
|
|
70
|
-
socket.io.on('reconnect_failed', function () {
|
|
71
|
-
_this.client.debug("Socket reconnect failed");
|
|
72
|
-
});
|
|
73
|
-
socket.io.on('reconnect', function () {
|
|
74
|
-
_this.client.debug("Socket reconnected");
|
|
75
|
-
});
|
|
76
|
-
socket.on('disconnect', function (reason) {
|
|
77
|
-
_this.client.debug("Socket disconnected: ".concat(reason));
|
|
78
|
-
});
|
|
79
|
-
socket.on('error', function (e) {
|
|
80
|
-
_this.client.debug("Socket error: ".concat(e.messaage));
|
|
81
|
-
});
|
|
82
|
-
_this.socket = socket;
|
|
83
|
-
_this.connected = true;
|
|
84
|
-
socket.on('connect', function () {
|
|
85
|
-
resolve();
|
|
86
|
-
});
|
|
87
|
-
socket.connect();
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
WebSocketGateway.prototype.disconnect = function () {
|
|
91
|
-
var _this = this;
|
|
92
|
-
if (!this.isConnected) {
|
|
93
|
-
return Promise.resolve();
|
|
94
|
-
}
|
|
95
|
-
return new Promise(function (resolve) {
|
|
96
|
-
_this.socket.once('disconnect', function () {
|
|
97
|
-
_this.connected = false;
|
|
98
|
-
resolve();
|
|
99
|
-
});
|
|
100
|
-
_this.socket.disconnect();
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
WebSocketGateway.prototype.subscribe = function (channel, cb) {
|
|
104
|
-
var _this = this;
|
|
105
|
-
if (!this.isConnected) {
|
|
106
|
-
throw new Error('WebSocketGateway is not initialized');
|
|
107
|
-
}
|
|
108
|
-
this.client.debug("Subscribing to channel '".concat(channel));
|
|
109
|
-
// Discriminating 'message' event listener that only responds to messages sent to 'channel'
|
|
110
|
-
var listener = function (msg) {
|
|
111
|
-
if (msg.channel === channel) {
|
|
112
|
-
cb(null, msg);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
// Unsubscriber
|
|
116
|
-
var unsubscribe = function (unsubscribeCb) {
|
|
117
|
-
_this.socket.off('message', listener);
|
|
118
|
-
_this.unsubscribe(channel, unsubscribeCb);
|
|
119
|
-
};
|
|
120
|
-
// Subscribe and bind listener
|
|
121
|
-
this.socket.emit('subscribe', { channel: channel }, function (resp) {
|
|
122
|
-
if (resp.status === 'error') {
|
|
123
|
-
_this.client.debug("Error subscribed to channel '".concat(channel), resp);
|
|
124
|
-
return cb(new Error(resp.message));
|
|
125
|
-
}
|
|
126
|
-
_this.subscribedChannels.add(channel);
|
|
127
|
-
_this.client.debug("Subscribed to channel '".concat(channel));
|
|
128
|
-
_this.socket.on('message', listener);
|
|
129
|
-
});
|
|
130
|
-
return unsubscribe;
|
|
131
|
-
};
|
|
132
|
-
WebSocketGateway.prototype.unsubscribe = function (channel, cb) {
|
|
133
|
-
var _this = this;
|
|
134
|
-
if (!this.isConnected) {
|
|
135
|
-
throw new Error('WebSocketGateway is not initialized');
|
|
136
|
-
}
|
|
137
|
-
this.client.debug("Unsubscribing from channel '".concat(channel));
|
|
138
|
-
this.socket.emit('unsubscribe', { channel: channel }, function (resp) {
|
|
139
|
-
if (resp.status === 'error') {
|
|
140
|
-
_this.client.debug("Error unsubscribing from channel '".concat(channel), resp);
|
|
141
|
-
if (cb) {
|
|
142
|
-
cb(new Error(resp.message));
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
_this.subscribedChannels.delete(channel);
|
|
147
|
-
_this.client.debug("Unsubscribed from channel '".concat(channel));
|
|
148
|
-
if (cb) {
|
|
149
|
-
cb(null);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
return WebSocketGateway;
|
|
155
|
-
}());
|
|
156
|
-
export { WebSocketGateway };
|
|
157
|
-
//# sourceMappingURL=web-socket-gateway.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"web-socket-gateway.js","sourceRoot":"","sources":["../../../src/lib/web-socket-gateway.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,EAAE,EAAyC,MAAM,kBAAkB,CAAC;AAG7E,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,2CAAuB,CAAA;IACvB,wCAAoB,CAAA;AACtB,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AA4BD;IAUE,0BAA4B,MAAc,EAAmB,OAAiC;QAAlE,WAAM,GAAN,MAAM,CAAQ;QAAmB,YAAO,GAAP,OAAO,CAA0B;QATtF,cAAS,GAAG,KAAK,CAAC;QAClB,uBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;IAQkD,CAAC;IAJlG,sBAAI,yCAAW;aAAf;YACE,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;;;OAAA;IAID,kCAAO,GAAP;QAAA,iBA0EC;QAzEC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OA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AAE,CAAC,CAAC;gBAC3D,IAAI,EAAE,EAAE,CAAC;oBACP,EAAE,CAAC,IAAI,CAAC,CAAC;gBACX,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACH,uBAAC;AAAD,CAAC,AA9JD,IA8JC","sourcesContent":["import { io, ManagerOptions, Socket, SocketOptions } from 'socket.io-client';\nimport { Client } from './client';\n\nexport enum WebSocketChannel {\n System = 'system',\n AppConfig = 'appconfig',\n Dataset = 'dataset/'\n}\n\nexport interface WebSocketPublishMessage {\n channel: string;\n messageType?: string;\n payload: unknown;\n}\n\nexport interface WebSocketSubscribeMessage {\n channel: string;\n}\n\nexport interface WebSocketErrorResponse {\n status: 'error';\n code: string;\n message: string;\n}\n\nexport interface WebSocketOkResponse {\n status: 'ok';\n}\n\nexport type WebSocketResponse = WebSocketOkResponse | WebSocketErrorResponse;\nexport type WebSocketManagerOptions = Partial<ManagerOptions & SocketOptions>;\nexport type WebSocketSubscribeCallback = (err: Error | null, msg?: WebSocketPublishMessage) => void;\nexport type WebSocketUnsubscribeCallback = (err: Error | null) => void;\nexport type WebSocketUnsubscriber = (cb?: WebSocketUnsubscribeCallback) => void;\n\nexport class WebSocketGateway {\n private connected = false;\n private subscribedChannels = new Set<string>();\n\n socket!: Socket;\n\n get isConnected(): boolean {\n return this.connected;\n }\n\n constructor(public readonly client: Client, private readonly options?: WebSocketManagerOptions) {}\n\n connect(): Promise<void> {\n if (this.isConnected) {\n return Promise.resolve();\n }\n\n return new Promise((resolve, reject) => {\n const socket = io(this.client.baseUrl, {\n ...this.options,\n autoConnect: false,\n auth: cb => {\n const authHeaders: Record<string, string> = {};\n\n if (this.client.apiKey) {\n authHeaders['x-api-key'] = this.client.apiKey;\n }\n\n if (this.client.accessToken) {\n authHeaders['x-socket-token'] = `Bearer ${this.client.accessToken}`;\n }\n\n cb(authHeaders);\n }\n });\n\n socket.on('connect', () => {\n this.client.debug(`Socket connected: ${socket.id}`);\n\n if (this.subscribedChannels.size) {\n this.subscribedChannels.forEach(channel => {\n socket.emit('subscribe', { channel }, (resp: WebSocketResponse) => {\n if (resp.status === 'error') {\n console.error(`Error re-subscribing to channel '${channel}`, resp);\n } else {\n this.client.debug(`Re-subscribed to channel '${channel}`);\n }\n });\n });\n }\n });\n\n socket.io.on('reconnect_attempt', (attempt: number) => {\n this.client.debug(`Socket reconnect attempt: ${attempt}`);\n });\n\n socket.io.on('reconnect_error', (error: Error) => {\n this.client.debug(`Socket reconnect error: ${error.message}`);\n });\n\n socket.io.on('reconnect_failed', () => {\n this.client.debug(`Socket reconnect failed`);\n });\n\n socket.io.on('reconnect', () => {\n this.client.debug(`Socket reconnected`);\n });\n\n socket.on('disconnect', reason => {\n this.client.debug(`Socket disconnected: ${reason}`);\n });\n\n socket.on('error', e => {\n this.client.debug(`Socket error: ${e.messaage}`);\n });\n\n this.socket = socket;\n\n this.connected = true;\n\n socket.on('connect', () => {\n resolve();\n });\n\n socket.connect();\n });\n }\n\n disconnect(): Promise<void> {\n if (!this.isConnected) {\n return Promise.resolve();\n }\n\n return new Promise(resolve => {\n this.socket.once('disconnect', () => {\n this.connected = false;\n resolve();\n });\n this.socket.disconnect();\n });\n }\n\n subscribe(channel: string, cb: WebSocketSubscribeCallback): WebSocketUnsubscriber {\n if (!this.isConnected) {\n throw new Error('WebSocketGateway is not initialized');\n }\n\n this.client.debug(`Subscribing to channel '${channel}`);\n\n // Discriminating 'message' event listener that only responds to messages sent to 'channel'\n const listener = (msg: WebSocketPublishMessage) => {\n if (msg.channel === channel) {\n cb(null, msg);\n }\n };\n\n // Unsubscriber\n const unsubscribe = (unsubscribeCb?: WebSocketUnsubscribeCallback) => {\n this.socket.off('message', listener);\n this.unsubscribe(channel, unsubscribeCb);\n };\n\n // Subscribe and bind listener\n this.socket.emit('subscribe', { channel }, (resp: WebSocketResponse) => {\n if (resp.status === 'error') {\n this.client.debug(`Error subscribed to channel '${channel}`, resp);\n return cb(new Error(resp.message));\n }\n\n this.subscribedChannels.add(channel);\n this.client.debug(`Subscribed to channel '${channel}`);\n this.socket.on('message', listener);\n });\n\n return unsubscribe;\n }\n\n unsubscribe(channel: string, cb?: WebSocketUnsubscribeCallback) {\n if (!this.isConnected) {\n throw new Error('WebSocketGateway is not initialized');\n }\n\n this.client.debug(`Unsubscribing from channel '${channel}`);\n this.socket.emit('unsubscribe', { channel }, (resp: WebSocketResponse) => {\n if (resp.status === 'error') {\n this.client.debug(`Error unsubscribing from channel '${channel}`, resp);\n if (cb) {\n cb(new Error(resp.message));\n }\n } else {\n this.subscribedChannels.delete(channel);\n this.client.debug(`Unsubscribed from channel '${channel}`);\n if (cb) {\n cb(null);\n }\n }\n });\n }\n}\n"]}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2022 Emu Analytics
|
|
3
|
-
*/
|
|
4
|
-
export * from './lib/client';
|
|
5
|
-
export * from './lib/api-interfaces';
|
|
6
|
-
export * from './lib/base.endpoints';
|
|
7
|
-
export * from './lib/errors';
|
|
8
|
-
export * from './lib/web-socket-gateway';
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/__mocks__/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAgEjD,eAAO,MAAM,MAAM,mBAAa,CAAC"}
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2018 Emu Analytics
|
|
3
|
-
*/
|
|
4
|
-
export interface IQuery {
|
|
5
|
-
filter?: {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
};
|
|
8
|
-
attributes?: string | string[];
|
|
9
|
-
join?: string | string[];
|
|
10
|
-
limit?: number;
|
|
11
|
-
offset?: number;
|
|
12
|
-
sort?: string | string[];
|
|
13
|
-
}
|
|
14
|
-
export interface IBaseResource {
|
|
15
|
-
id: string;
|
|
16
|
-
}
|
|
17
|
-
export interface IMetadata {
|
|
18
|
-
[key: string]: any;
|
|
19
|
-
}
|
|
20
|
-
export interface IPermissions {
|
|
21
|
-
[key: string]: {
|
|
22
|
-
[key: string]: string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export interface IApiKey extends IBaseResource {
|
|
26
|
-
applicationId: string;
|
|
27
|
-
application?: IApplication;
|
|
28
|
-
id: string;
|
|
29
|
-
description: string;
|
|
30
|
-
type: 'app' | 'master';
|
|
31
|
-
permissions: IPermissions;
|
|
32
|
-
metadata: IMetadata;
|
|
33
|
-
userId: string;
|
|
34
|
-
createdAt: string;
|
|
35
|
-
updatedAt: string;
|
|
36
|
-
}
|
|
37
|
-
export interface IApplication extends IBaseResource {
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
databases?: IDatabase[];
|
|
41
|
-
description: string;
|
|
42
|
-
contact: string;
|
|
43
|
-
metadata: IMetadata;
|
|
44
|
-
createdAt: string;
|
|
45
|
-
updatedAt: string;
|
|
46
|
-
}
|
|
47
|
-
export interface IAppConfig extends IBaseResource {
|
|
48
|
-
applicationId: string;
|
|
49
|
-
config: object;
|
|
50
|
-
}
|
|
51
|
-
export interface IDatabase extends IBaseResource {
|
|
52
|
-
applicationId: string;
|
|
53
|
-
application?: IApplication;
|
|
54
|
-
id: string;
|
|
55
|
-
type: string;
|
|
56
|
-
name: string;
|
|
57
|
-
default: boolean;
|
|
58
|
-
description: string;
|
|
59
|
-
host: string;
|
|
60
|
-
port: number;
|
|
61
|
-
user: string;
|
|
62
|
-
password: string;
|
|
63
|
-
db: string;
|
|
64
|
-
createdAt: string;
|
|
65
|
-
updatedAt: string;
|
|
66
|
-
}
|
|
67
|
-
export interface IDatasetAttribute {
|
|
68
|
-
attribute: string;
|
|
69
|
-
type: string;
|
|
70
|
-
dbType: string;
|
|
71
|
-
isGeometry?: boolean;
|
|
72
|
-
srid?: number;
|
|
73
|
-
extent?: number[];
|
|
74
|
-
extentLngLat?: number[];
|
|
75
|
-
primaryKey?: boolean;
|
|
76
|
-
default?: string;
|
|
77
|
-
nullable?: boolean;
|
|
78
|
-
description?: string;
|
|
79
|
-
}
|
|
80
|
-
export interface IDataset extends IBaseResource {
|
|
81
|
-
applicationId: string;
|
|
82
|
-
application?: IApplication;
|
|
83
|
-
id: string;
|
|
84
|
-
type: 'table' | 'sql';
|
|
85
|
-
source: string;
|
|
86
|
-
name: string;
|
|
87
|
-
databaseId: string;
|
|
88
|
-
database?: IDatabase;
|
|
89
|
-
description: string;
|
|
90
|
-
bytes: number;
|
|
91
|
-
metadata: IMetadata;
|
|
92
|
-
ownerId: string;
|
|
93
|
-
createdAt: string;
|
|
94
|
-
updatedAt: string;
|
|
95
|
-
attributes: IDatasetAttribute[];
|
|
96
|
-
options?: {
|
|
97
|
-
[key: string]: any;
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
export interface IMapLayer extends IBaseResource {
|
|
101
|
-
applicationId: string;
|
|
102
|
-
application?: IApplication;
|
|
103
|
-
ownerId: string;
|
|
104
|
-
createdAt: string;
|
|
105
|
-
updatedAt: string;
|
|
106
|
-
id: string;
|
|
107
|
-
name: string;
|
|
108
|
-
description: string;
|
|
109
|
-
layerSpec: any;
|
|
110
|
-
type: string;
|
|
111
|
-
group: string;
|
|
112
|
-
metadata: IMetadata;
|
|
113
|
-
}
|
|
114
|
-
export type FileExportFormat = 'geojson' | 'gpkg' | 'shapefile';
|
|
115
|
-
export interface ITileSource extends IBaseResource {
|
|
116
|
-
applicationId: string;
|
|
117
|
-
application?: IApplication;
|
|
118
|
-
metadata: IMetadata;
|
|
119
|
-
id: string;
|
|
120
|
-
type: string;
|
|
121
|
-
source: string;
|
|
122
|
-
attribution: string;
|
|
123
|
-
minZoom: number;
|
|
124
|
-
maxZoom: number;
|
|
125
|
-
headers: {
|
|
126
|
-
[key: string]: string;
|
|
127
|
-
};
|
|
128
|
-
extentLngLat: number[];
|
|
129
|
-
createdAt: string;
|
|
130
|
-
updatedAt: string;
|
|
131
|
-
}
|
|
132
|
-
export interface IUpload extends IBaseResource {
|
|
133
|
-
id: string;
|
|
134
|
-
fileName: string;
|
|
135
|
-
path: string;
|
|
136
|
-
options: {
|
|
137
|
-
name: string;
|
|
138
|
-
description?: string;
|
|
139
|
-
datasetId: string;
|
|
140
|
-
attribution?: string;
|
|
141
|
-
schema?: string;
|
|
142
|
-
};
|
|
143
|
-
size: number;
|
|
144
|
-
status: string;
|
|
145
|
-
error: {
|
|
146
|
-
message: string;
|
|
147
|
-
stdout: string;
|
|
148
|
-
stderr: string;
|
|
149
|
-
};
|
|
150
|
-
applicationId: string;
|
|
151
|
-
application?: IApplication;
|
|
152
|
-
ownerId: string;
|
|
153
|
-
updatedAt: string;
|
|
154
|
-
createdAt: string;
|
|
155
|
-
}
|
|
156
|
-
export interface IUser extends IBaseResource {
|
|
157
|
-
[key: string]: any;
|
|
158
|
-
}
|
|
159
|
-
export interface IStyle extends IBaseResource {
|
|
160
|
-
[key: string]: any;
|
|
161
|
-
}
|
|
162
|
-
export interface ITileSpec {
|
|
163
|
-
[key: string]: any;
|
|
164
|
-
}
|
|
165
|
-
export interface IConfig {
|
|
166
|
-
version: {
|
|
167
|
-
tag: string;
|
|
168
|
-
hash: string;
|
|
169
|
-
timestamp: number;
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
export interface ILoginResponse {
|
|
173
|
-
accessToken: string;
|
|
174
|
-
refreshToken: string;
|
|
175
|
-
}
|
|
176
|
-
export interface ITokenRefreshResponse {
|
|
177
|
-
accessToken: string;
|
|
178
|
-
}
|
|
179
|
-
export interface UsersMeResponse {
|
|
180
|
-
applicationId: string;
|
|
181
|
-
email: string;
|
|
182
|
-
firstName: string;
|
|
183
|
-
id: string;
|
|
184
|
-
lastName: string;
|
|
185
|
-
metadata: object;
|
|
186
|
-
roles: string[];
|
|
187
|
-
}
|
|
188
|
-
export type JobStatus = 'pending' | 'processing' | 'done' | 'cancelled' | 'error';
|
|
189
|
-
export interface IJob {
|
|
190
|
-
id: string;
|
|
191
|
-
applicationId: string;
|
|
192
|
-
ownerId?: string;
|
|
193
|
-
metadata: IMetadata;
|
|
194
|
-
type: string;
|
|
195
|
-
name?: string;
|
|
196
|
-
description?: string;
|
|
197
|
-
params: any;
|
|
198
|
-
status: JobStatus;
|
|
199
|
-
error?: object;
|
|
200
|
-
progress?: number;
|
|
201
|
-
progressText?: string;
|
|
202
|
-
datasetId?: string;
|
|
203
|
-
createdAt: string;
|
|
204
|
-
updatedAt: string;
|
|
205
|
-
}
|
|
206
|
-
export interface IJobStatus {
|
|
207
|
-
status?: JobStatus;
|
|
208
|
-
error?: object;
|
|
209
|
-
progress?: number;
|
|
210
|
-
progressText?: string;
|
|
211
|
-
}
|
|
212
|
-
export interface IJobSubmission {
|
|
213
|
-
type: string;
|
|
214
|
-
name?: string;
|
|
215
|
-
description?: string;
|
|
216
|
-
params: any;
|
|
217
|
-
}
|
|
218
|
-
export interface IJobRequest {
|
|
219
|
-
type: string;
|
|
220
|
-
}
|
|
221
|
-
export type IngestAction = 'insert' | 'upsert' | 'delete';
|
|
222
|
-
export interface IIngestMessage {
|
|
223
|
-
datasetId: string;
|
|
224
|
-
action: IngestAction;
|
|
225
|
-
data: any;
|
|
226
|
-
}
|
|
227
|
-
export interface IPipeline extends IBaseResource {
|
|
228
|
-
applicationId: string;
|
|
229
|
-
application?: IApplication;
|
|
230
|
-
id: string;
|
|
231
|
-
environment: string;
|
|
232
|
-
description: string;
|
|
233
|
-
config: Record<string, any>;
|
|
234
|
-
metadata: IMetadata;
|
|
235
|
-
startedAt: string;
|
|
236
|
-
heartbeatAt: string;
|
|
237
|
-
createdAt: string;
|
|
238
|
-
updatedAt: string;
|
|
239
|
-
components?: IPipelineComponent[];
|
|
240
|
-
}
|
|
241
|
-
export interface IPipelineComponent extends IBaseResource {
|
|
242
|
-
id: string;
|
|
243
|
-
description: string;
|
|
244
|
-
config: Record<string, any>;
|
|
245
|
-
class: string;
|
|
246
|
-
type: string;
|
|
247
|
-
metadata: IMetadata;
|
|
248
|
-
index: number;
|
|
249
|
-
createdAt: string;
|
|
250
|
-
updatedAt: string;
|
|
251
|
-
metrics?: IPipelineMetric[];
|
|
252
|
-
}
|
|
253
|
-
export interface IPipelineMetric extends IBaseResource {
|
|
254
|
-
id: string;
|
|
255
|
-
applicationId: string;
|
|
256
|
-
pipelineId: string;
|
|
257
|
-
componentId: string;
|
|
258
|
-
name: string;
|
|
259
|
-
type: string;
|
|
260
|
-
timestamp: string;
|
|
261
|
-
value: number;
|
|
262
|
-
labels: Record<string, string>;
|
|
263
|
-
createdAt: string;
|
|
264
|
-
updatedAt: string;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Contact point resource.
|
|
268
|
-
*/
|
|
269
|
-
export interface IContactPoint extends IBaseResource {
|
|
270
|
-
id: string;
|
|
271
|
-
applicationId: string;
|
|
272
|
-
type: string;
|
|
273
|
-
description: string;
|
|
274
|
-
templates: string[];
|
|
275
|
-
recipients: string[];
|
|
276
|
-
/** Driver-specific host configuration for the contact point */
|
|
277
|
-
host: string;
|
|
278
|
-
/** Driver-specific port configuration for the contact point */
|
|
279
|
-
port: number;
|
|
280
|
-
/** Driver-specific user configuration for the contact point */
|
|
281
|
-
user: string;
|
|
282
|
-
/** Driver-specific password configuration for the contact point */
|
|
283
|
-
password: string;
|
|
284
|
-
metadata: IMetadata;
|
|
285
|
-
createdAt: string;
|
|
286
|
-
updatedAt: string;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Request body for sending a notification to a contact point.
|
|
290
|
-
*/
|
|
291
|
-
export interface IContactPointSendRequest {
|
|
292
|
-
/** ID of the template to use for the notification */
|
|
293
|
-
template?: string;
|
|
294
|
-
/** Subject of the notification */
|
|
295
|
-
subject?: string;
|
|
296
|
-
/** Recipients of the notification */
|
|
297
|
-
recipients?: string[];
|
|
298
|
-
/** Template key/value data for expanding the notification template */
|
|
299
|
-
data?: any;
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Media resource.
|
|
303
|
-
*/
|
|
304
|
-
export interface IMedia extends IBaseResource {
|
|
305
|
-
id: string;
|
|
306
|
-
applicationId: string;
|
|
307
|
-
type: string;
|
|
308
|
-
mimeType: string;
|
|
309
|
-
fileName: string;
|
|
310
|
-
metadata: IMetadata;
|
|
311
|
-
createdAt: string;
|
|
312
|
-
updatedAt: string;
|
|
313
|
-
}
|
|
314
|
-
//# sourceMappingURL=api-interfaces.d.ts.map
|