@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.
Files changed (152) hide show
  1. package/dist/bundle.js +9 -3
  2. package/dist/index.cjs +1 -0
  3. package/dist/index.d.cts +668 -0
  4. package/dist/index.d.mts +668 -0
  5. package/dist/index.d.ts +668 -0
  6. package/dist/index.mjs +1 -0
  7. package/package.json +33 -40
  8. package/dist/bundle.js.map +0 -7
  9. package/dist/cjs/index.js +0 -25
  10. package/dist/cjs/index.js.map +0 -1
  11. package/dist/cjs/lib/__mocks__/client.js +0 -57
  12. package/dist/cjs/lib/__mocks__/client.js.map +0 -1
  13. package/dist/cjs/lib/api-interfaces.js +0 -6
  14. package/dist/cjs/lib/api-interfaces.js.map +0 -1
  15. package/dist/cjs/lib/apikey.endpoints.js +0 -31
  16. package/dist/cjs/lib/apikey.endpoints.js.map +0 -1
  17. package/dist/cjs/lib/appconfig.endpoints.js +0 -49
  18. package/dist/cjs/lib/appconfig.endpoints.js.map +0 -1
  19. package/dist/cjs/lib/application.endpoints.js +0 -31
  20. package/dist/cjs/lib/application.endpoints.js.map +0 -1
  21. package/dist/cjs/lib/auth.edpoints.js +0 -60
  22. package/dist/cjs/lib/auth.edpoints.js.map +0 -1
  23. package/dist/cjs/lib/base.endpoints.js +0 -78
  24. package/dist/cjs/lib/base.endpoints.js.map +0 -1
  25. package/dist/cjs/lib/client.js +0 -194
  26. package/dist/cjs/lib/client.js.map +0 -1
  27. package/dist/cjs/lib/database.endpoints.js +0 -39
  28. package/dist/cjs/lib/database.endpoints.js.map +0 -1
  29. package/dist/cjs/lib/dataset.endpoints.js +0 -88
  30. package/dist/cjs/lib/dataset.endpoints.js.map +0 -1
  31. package/dist/cjs/lib/errors.js +0 -36
  32. package/dist/cjs/lib/errors.js.map +0 -1
  33. package/dist/cjs/lib/job.endpoints.js +0 -46
  34. package/dist/cjs/lib/job.endpoints.js.map +0 -1
  35. package/dist/cjs/lib/map.endoints.js +0 -18
  36. package/dist/cjs/lib/map.endoints.js.map +0 -1
  37. package/dist/cjs/lib/maplayer.endpoints.js +0 -34
  38. package/dist/cjs/lib/maplayer.endpoints.js.map +0 -1
  39. package/dist/cjs/lib/pipeline-component.endpoints.js +0 -37
  40. package/dist/cjs/lib/pipeline-component.endpoints.js.map +0 -1
  41. package/dist/cjs/lib/pipeline-metric.endpoint.js +0 -31
  42. package/dist/cjs/lib/pipeline-metric.endpoint.js.map +0 -1
  43. package/dist/cjs/lib/pipeline.endpoints.js +0 -87
  44. package/dist/cjs/lib/pipeline.endpoints.js.map +0 -1
  45. package/dist/cjs/lib/style.endpoint.js +0 -31
  46. package/dist/cjs/lib/style.endpoint.js.map +0 -1
  47. package/dist/cjs/lib/tile-source.endpoints.js +0 -39
  48. package/dist/cjs/lib/tile-source.endpoints.js.map +0 -1
  49. package/dist/cjs/lib/tile.endpoints.js +0 -22
  50. package/dist/cjs/lib/tile.endpoints.js.map +0 -1
  51. package/dist/cjs/lib/upload.endpoints.js +0 -121
  52. package/dist/cjs/lib/upload.endpoints.js.map +0 -1
  53. package/dist/cjs/lib/user.endpoints.js +0 -36
  54. package/dist/cjs/lib/user.endpoints.js.map +0 -1
  55. package/dist/cjs/lib/web-socket-gateway.js +0 -160
  56. package/dist/cjs/lib/web-socket-gateway.js.map +0 -1
  57. package/dist/esm/index.js +0 -9
  58. package/dist/esm/index.js.map +0 -1
  59. package/dist/esm/lib/__mocks__/client.js +0 -54
  60. package/dist/esm/lib/__mocks__/client.js.map +0 -1
  61. package/dist/esm/lib/api-interfaces.js +0 -5
  62. package/dist/esm/lib/api-interfaces.js.map +0 -1
  63. package/dist/esm/lib/apikey.endpoints.js +0 -28
  64. package/dist/esm/lib/apikey.endpoints.js.map +0 -1
  65. package/dist/esm/lib/appconfig.endpoints.js +0 -46
  66. package/dist/esm/lib/appconfig.endpoints.js.map +0 -1
  67. package/dist/esm/lib/application.endpoints.js +0 -28
  68. package/dist/esm/lib/application.endpoints.js.map +0 -1
  69. package/dist/esm/lib/auth.edpoints.js +0 -57
  70. package/dist/esm/lib/auth.edpoints.js.map +0 -1
  71. package/dist/esm/lib/base.endpoints.js +0 -75
  72. package/dist/esm/lib/base.endpoints.js.map +0 -1
  73. package/dist/esm/lib/client.js +0 -188
  74. package/dist/esm/lib/client.js.map +0 -1
  75. package/dist/esm/lib/database.endpoints.js +0 -36
  76. package/dist/esm/lib/database.endpoints.js.map +0 -1
  77. package/dist/esm/lib/dataset.endpoints.js +0 -85
  78. package/dist/esm/lib/dataset.endpoints.js.map +0 -1
  79. package/dist/esm/lib/errors.js +0 -33
  80. package/dist/esm/lib/errors.js.map +0 -1
  81. package/dist/esm/lib/job.endpoints.js +0 -43
  82. package/dist/esm/lib/job.endpoints.js.map +0 -1
  83. package/dist/esm/lib/map.endoints.js +0 -15
  84. package/dist/esm/lib/map.endoints.js.map +0 -1
  85. package/dist/esm/lib/maplayer.endpoints.js +0 -31
  86. package/dist/esm/lib/maplayer.endpoints.js.map +0 -1
  87. package/dist/esm/lib/pipeline-component.endpoints.js +0 -34
  88. package/dist/esm/lib/pipeline-component.endpoints.js.map +0 -1
  89. package/dist/esm/lib/pipeline-metric.endpoint.js +0 -28
  90. package/dist/esm/lib/pipeline-metric.endpoint.js.map +0 -1
  91. package/dist/esm/lib/pipeline.endpoints.js +0 -84
  92. package/dist/esm/lib/pipeline.endpoints.js.map +0 -1
  93. package/dist/esm/lib/style.endpoint.js +0 -28
  94. package/dist/esm/lib/style.endpoint.js.map +0 -1
  95. package/dist/esm/lib/tile-source.endpoints.js +0 -36
  96. package/dist/esm/lib/tile-source.endpoints.js.map +0 -1
  97. package/dist/esm/lib/tile.endpoints.js +0 -19
  98. package/dist/esm/lib/tile.endpoints.js.map +0 -1
  99. package/dist/esm/lib/upload.endpoints.js +0 -115
  100. package/dist/esm/lib/upload.endpoints.js.map +0 -1
  101. package/dist/esm/lib/user.endpoints.js +0 -33
  102. package/dist/esm/lib/user.endpoints.js.map +0 -1
  103. package/dist/esm/lib/web-socket-gateway.js +0 -157
  104. package/dist/esm/lib/web-socket-gateway.js.map +0 -1
  105. package/dist/types/index.d.ts +0 -9
  106. package/dist/types/index.d.ts.map +0 -1
  107. package/dist/types/lib/__mocks__/client.d.ts +0 -3
  108. package/dist/types/lib/__mocks__/client.d.ts.map +0 -1
  109. package/dist/types/lib/api-interfaces.d.ts +0 -266
  110. package/dist/types/lib/api-interfaces.d.ts.map +0 -1
  111. package/dist/types/lib/apikey.endpoints.d.ts +0 -10
  112. package/dist/types/lib/apikey.endpoints.d.ts.map +0 -1
  113. package/dist/types/lib/appconfig.endpoints.d.ts +0 -15
  114. package/dist/types/lib/appconfig.endpoints.d.ts.map +0 -1
  115. package/dist/types/lib/application.endpoints.d.ts +0 -10
  116. package/dist/types/lib/application.endpoints.d.ts.map +0 -1
  117. package/dist/types/lib/auth.edpoints.d.ts +0 -20
  118. package/dist/types/lib/auth.edpoints.d.ts.map +0 -1
  119. package/dist/types/lib/base.endpoints.d.ts +0 -20
  120. package/dist/types/lib/base.endpoints.d.ts.map +0 -1
  121. package/dist/types/lib/client.d.ts +0 -64
  122. package/dist/types/lib/client.d.ts.map +0 -1
  123. package/dist/types/lib/database.endpoints.d.ts +0 -11
  124. package/dist/types/lib/database.endpoints.d.ts.map +0 -1
  125. package/dist/types/lib/dataset.endpoints.d.ts +0 -26
  126. package/dist/types/lib/dataset.endpoints.d.ts.map +0 -1
  127. package/dist/types/lib/errors.d.ts +0 -9
  128. package/dist/types/lib/errors.d.ts.map +0 -1
  129. package/dist/types/lib/job.endpoints.d.ts +0 -15
  130. package/dist/types/lib/job.endpoints.d.ts.map +0 -1
  131. package/dist/types/lib/map.endoints.d.ts +0 -11
  132. package/dist/types/lib/map.endoints.d.ts.map +0 -1
  133. package/dist/types/lib/maplayer.endpoints.d.ts +0 -12
  134. package/dist/types/lib/maplayer.endpoints.d.ts.map +0 -1
  135. package/dist/types/lib/pipeline-component.endpoints.d.ts +0 -13
  136. package/dist/types/lib/pipeline-component.endpoints.d.ts.map +0 -1
  137. package/dist/types/lib/pipeline-metric.endpoint.d.ts +0 -10
  138. package/dist/types/lib/pipeline-metric.endpoint.d.ts.map +0 -1
  139. package/dist/types/lib/pipeline.endpoints.d.ts +0 -14
  140. package/dist/types/lib/pipeline.endpoints.d.ts.map +0 -1
  141. package/dist/types/lib/style.endpoint.d.ts +0 -10
  142. package/dist/types/lib/style.endpoint.d.ts.map +0 -1
  143. package/dist/types/lib/tile-source.endpoints.d.ts +0 -11
  144. package/dist/types/lib/tile-source.endpoints.d.ts.map +0 -1
  145. package/dist/types/lib/tile.endpoints.d.ts +0 -12
  146. package/dist/types/lib/tile.endpoints.d.ts.map +0 -1
  147. package/dist/types/lib/upload.endpoints.d.ts +0 -22
  148. package/dist/types/lib/upload.endpoints.d.ts.map +0 -1
  149. package/dist/types/lib/user.endpoints.d.ts +0 -11
  150. package/dist/types/lib/user.endpoints.d.ts.map +0 -1
  151. package/dist/types/lib/web-socket-gateway.d.ts +0 -42
  152. package/dist/types/lib/web-socket-gateway.d.ts.map +0 -1
