@emuanalytics/flow-engine-client 2.0.13 → 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 -194
- package/dist/cjs/lib/client.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/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 -188
- package/dist/esm/lib/client.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/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 -266
- 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 -64
- package/dist/types/lib/client.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/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,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2018-present 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
|
-
import { PipelineMetricEndpoints } from './pipeline-metric.endpoint';
|
|
21
|
-
var PipelineComponentEndpoints = /** @class */ (function (_super) {
|
|
22
|
-
__extends(PipelineComponentEndpoints, _super);
|
|
23
|
-
function PipelineComponentEndpoints(client, pipelineId) {
|
|
24
|
-
var _this = _super.call(this, client, "pipelines/".concat(pipelineId, "/components")) || this;
|
|
25
|
-
_this.pipelineId = pipelineId;
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
PipelineComponentEndpoints.prototype.metrics = function (componentId) {
|
|
29
|
-
return new PipelineMetricEndpoints(this.client, this.pipelineId, componentId);
|
|
30
|
-
};
|
|
31
|
-
return PipelineComponentEndpoints;
|
|
32
|
-
}(BaseEndpoints));
|
|
33
|
-
export { PipelineComponentEndpoints };
|
|
34
|
-
//# sourceMappingURL=pipeline-component.endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-component.endpoints.js","sourceRoot":"","sources":["../../../src/lib/pipeline-component.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE;IAAgD,8CAAiC;IAC/E,oCAAY,MAAc,EAAU,UAAkB;QACpD,YAAA,MAAK,YAAC,MAAM,EAAE,oBAAa,UAAU,gBAAa,CAAC,SAAC;QADlB,gBAAU,GAAV,UAAU,CAAQ;;IAEtD,CAAC;IAED,4CAAO,GAAP,UAAQ,WAAmB;QACzB,OAAO,IAAI,uBAAuB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAChF,CAAC;IACH,iCAAC;AAAD,CAAC,AARD,CAAgD,aAAa,GAQ5D","sourcesContent":["/**\n * Copyright © 2018-present Emu Analytics\n */\n\nimport { IPipelineComponent } from './api-interfaces';\nimport { BaseEndpoints } from './base.endpoints';\nimport { Client } from './client';\nimport { PipelineMetricEndpoints } from './pipeline-metric.endpoint';\n\nexport class PipelineComponentEndpoints extends BaseEndpoints<IPipelineComponent> {\n constructor(client: Client, private pipelineId: string) {\n super(client, `pipelines/${pipelineId}/components`);\n }\n\n metrics(componentId: string) {\n return new PipelineMetricEndpoints(this.client, this.pipelineId, componentId);\n }\n}\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2018-present 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 PipelineMetricEndpoints = /** @class */ (function (_super) {
|
|
21
|
-
__extends(PipelineMetricEndpoints, _super);
|
|
22
|
-
function PipelineMetricEndpoints(client, pipelineId, componentId) {
|
|
23
|
-
return _super.call(this, client, "pipelines/".concat(pipelineId, "/components/").concat(componentId, "/metrics")) || this;
|
|
24
|
-
}
|
|
25
|
-
return PipelineMetricEndpoints;
|
|
26
|
-
}(BaseEndpoints));
|
|
27
|
-
export { PipelineMetricEndpoints };
|
|
28
|
-
//# sourceMappingURL=pipeline-metric.endpoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-metric.endpoint.js","sourceRoot":"","sources":["../../../src/lib/pipeline-metric.endpoint.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD;IAA6C,2CAA8B;IACzE,iCAAY,MAAc,EAAE,UAAkB,EAAE,WAAmB;QACjE,OAAA,MAAK,YAAC,MAAM,EAAE,oBAAa,UAAU,yBAAe,WAAW,aAAU,CAAC,SAAC;IAC7E,CAAC;IACH,8BAAC;AAAD,CAAC,AAJD,CAA6C,aAAa,GAIzD","sourcesContent":["/**\n * Copyright © 2018-present Emu Analytics\n */\n\nimport { IPipelineMetric } from './api-interfaces';\nimport { BaseEndpoints } from './base.endpoints';\nimport { Client } from './client';\n\nexport class PipelineMetricEndpoints extends BaseEndpoints<IPipelineMetric> {\n constructor(client: Client, pipelineId: string, componentId: string) {\n super(client, `pipelines/${pipelineId}/components/${componentId}/metrics`);\n }\n}\n"]}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2018-present 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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
20
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
21
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
22
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
23
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
24
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
25
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
29
|
-
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);
|
|
30
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
31
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
32
|
-
function step(op) {
|
|
33
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
34
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
35
|
-
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;
|
|
36
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
37
|
-
switch (op[0]) {
|
|
38
|
-
case 0: case 1: t = op; break;
|
|
39
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
40
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
41
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
42
|
-
default:
|
|
43
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
44
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
45
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
46
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
47
|
-
if (t[2]) _.ops.pop();
|
|
48
|
-
_.trys.pop(); continue;
|
|
49
|
-
}
|
|
50
|
-
op = body.call(thisArg, _);
|
|
51
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
52
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
import { BaseEndpoints } from './base.endpoints';
|
|
56
|
-
import { PipelineComponentEndpoints } from './pipeline-component.endpoints';
|
|
57
|
-
var PipelineEndpoints = /** @class */ (function (_super) {
|
|
58
|
-
__extends(PipelineEndpoints, _super);
|
|
59
|
-
function PipelineEndpoints(client) {
|
|
60
|
-
return _super.call(this, client, 'pipelines') || this;
|
|
61
|
-
}
|
|
62
|
-
PipelineEndpoints.prototype.components = function (pipelineId) {
|
|
63
|
-
return new PipelineComponentEndpoints(this.client, pipelineId);
|
|
64
|
-
};
|
|
65
|
-
PipelineEndpoints.prototype.heartbeat = function (id_1) {
|
|
66
|
-
return __awaiter(this, arguments, void 0, function (id, params) {
|
|
67
|
-
if (params === void 0) { params = {}; }
|
|
68
|
-
return __generator(this, function (_a) {
|
|
69
|
-
return [2 /*return*/, this.client._post("".concat(this.resourceEndpoint, "/").concat(id, "/heartbeat"), { params: params })];
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
PipelineEndpoints.prototype.publishMetrics = function (metrics_1) {
|
|
74
|
-
return __awaiter(this, arguments, void 0, function (metrics, params) {
|
|
75
|
-
if (params === void 0) { params = {}; }
|
|
76
|
-
return __generator(this, function (_a) {
|
|
77
|
-
return [2 /*return*/, this.client._post("".concat(this.resourceEndpoint, "/publish-metrics"), metrics, { params: params })];
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
return PipelineEndpoints;
|
|
82
|
-
}(BaseEndpoints));
|
|
83
|
-
export { PipelineEndpoints };
|
|
84
|
-
//# sourceMappingURL=pipeline.endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.endpoints.js","sourceRoot":"","sources":["../../../src/lib/pipeline.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE5E;IAAuC,qCAAwB;IAC7D,2BAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,WAAW,CAAC,SAAC;IAC7B,CAAC;IAED,sCAAU,GAAV,UAAW,UAAkB;QAC3B,OAAO,IAAI,0BAA0B,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjE,CAAC;IAEK,qCAAS,GAAf;4DAAgB,EAAU,EAAE,MAAgC;YAAhC,uBAAA,EAAA,WAAgC;;gBAC1D,sBAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,EAAE,eAAY,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,EAAC;;;KAClF;IAEK,0CAAc,GAApB;4DAAqB,OAAe,EAAE,MAAgC;YAAhC,uBAAA,EAAA,WAAgC;;gBACpE,sBAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAG,IAAI,CAAC,gBAAgB,qBAAkB,EAAE,OAAO,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,EAAC;;;KAC3F;IACH,wBAAC;AAAD,CAAC,AAhBD,CAAuC,aAAa,GAgBnD","sourcesContent":["/**\n * Copyright © 2018-present Emu Analytics\n */\n\nimport { IPipeline } from './api-interfaces';\nimport { BaseEndpoints } from './base.endpoints';\nimport { Client } from './client';\nimport { PipelineComponentEndpoints } from './pipeline-component.endpoints';\n\nexport class PipelineEndpoints extends BaseEndpoints<IPipeline> {\n constructor(client: Client) {\n super(client, 'pipelines');\n }\n\n components(pipelineId: string) {\n return new PipelineComponentEndpoints(this.client, pipelineId);\n }\n\n async heartbeat(id: string, params: Record<string, any> = {}): Promise<void> {\n return this.client._post(`${this.resourceEndpoint}/${id}/heartbeat`, { params });\n }\n\n async publishMetrics(metrics: object, params: Record<string, any> = {}): Promise<void> {\n return this.client._post(`${this.resourceEndpoint}/publish-metrics`, metrics, { params });\n }\n}\n"]}
|
|
@@ -1,28 +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 StyleEndpoints = /** @class */ (function (_super) {
|
|
21
|
-
__extends(StyleEndpoints, _super);
|
|
22
|
-
function StyleEndpoints(client) {
|
|
23
|
-
return _super.call(this, client, 'styles') || this;
|
|
24
|
-
}
|
|
25
|
-
return StyleEndpoints;
|
|
26
|
-
}(BaseEndpoints));
|
|
27
|
-
export { StyleEndpoints };
|
|
28
|
-
//# sourceMappingURL=style.endpoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style.endpoint.js","sourceRoot":"","sources":["../../../src/lib/style.endpoint.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;IAAoC,kCAAqB;IACvD,wBAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,QAAQ,CAAC,SAAC;IAC1B,CAAC;IACH,qBAAC;AAAD,CAAC,AAJD,CAAoC,aAAa,GAIhD","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { IStyle } from './api-interfaces';\nimport { BaseEndpoints } from './base.endpoints';\n\nexport class StyleEndpoints extends BaseEndpoints<IStyle> {\n constructor(client: Client) {\n super(client, 'styles');\n }\n}\n"]}
|
|
@@ -1,36 +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 TileSourceEndpoints = /** @class */ (function (_super) {
|
|
21
|
-
__extends(TileSourceEndpoints, _super);
|
|
22
|
-
function TileSourceEndpoints(client) {
|
|
23
|
-
return _super.call(this, client, 'tilesources') || this;
|
|
24
|
-
}
|
|
25
|
-
TileSourceEndpoints.prototype.drivers = function () {
|
|
26
|
-
return this.client._get("/api/v1/tilesources/drivers").catch(function (e) {
|
|
27
|
-
if (e.statusCode === 404) {
|
|
28
|
-
// Backwards compatibility for pre-1.0.0 Flo.w
|
|
29
|
-
return ['tilelive', 'dataset'];
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
return TileSourceEndpoints;
|
|
34
|
-
}(BaseEndpoints));
|
|
35
|
-
export { TileSourceEndpoints };
|
|
36
|
-
//# sourceMappingURL=tile-source.endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile-source.endpoints.js","sourceRoot":"","sources":["../../../src/lib/tile-source.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD;IAAyC,uCAA0B;IACjE,6BAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,aAAa,CAAC,SAAC;IAC/B,CAAC;IAED,qCAAO,GAAP;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,KAAK,CAAC,UAAA,CAAC;YAC5D,IAAI,CAAC,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;gBACzB,8CAA8C;gBAC9C,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YACjC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACH,0BAAC;AAAD,CAAC,AAbD,CAAyC,aAAa,GAarD","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { BaseEndpoints } from './base.endpoints';\nimport { ITileSource } from './api-interfaces';\n\nexport class TileSourceEndpoints extends BaseEndpoints<ITileSource> {\n constructor(client: Client) {\n super(client, 'tilesources');\n }\n\n drivers(): Promise<string[]> {\n return this.client._get(`/api/v1/tilesources/drivers`).catch(e => {\n if (e.statusCode === 404) {\n // Backwards compatibility for pre-1.0.0 Flo.w\n return ['tilelive', 'dataset'];\n }\n });\n }\n}\n"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2018 Emu Analytics
|
|
3
|
-
*/
|
|
4
|
-
var TileEndpoints = /** @class */ (function () {
|
|
5
|
-
function TileEndpoints(client) {
|
|
6
|
-
this.client = client;
|
|
7
|
-
}
|
|
8
|
-
TileEndpoints.prototype.getTileSpec = function (tilesourceId, params) {
|
|
9
|
-
if (params === void 0) { params = {}; }
|
|
10
|
-
return this.client._get("/tiles/".concat(tilesourceId, "/index.json"), { params: params });
|
|
11
|
-
};
|
|
12
|
-
TileEndpoints.prototype.getPreviewStyle = function (tilesourceId, params) {
|
|
13
|
-
if (params === void 0) { params = {}; }
|
|
14
|
-
return this.client._get("/tiles/".concat(tilesourceId, "/style.json"), { params: params });
|
|
15
|
-
};
|
|
16
|
-
return TileEndpoints;
|
|
17
|
-
}());
|
|
18
|
-
export { TileEndpoints };
|
|
19
|
-
//# sourceMappingURL=tile.endpoints.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tile.endpoints.js","sourceRoot":"","sources":["../../../src/lib/tile.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;IACE,uBAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,mCAAW,GAAX,UAAY,YAAoB,EAAE,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QAChE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAU,YAAY,gBAAa,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,uCAAe,GAAf,UAAgB,YAAoB,EAAE,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QACpE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAU,YAAY,gBAAa,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAC3E,CAAC;IACH,oBAAC;AAAD,CAAC,AAVD,IAUC","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { ITileSpec } from './api-interfaces';\nimport { Client } from './client';\n\nexport class TileEndpoints {\n constructor(private readonly client: Client) {}\n\n getTileSpec(tilesourceId: string, params: Record<string, any> = {}): Promise<ITileSpec> {\n return this.client._get(`/tiles/${tilesourceId}/index.json`, { params });\n }\n\n getPreviewStyle(tilesourceId: string, params: Record<string, any> = {}): Promise<ITileSpec> {\n return this.client._get(`/tiles/${tilesourceId}/style.json`, { params });\n }\n}\n"]}
|
|
@@ -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,OAAO,QAAQ,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAoBjD;IAAqC,mCAAsB;IACzD,yBAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,SAAS,CAAC,SAAC;IAC3B,CAAC;IAEK,gCAAM,GAAZ;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AAC,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,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;QAED,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAM,MAAM,GAAG,EAAE,CAAC,KAAI,CAAC,MAAM,CAAC,OAAO,wBAChC,KAAI,CAAC,OAAO,KACf,WAAW,EAAE,KA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ocketOptions } 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"}
|