@@ -1,121 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- 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);
28
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- 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;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- var __importDefault = (this && this.__importDefault) || function (mod) {
54
- return (mod && mod.__esModule) ? mod : { "default": mod };
55
- };
56
- Object.defineProperty(exports, "__esModule", { value: true });
57
- exports.UploadEndpoints = void 0;
58
- /**
59
- * Copyright © 2018 Emu Analytics
60
- */
61
- var form_data_1 = __importDefault(require("form-data"));
62
- var base_endpoints_1 = require("./base.endpoints");
63
- var UploadEndpoints = /** @class */ (function (_super) {
64
- __extends(UploadEndpoints, _super);
65
- function UploadEndpoints(client) {
66
- return _super.call(this, client, 'uploads') || this;
67
- }
68
- UploadEndpoints.prototype.upload = function (options_1) {
69
- return __awaiter(this, arguments, void 0, function (options, params) {
70
- var form, upload;
71
- var _a, _b, _c;
72
- if (params === void 0) { params = {}; }
73
- return __generator(this, function (_d) {
74
- switch (_d.label) {
75
- case 0:
76
- form = new form_data_1.default();
77
- if (options.datasetName) {
78
- form.append('name', options.datasetName);
79
- }
80
- if (options.datasetDescription) {
81
- form.append('description', options.datasetDescription);
82
- }
83
- if (options.attribution) {
84
- form.append('attribution', options.attribution);
85
- }
86
- if (options.datasetId) {
87
- form.append('datasetId', options.datasetId);
88
- }
89
- if (options.sourceSrid) {
90
- form.append('sourceSrid', options.sourceSrid);
91
- }
92
- if (options.targetSrid) {
93
- form.append('targetSrid', options.targetSrid);
94
- }
95
- if (options.schema) {
96
- form.append('schema', options.schema);
97
- }
98
- if (options.metadata) {
99
- form.append('metadata', JSON.stringify(options.metadata));
100
- }
101
- form.append('file', options.data, options.filename);
102
- return [4 /*yield*/, this.client._post(this.resourceEndpoint, form, {
103
- // Note - only Node FormData supports getHeaders
104
- headers: (_b = (_a = form.getHeaders) === null || _a === void 0 ? void 0 : _a.call(form)) !== null && _b !== void 0 ? _b : { 'Content-Type': 'multipart/form-data' },
105
- // Add abort signal
106
- signal: (_c = options.abortController) === null || _c === void 0 ? void 0 : _c.signal,
107
- params: params,
108
- // Note that progress only works in the browser!!
109
- onUploadProgress: options.progress
110
- })];
111
- case 1:
112
- upload = _d.sent();
113
- return [2 /*return*/, upload];
114
- }
115
- });
116
- });
117
- };
118
- return UploadEndpoints;
119
- }(base_endpoints_1.BaseEndpoints));
120
- exports.UploadEndpoints = UploadEndpoints;
121
- //# 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,wDAAiC;AAEjC,mDAAiD;AAoBjD;IAAqC,mCAAsB;IACzD,yBAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,SAAS,CAAC,SAAC;IAC3B,CAAC;IAEK,gCAAM,GAAZ;4DAAa,OAAsB,EAAE,MAAgC;;;YAAhC,uBAAA,EAAA,WAAgC;;;;wBAC7D,IAAI,GAAG,IAAI,mBAAQ,EAAE,CAAC;wBAC5B,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;4BACxB,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;wBAC3C,CAAC;wBACD,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;4BAC/B,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;wBACzD,CAAC;wBACD,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;4BACxB,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;wBAClD,CAAC;wBACD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;4BACtB,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;wBAC9C,CAAC;wBACD,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;4BACvB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;wBAChD,CAAC;wBACD,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;4BACvB,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;wBAChD,CAAC;wBACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;4BACnB,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;wBACxC,CAAC;wBACD,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,8BAAa,GA6CjD;AA7CY,0CAAe","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,36 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright © 2018 Emu Analytics
4
- */
5
- var __extends = (this && this.__extends) || (function () {
6
- var extendStatics = function (d, b) {
7
- extendStatics = Object.setPrototypeOf ||
8
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
9
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
10
- return extendStatics(d, b);
11
- };
12
- return function (d, b) {
13
- if (typeof b !== "function" && b !== null)
14
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
15
- extendStatics(d, b);
16
- function __() { this.constructor = d; }
17
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
18
- };
19
- })();
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.UserEndpoint = void 0;
22
- var base_endpoints_1 = require("./base.endpoints");
23
- var UserEndpoint = /** @class */ (function (_super) {
24
- __extends(UserEndpoint, _super);
25
- function UserEndpoint(client) {
26
- return _super.call(this, client, 'auth/users') || this;
27
- }
28
- UserEndpoint.prototype.me = function (token) {
29
- return this.client._get("".concat(this.resourceEndpoint, "/me"), {
30
- headers: { Authorization: "Bearer ".concat(token) }
31
- });
32
- };
33
- return UserEndpoint;
34
- }(base_endpoints_1.BaseEndpoints));
35
- exports.UserEndpoint = UserEndpoint;
36
- //# 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,mDAAiD;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,8BAAa,GAU9C;AAVY,oCAAY","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,160 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.WebSocketGateway = exports.WebSocketChannel = void 0;
15
- var socket_io_client_1 = require("socket.io-client");
16
- var WebSocketChannel;
17
- (function (WebSocketChannel) {
18
- WebSocketChannel["System"] = "system";
19
- WebSocketChannel["AppConfig"] = "appconfig";
20
- WebSocketChannel["Dataset"] = "dataset/";
21
- })(WebSocketChannel || (exports.WebSocketChannel = WebSocketChannel = {}));
22
- var WebSocketGateway = /** @class */ (function () {
23
- function WebSocketGateway(client, options) {
24
- this.client = client;
25
- this.options = options;
26
- this.connected = false;
27
- this.subscribedChannels = new Set();
28
- }
29
- Object.defineProperty(WebSocketGateway.prototype, "isConnected", {
30
- get: function () {
31
- return this.connected;
32
- },
33
- enumerable: false,
34
- configurable: true
35
- });
36
- WebSocketGateway.prototype.connect = function () {
37
- var _this = this;
38
- if (this.isConnected) {
39
- return Promise.resolve();
40
- }
41
- return new Promise(function (resolve, reject) {
42
- var socket = (0, socket_io_client_1.io)(_this.client.baseUrl, __assign(__assign({}, _this.options), { autoConnect: false, auth: function (cb) {
43
- var authHeaders = {};
44
- if (_this.client.apiKey) {
45
- authHeaders['x-api-key'] = _this.client.apiKey;
46
- }
47
- if (_this.client.accessToken) {
48
- authHeaders['x-socket-token'] = "Bearer ".concat(_this.client.accessToken);
49
- }
50
- cb(authHeaders);
51
- } }));
52
- socket.on('connect', function () {
53
- _this.client.debug("Socket connected: ".concat(socket.id));
54
- if (_this.subscribedChannels.size) {
55
- _this.subscribedChannels.forEach(function (channel) {
56
- socket.emit('subscribe', { channel: channel }, function (resp) {
57
- if (resp.status === 'error') {
58
- console.error("Error re-subscribing to channel '".concat(channel), resp);
59
- }
60
- else {
61
- _this.client.debug("Re-subscribed to channel '".concat(channel));
62
- }
63
- });
64
- });
65
- }
66
- });
67
- socket.io.on('reconnect_attempt', function (attempt) {
68
- _this.client.debug("Socket reconnect attempt: ".concat(attempt));
69
- });
70
- socket.io.on('reconnect_error', function (error) {
71
- _this.client.debug("Socket reconnect error: ".concat(error.message));
72
- });
73
- socket.io.on('reconnect_failed', function () {
74
- _this.client.debug("Socket reconnect failed");
75
- });
76
- socket.io.on('reconnect', function () {
77
- _this.client.debug("Socket reconnected");
78
- });
79
- socket.on('disconnect', function (reason) {
80
- _this.client.debug("Socket disconnected: ".concat(reason));
81
- });
82
- socket.on('error', function (e) {
83
- _this.client.debug("Socket error: ".concat(e.messaage));
84
- });
85
- _this.socket = socket;
86
- _this.connected = true;
87
- socket.on('connect', function () {
88
- resolve();
89
- });
90
- socket.connect();
91
- });
92
- };
93
- WebSocketGateway.prototype.disconnect = function () {
94
- var _this = this;
95
- if (!this.isConnected) {
96
- return Promise.resolve();
97
- }
98
- return new Promise(function (resolve) {
99
- _this.socket.once('disconnect', function () {
100
- _this.connected = false;
101
- resolve();
102
- });
103
- _this.socket.disconnect();
104
- });
105
- };
106
- WebSocketGateway.prototype.subscribe = function (channel, cb) {
107
- var _this = this;
108
- if (!this.isConnected) {
109
- throw new Error('WebSocketGateway is not initialized');
110
- }
111
- this.client.debug("Subscribing to channel '".concat(channel));
112
- // Discriminating 'message' event listener that only responds to messages sent to 'channel'
113
- var listener = function (msg) {
114
- if (msg.channel === channel) {
115
- cb(null, msg);
116
- }
117
- };
118
- // Unsubscriber
119
- var unsubscribe = function (unsubscribeCb) {
120
- _this.socket.off('message', listener);
121
- _this.unsubscribe(channel, unsubscribeCb);
122
- };
123
- // Subscribe and bind listener
124
- this.socket.emit('subscribe', { channel: channel }, function (resp) {
125
- if (resp.status === 'error') {
126
- _this.client.debug("Error subscribed to channel '".concat(channel), resp);
127
- return cb(new Error(resp.message));
128
- }
129
- _this.subscribedChannels.add(channel);
130
- _this.client.debug("Subscribed to channel '".concat(channel));
131
- _this.socket.on('message', listener);
132
- });
133
- return unsubscribe;
134
- };
135
- WebSocketGateway.prototype.unsubscribe = function (channel, cb) {
136
- var _this = this;
137
- if (!this.isConnected) {
138
- throw new Error('WebSocketGateway is not initialized');
139
- }
140
- this.client.debug("Unsubscribing from channel '".concat(channel));
141
- this.socket.emit('unsubscribe', { channel: channel }, function (resp) {
142
- if (resp.status === 'error') {
143
- _this.client.debug("Error unsubscribing from channel '".concat(channel), resp);
144
- if (cb) {
145
- cb(new Error(resp.message));
146
- }
147
- }
148
- else {
149
- _this.subscribedChannels.delete(channel);
150
- _this.client.debug("Unsubscribed from channel '".concat(channel));
151
- if (cb) {
152
- cb(null);
153
- }
154
- }
155
- });
156
- };
157
- return WebSocketGateway;
158
- }());
159
- exports.WebSocketGateway = WebSocketGateway;
160
- //# 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,qDAA6E;AAG7E,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,2CAAuB,CAAA;IACvB,wCAAoB,CAAA;AACtB,CAAC,EAJW,gBAAgB,gCAAhB,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;;;OAA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AAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACxC,KAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAA8B,OAAO,CAAE,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;AA9JY,4CAAgB","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/esm/index.js 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.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","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","sourcesContent":["/**\n * Copyright © 2022 Emu Analytics\n */\n\nexport * from './lib/client';\nexport * from './lib/api-interfaces';\nexport * from './lib/base.endpoints';\nexport * from './lib/errors';\nexport * from './lib/web-socket-gateway';\n"]}
@@ -1,54 +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 { Client as MockClient } from '../client';
13
- MockClient.prototype._get = function (path, options) {
14
- var _a;
15
- if (options === void 0) { options = {}; }
16
- // Move apiKey from params
17
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
18
- options.apiKey = options.params.apiKey;
19
- delete options.params.apiKey;
20
- }
21
- return __assign(__assign({ method: 'get', url: path }, options), this.headers(options));
22
- };
23
- MockClient.prototype._post = function (path, data, options) {
24
- var _a;
25
- if (options === void 0) { options = {}; }
26
- // Move apiKey from params
27
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
28
- options.apiKey = options.params.apiKey;
29
- delete options.params.apiKey;
30
- }
31
- return __assign(__assign({ method: 'post', url: path, data: data }, options), this.headers(options));
32
- };
33
- MockClient.prototype._put = function (path, data, options) {
34
- var _a;
35
- if (options === void 0) { options = {}; }
36
- // Move apiKey from params
37
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
38
- options.apiKey = options.params.apiKey;
39
- delete options.params.apiKey;
40
- }
41
- return __assign(__assign({ method: 'put', url: path, data: data }, options), this.headers(options));
42
- };
43
- MockClient.prototype._delete = function (path, options) {
44
- var _a;
45
- if (options === void 0) { options = {}; }
46
- // Move apiKey from params
47
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
48
- options.apiKey = options.params.apiKey;
49
- delete options.params.apiKey;
50
- }
51
- return __assign(__assign({ method: 'delete', url: path }, options), this.headers(options));
52
- };
53
- export var Client = MockClient;
54
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/__mocks__/client.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,WAAW,CAAC;AAEjD,UAAU,CAA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IAAI,EACT,IAAI,MAAA,IACD,OAAO,GACN,IAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EACjC;AACJ,CAAC,CAAC;AAEF,UAAU,CAAC,SAAS,CAAC,OAAO,GAAG,UAAS,IAAY,EAAE,OAAiB;;IAAjB,wBAAA,EAAA,YAAiB;IACrE,0BAA0B;IAC1B,IAAI,MAAA,OAAO,CAAC,MAAM,0CAAE,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;QACvC,OAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/B,CAAC;IAED,2BACE,MAAM,EAAE,QAAQ,EAChB,GAAG,EAAE,IAAI,IACN,OAAO,GACN,IAAY,CAAC,OAAO,CAAC,OAAO,CAAC,EACjC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,MAAM,GAAG,UAAU,CAAC","sourcesContent":["import { Client as MockClient } from '../client';\n\nMockClient.prototype._get = function(path: string, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return {\n method: 'get',\n url: path,\n ...options,\n ...(this as any).headers(options)\n };\n};\n\nMockClient.prototype._post = function(path: string, data: object, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return {\n method: 'post',\n url: path,\n data,\n ...options,\n ...(this as any).headers(options)\n };\n};\n\nMockClient.prototype._put = function(path: string, data: object, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return {\n method: 'put',\n url: path,\n data,\n ...options,\n ...(this as any).headers(options)\n };\n};\n\nMockClient.prototype._delete = function(path: string, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return {\n method: 'delete',\n url: path,\n ...options,\n ...(this as any).headers(options)\n };\n};\n\nexport const Client = MockClient;\n"]}
@@ -1,5 +0,0 @@
1
- /**
2
- * Copyright © 2018 Emu Analytics
3
- */
4
- export {};
5
- //# sourceMappingURL=api-interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-interfaces.js","sourceRoot":"","sources":["../../../src/lib/api-interfaces.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nexport interface IQuery {\n filter?: { [key: string]: any };\n attributes?: string | string[];\n join?: string | string[];\n limit?: number;\n offset?: number;\n sort?: string | string[];\n}\n\nexport interface IBaseResource {\n id: string;\n}\n\nexport interface IMetadata {\n [key: string]: any;\n}\n\nexport interface IPermissions {\n [key: string]: { [key: string]: string };\n}\n\nexport interface IApiKey extends IBaseResource {\n applicationId: string;\n application?: IApplication;\n id: string;\n description: string;\n type: 'app' | 'master';\n permissions: IPermissions;\n metadata: IMetadata;\n userId: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface IApplication extends IBaseResource {\n id: string;\n name: string;\n databases?: IDatabase[];\n description: string;\n contact: string;\n metadata: IMetadata;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface IAppConfig extends IBaseResource {\n applicationId: string;\n config: object;\n}\n\nexport interface IDatabase extends IBaseResource {\n applicationId: string;\n application?: IApplication;\n id: string;\n type: string;\n name: string;\n default: boolean;\n description: string;\n host: string;\n port: number;\n user: string;\n password: string;\n db: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface IDatasetAttribute {\n attribute: string;\n type: string;\n dbType: string;\n isGeometry?: boolean;\n srid?: number;\n extent?: number[];\n extentLngLat?: number[];\n primaryKey?: boolean;\n default?: string;\n nullable?: boolean;\n description?: string;\n}\n\nexport interface IDataset extends IBaseResource {\n applicationId: string;\n application?: IApplication;\n id: string;\n type: 'table' | 'sql';\n source: string;\n name: string;\n databaseId: string;\n database?: IDatabase;\n description: string;\n bytes: number;\n metadata: IMetadata;\n ownerId: string;\n createdAt: string;\n updatedAt: string;\n attributes: IDatasetAttribute[];\n options?: { [key: string]: any };\n}\nexport interface IMapLayer extends IBaseResource {\n applicationId: string;\n application?: IApplication;\n ownerId: string;\n createdAt: string;\n updatedAt: string;\n\n id: string;\n name: string;\n description: string;\n layerSpec: any;\n type: string;\n group: string;\n metadata: IMetadata;\n}\n\nexport type FileExportFormat = 'geojson' | 'gpkg' | 'shapefile';\n\nexport interface ITileSource extends IBaseResource {\n applicationId: string;\n application?: IApplication;\n metadata: IMetadata;\n id: string;\n type: string;\n source: string;\n attribution: string;\n minZoom: number;\n maxZoom: number;\n headers: { [key: string]: string };\n extentLngLat: number[];\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface IUpload extends IBaseResource {\n id: string;\n fileName: string;\n path: string;\n options: {\n name: string;\n description?: string;\n datasetId: string;\n attribution?: string;\n schema?: string;\n };\n size: number;\n status: string;\n error: { message: string; stdout: string; stderr: string };\n applicationId: string;\n application?: IApplication;\n ownerId: string;\n updatedAt: string;\n createdAt: string;\n}\n\nexport interface IUser extends IBaseResource {\n [key: string]: any;\n}\n\nexport interface IStyle extends IBaseResource {\n [key: string]: any;\n}\n\nexport interface ITileSpec {\n [key: string]: any;\n}\n\nexport interface IConfig {\n version: {\n tag: string;\n hash: string;\n timestamp: number;\n };\n}\n\nexport interface ILoginResponse {\n accessToken: string;\n refreshToken: string;\n}\n\nexport interface ITokenRefreshResponse {\n accessToken: string;\n}\n\nexport interface UsersMeResponse {\n applicationId: string;\n email: string;\n firstName: string;\n id: string;\n lastName: string;\n metadata: object;\n roles: string[];\n}\n\n/* Job resource */\nexport type JobStatus = 'pending' | 'processing' | 'done' | 'cancelled' | 'error';\n\nexport interface IJob {\n id: string;\n applicationId: string;\n ownerId?: string;\n metadata: IMetadata;\n type: string;\n name?: string;\n description?: string;\n params: any;\n status: JobStatus;\n error?: object;\n progress?: number;\n progressText?: string;\n datasetId?: string;\n createdAt: string;\n updatedAt: string;\n}\nexport interface IJobStatus {\n status?: JobStatus;\n error?: object;\n progress?: number;\n progressText?: string;\n}\n\nexport interface IJobSubmission {\n type: string;\n name?: string;\n description?: string;\n params: any;\n}\n\nexport interface IJobRequest {\n type: string;\n}\n\nexport type IngestAction = 'insert' | 'upsert' | 'delete';\nexport interface IIngestMessage {\n datasetId: string;\n action: IngestAction;\n data: any;\n}\n\nexport interface IPipeline extends IBaseResource {\n applicationId: string;\n application?: IApplication;\n id: string;\n environment: string;\n description: string;\n config: Record<string, any>;\n metadata: IMetadata;\n startedAt: string;\n heartbeatAt: string;\n createdAt: string;\n updatedAt: string;\n components?: IPipelineComponent[];\n}\n\nexport interface IPipelineComponent extends IBaseResource {\n id: string;\n description: string;\n config: Record<string, any>;\n class: string;\n type: string;\n metadata: IMetadata;\n index: number;\n createdAt: string;\n updatedAt: string;\n metrics?: IPipelineMetric[];\n}\n\nexport interface IPipelineMetric extends IBaseResource {\n id: string;\n applicationId: string;\n pipelineId: string;\n componentId: string;\n name: string;\n type: string;\n timestamp: string;\n value: number;\n labels: Record<string, string>;\n createdAt: string;\n updatedAt: string;\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 ApiKeyEndpoints = /** @class */ (function (_super) {
21
- __extends(ApiKeyEndpoints, _super);
22
- function ApiKeyEndpoints(client) {
23
- return _super.call(this, client, 'apikeys') || this;
24
- }
25
- return ApiKeyEndpoints;
26
- }(BaseEndpoints));
27
- export { ApiKeyEndpoints };
28
- //# sourceMappingURL=apikey.endpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apikey.endpoints.js","sourceRoot":"","sources":["../../../src/lib/apikey.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD;IAAqC,mCAAsB;IACzD,yBAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,SAAS,CAAC,SAAC;IAC3B,CAAC;IACH,sBAAC;AAAD,CAAC,AAJD,CAAqC,aAAa,GAIjD","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { BaseEndpoints } from './base.endpoints';\nimport { IApiKey } from './api-interfaces';\n\nexport class ApiKeyEndpoints extends BaseEndpoints<IApiKey> {\n constructor(client: Client) {\n super(client, 'apikeys');\n }\n}\n"]}
@@ -1,46 +0,0 @@
1
- /**
2
- * Copyright © 2018 Emu Analytics
3
- */
4
- var AppConfigEndpoints = /** @class */ (function () {
5
- function AppConfigEndpoints(client) {
6
- this.client = client;
7
- }
8
- Object.defineProperty(AppConfigEndpoints.prototype, "resourceEndpoint", {
9
- get: function () {
10
- return "/api/v1/appconfig";
11
- },
12
- enumerable: false,
13
- configurable: true
14
- });
15
- AppConfigEndpoints.prototype.get = function (path, params) {
16
- if (params === void 0) { params = {}; }
17
- return this.client._get(path ? "".concat(this.resourceEndpoint, "/").concat(path) : this.resourceEndpoint, { params: params });
18
- };
19
- AppConfigEndpoints.prototype.set = function (path, value, params) {
20
- if (params === void 0) { params = {}; }
21
- // Wrap primitives in value object
22
- if (typeof value === 'string' ||
23
- typeof value === 'number' ||
24
- typeof value === 'boolean' ||
25
- value === null ||
26
- Array.isArray(value)) {
27
- value = { value: value };
28
- }
29
- return this.client._put(path ? "".concat(this.resourceEndpoint, "/").concat(path) : this.resourceEndpoint, value, {
30
- headers: {
31
- 'Content-Type': 'application/json'
32
- },
33
- params: params
34
- });
35
- };
36
- AppConfigEndpoints.prototype.delete = function (path, params) {
37
- if (params === void 0) { params = {}; }
38
- return this.client._delete("".concat(this.resourceEndpoint, "/").concat(path), { params: params });
39
- };
40
- AppConfigEndpoints.prototype.subscribe = function (cb) {
41
- return this.client._subscribe('appconfig', cb);
42
- };
43
- return AppConfigEndpoints;
44
- }());
45
- export { AppConfigEndpoints };
46
- //# sourceMappingURL=appconfig.endpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"appconfig.endpoints.js","sourceRoot":"","sources":["../../../src/lib/appconfig.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;IACE,4BAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,sBAAY,gDAAgB;aAA5B;YACE,OAAO,mBAAmB,CAAC;QAC7B,CAAC;;;OAAA;IAED,gCAAG,GAAH,UAAI,IAAa,EAAE,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,IAAI,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IACzG,CAAC;IAED,gCAAG,GAAH,UAAI,IAAmB,EAAE,KAAU,EAAE,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QACnE,kCAAkC;QAClC,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,SAAS;YAC1B,KAAK,KAAK,IAAI;YACd,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EACpB,CAAC;YACD,KAAK,GAAG,EAAE,KAAK,OAAA,EAAE,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,IAAI,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE;YAChG,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,QAAA;SACP,CAAC,CAAC;IACL,CAAC;IAED,mCAAM,GAAN,UAAO,IAAY,EAAE,MAAgC;QAAhC,uBAAA,EAAA,WAAgC;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,IAAI,CAAE,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,sCAAS,GAAT,UAAU,EAA8B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IACH,yBAAC;AAAD,CAAC,AAtCD,IAsCC","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { WebSocketSubscribeCallback, WebSocketUnsubscriber } from './web-socket-gateway';\n\nexport class AppConfigEndpoints {\n constructor(private readonly client: Client) {}\n\n private get resourceEndpoint(): string {\n return `/api/v1/appconfig`;\n }\n\n get(path?: string, params: Record<string, any> = {}): Promise<any> {\n return this.client._get(path ? `${this.resourceEndpoint}/${path}` : this.resourceEndpoint, { params });\n }\n\n set(path: string | null, value: any, params: Record<string, any> = {}): Promise<any> {\n // Wrap primitives in value object\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value === null ||\n Array.isArray(value)\n ) {\n value = { value };\n }\n\n return this.client._put(path ? `${this.resourceEndpoint}/${path}` : this.resourceEndpoint, value, {\n headers: {\n 'Content-Type': 'application/json'\n },\n params\n });\n }\n\n delete(path: string, params: Record<string, any> = {}): Promise<any> {\n return this.client._delete(`${this.resourceEndpoint}/${path}`, { params });\n }\n\n subscribe(cb: WebSocketSubscribeCallback): WebSocketUnsubscriber {\n return this.client._subscribe('appconfig', cb);\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 ApplicationEndpoints = /** @class */ (function (_super) {
21
- __extends(ApplicationEndpoints, _super);
22
- function ApplicationEndpoints(client) {
23
- return _super.call(this, client, 'applications') || this;
24
- }
25
- return ApplicationEndpoints;
26
- }(BaseEndpoints));
27
- export { ApplicationEndpoints };
28
- //# sourceMappingURL=application.endpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application.endpoints.js","sourceRoot":"","sources":["../../../src/lib/application.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD;IAA0C,wCAA2B;IACnE,8BAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,cAAc,CAAC,SAAC;IAChC,CAAC;IACH,2BAAC;AAAD,CAAC,AAJD,CAA0C,aAAa,GAItD","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { BaseEndpoints } from './base.endpoints';\nimport { IApplication } from './api-interfaces';\n\nexport class ApplicationEndpoints extends BaseEndpoints<IApplication> {\n constructor(client: Client) {\n super(client, 'applications');\n }\n}\n"]}
@@ -1,57 +0,0 @@
1
- /**
2
- * Copyright © 2018 Emu Analytics
3
- */
4
- import { UserEndpoint } from './user.endpoints';
5
- var AuthEndpoints = /** @class */ (function () {
6
- function AuthEndpoints(client) {
7
- this.client = client;
8
- this.users = new UserEndpoint(this.client);
9
- }
10
- AuthEndpoints.prototype.login = function (email, password, applicationId) {
11
- return this.client._post('/api/v1/auth/login', { email: email, password: password, applicationId: applicationId });
12
- };
13
- AuthEndpoints.prototype.logout = function (accessToken, refreshToken) {
14
- return this.client._post('/api/v1/auth/logout', { refreshToken: refreshToken }, {
15
- headers: { Authorization: "Bearer ".concat(accessToken) }
16
- });
17
- };
18
- AuthEndpoints.prototype.refresh = function (refreshToken, applicationId) {
19
- return this.client._post('/api/v1/auth/refresh', { refreshToken: refreshToken, applicationId: applicationId });
20
- };
21
- AuthEndpoints.prototype.changePassword = function (password, newPassword, token) {
22
- return this.client._post('/api/v1/auth/changepassword', {
23
- password: password,
24
- newPassword: newPassword
25
- }, {
26
- headers: { Authorization: "Bearer ".concat(token) }
27
- });
28
- };
29
- AuthEndpoints.prototype.signUp = function (firstName, lastName, email, password, applicationId, confirmUrl, redirectUrl) {
30
- // Support legacy signature, which was missing confirmUrl
31
- if (!redirectUrl) {
32
- redirectUrl = confirmUrl;
33
- confirmUrl = "".concat(this.client.baseUrl, "/api/v1/auth/confirmsignup");
34
- }
35
- return this.client._post('/api/v1/auth/signup', {
36
- firstName: firstName,
37
- lastName: lastName,
38
- email: email,
39
- password: password,
40
- applicationId: applicationId,
41
- confirmUrl: confirmUrl,
42
- redirectUrl: redirectUrl
43
- });
44
- };
45
- AuthEndpoints.prototype.confirmSignUp = function (email, token, redirect) {
46
- return this.client._get("/api/v1/auth/confirmsignup", { params: { email: email, token: token, redirect: redirect } });
47
- };
48
- AuthEndpoints.prototype.requestPasswordReset = function (email, applicationId, redirectUrl) {
49
- return this.client._post('/api/v1/auth/requestpasswordreset', { email: email, applicationId: applicationId, redirectUrl: redirectUrl });
50
- };
51
- AuthEndpoints.prototype.resetPassword = function (email, password, applicationId, token) {
52
- return this.client._post('/api/v1/auth/resetpassword', { email: email, password: password, applicationId: applicationId, token: token });
53
- };
54
- return AuthEndpoints;
55
- }());
56
- export { AuthEndpoints };
57
- //# sourceMappingURL=auth.edpoints.js.map