@emuanalytics/flow-engine-client 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) 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 -198
  26. package/dist/cjs/lib/client.js.map +0 -1
  27. package/dist/cjs/lib/contact-point.endpoints.js +0 -46
  28. package/dist/cjs/lib/contact-point.endpoints.js.map +0 -1
  29. package/dist/cjs/lib/database.endpoints.js +0 -39
  30. package/dist/cjs/lib/database.endpoints.js.map +0 -1
  31. package/dist/cjs/lib/dataset.endpoints.js +0 -88
  32. package/dist/cjs/lib/dataset.endpoints.js.map +0 -1
  33. package/dist/cjs/lib/errors.js +0 -36
  34. package/dist/cjs/lib/errors.js.map +0 -1
  35. package/dist/cjs/lib/job.endpoints.js +0 -46
  36. package/dist/cjs/lib/job.endpoints.js.map +0 -1
  37. package/dist/cjs/lib/map.endoints.js +0 -18
  38. package/dist/cjs/lib/map.endoints.js.map +0 -1
  39. package/dist/cjs/lib/maplayer.endpoints.js +0 -34
  40. package/dist/cjs/lib/maplayer.endpoints.js.map +0 -1
  41. package/dist/cjs/lib/media.endpoints.js +0 -106
  42. package/dist/cjs/lib/media.endpoints.js.map +0 -1
  43. package/dist/cjs/lib/pipeline-component.endpoints.js +0 -37
  44. package/dist/cjs/lib/pipeline-component.endpoints.js.map +0 -1
  45. package/dist/cjs/lib/pipeline-metric.endpoint.js +0 -31
  46. package/dist/cjs/lib/pipeline-metric.endpoint.js.map +0 -1
  47. package/dist/cjs/lib/pipeline.endpoints.js +0 -87
  48. package/dist/cjs/lib/pipeline.endpoints.js.map +0 -1
  49. package/dist/cjs/lib/style.endpoint.js +0 -31
  50. package/dist/cjs/lib/style.endpoint.js.map +0 -1
  51. package/dist/cjs/lib/tile-source.endpoints.js +0 -39
  52. package/dist/cjs/lib/tile-source.endpoints.js.map +0 -1
  53. package/dist/cjs/lib/tile.endpoints.js +0 -22
  54. package/dist/cjs/lib/tile.endpoints.js.map +0 -1
  55. package/dist/cjs/lib/upload.endpoints.js +0 -121
  56. package/dist/cjs/lib/upload.endpoints.js.map +0 -1
  57. package/dist/cjs/lib/user.endpoints.js +0 -36
  58. package/dist/cjs/lib/user.endpoints.js.map +0 -1
  59. package/dist/cjs/lib/web-socket-gateway.js +0 -160
  60. package/dist/cjs/lib/web-socket-gateway.js.map +0 -1
  61. package/dist/esm/index.js +0 -9
  62. package/dist/esm/index.js.map +0 -1
  63. package/dist/esm/lib/__mocks__/client.js +0 -54
  64. package/dist/esm/lib/__mocks__/client.js.map +0 -1
  65. package/dist/esm/lib/api-interfaces.js +0 -5
  66. package/dist/esm/lib/api-interfaces.js.map +0 -1
  67. package/dist/esm/lib/apikey.endpoints.js +0 -28
  68. package/dist/esm/lib/apikey.endpoints.js.map +0 -1
  69. package/dist/esm/lib/appconfig.endpoints.js +0 -46
  70. package/dist/esm/lib/appconfig.endpoints.js.map +0 -1
  71. package/dist/esm/lib/application.endpoints.js +0 -28
  72. package/dist/esm/lib/application.endpoints.js.map +0 -1
  73. package/dist/esm/lib/auth.edpoints.js +0 -57
  74. package/dist/esm/lib/auth.edpoints.js.map +0 -1
  75. package/dist/esm/lib/base.endpoints.js +0 -75
  76. package/dist/esm/lib/base.endpoints.js.map +0 -1
  77. package/dist/esm/lib/client.js +0 -192
  78. package/dist/esm/lib/client.js.map +0 -1
  79. package/dist/esm/lib/contact-point.endpoints.js +0 -43
  80. package/dist/esm/lib/contact-point.endpoints.js.map +0 -1
  81. package/dist/esm/lib/database.endpoints.js +0 -36
  82. package/dist/esm/lib/database.endpoints.js.map +0 -1
  83. package/dist/esm/lib/dataset.endpoints.js +0 -85
  84. package/dist/esm/lib/dataset.endpoints.js.map +0 -1
  85. package/dist/esm/lib/errors.js +0 -33
  86. package/dist/esm/lib/errors.js.map +0 -1
  87. package/dist/esm/lib/job.endpoints.js +0 -43
  88. package/dist/esm/lib/job.endpoints.js.map +0 -1
  89. package/dist/esm/lib/map.endoints.js +0 -15
  90. package/dist/esm/lib/map.endoints.js.map +0 -1
  91. package/dist/esm/lib/maplayer.endpoints.js +0 -31
  92. package/dist/esm/lib/maplayer.endpoints.js.map +0 -1
  93. package/dist/esm/lib/media.endpoints.js +0 -100
  94. package/dist/esm/lib/media.endpoints.js.map +0 -1
  95. package/dist/esm/lib/pipeline-component.endpoints.js +0 -34
  96. package/dist/esm/lib/pipeline-component.endpoints.js.map +0 -1
  97. package/dist/esm/lib/pipeline-metric.endpoint.js +0 -28
  98. package/dist/esm/lib/pipeline-metric.endpoint.js.map +0 -1
  99. package/dist/esm/lib/pipeline.endpoints.js +0 -84
  100. package/dist/esm/lib/pipeline.endpoints.js.map +0 -1
  101. package/dist/esm/lib/style.endpoint.js +0 -28
  102. package/dist/esm/lib/style.endpoint.js.map +0 -1
  103. package/dist/esm/lib/tile-source.endpoints.js +0 -36
  104. package/dist/esm/lib/tile-source.endpoints.js.map +0 -1
  105. package/dist/esm/lib/tile.endpoints.js +0 -19
  106. package/dist/esm/lib/tile.endpoints.js.map +0 -1
  107. package/dist/esm/lib/upload.endpoints.js +0 -115
  108. package/dist/esm/lib/upload.endpoints.js.map +0 -1
  109. package/dist/esm/lib/user.endpoints.js +0 -33
  110. package/dist/esm/lib/user.endpoints.js.map +0 -1
  111. package/dist/esm/lib/web-socket-gateway.js +0 -157
  112. package/dist/esm/lib/web-socket-gateway.js.map +0 -1
  113. package/dist/types/index.d.ts +0 -9
  114. package/dist/types/index.d.ts.map +0 -1
  115. package/dist/types/lib/__mocks__/client.d.ts +0 -3
  116. package/dist/types/lib/__mocks__/client.d.ts.map +0 -1
  117. package/dist/types/lib/api-interfaces.d.ts +0 -314
  118. package/dist/types/lib/api-interfaces.d.ts.map +0 -1
  119. package/dist/types/lib/apikey.endpoints.d.ts +0 -10
  120. package/dist/types/lib/apikey.endpoints.d.ts.map +0 -1
  121. package/dist/types/lib/appconfig.endpoints.d.ts +0 -15
  122. package/dist/types/lib/appconfig.endpoints.d.ts.map +0 -1
  123. package/dist/types/lib/application.endpoints.d.ts +0 -10
  124. package/dist/types/lib/application.endpoints.d.ts.map +0 -1
  125. package/dist/types/lib/auth.edpoints.d.ts +0 -20
  126. package/dist/types/lib/auth.edpoints.d.ts.map +0 -1
  127. package/dist/types/lib/base.endpoints.d.ts +0 -20
  128. package/dist/types/lib/base.endpoints.d.ts.map +0 -1
  129. package/dist/types/lib/client.d.ts +0 -68
  130. package/dist/types/lib/client.d.ts.map +0 -1
  131. package/dist/types/lib/contact-point.endpoints.d.ts +0 -20
  132. package/dist/types/lib/contact-point.endpoints.d.ts.map +0 -1
  133. package/dist/types/lib/database.endpoints.d.ts +0 -11
  134. package/dist/types/lib/database.endpoints.d.ts.map +0 -1
  135. package/dist/types/lib/dataset.endpoints.d.ts +0 -26
  136. package/dist/types/lib/dataset.endpoints.d.ts.map +0 -1
  137. package/dist/types/lib/errors.d.ts +0 -9
  138. package/dist/types/lib/errors.d.ts.map +0 -1
  139. package/dist/types/lib/job.endpoints.d.ts +0 -15
  140. package/dist/types/lib/job.endpoints.d.ts.map +0 -1
  141. package/dist/types/lib/map.endoints.d.ts +0 -11
  142. package/dist/types/lib/map.endoints.d.ts.map +0 -1
  143. package/dist/types/lib/maplayer.endpoints.d.ts +0 -12
  144. package/dist/types/lib/maplayer.endpoints.d.ts.map +0 -1
  145. package/dist/types/lib/media.endpoints.d.ts +0 -20
  146. package/dist/types/lib/media.endpoints.d.ts.map +0 -1
  147. package/dist/types/lib/pipeline-component.endpoints.d.ts +0 -13
  148. package/dist/types/lib/pipeline-component.endpoints.d.ts.map +0 -1
  149. package/dist/types/lib/pipeline-metric.endpoint.d.ts +0 -10
  150. package/dist/types/lib/pipeline-metric.endpoint.d.ts.map +0 -1
  151. package/dist/types/lib/pipeline.endpoints.d.ts +0 -14
  152. package/dist/types/lib/pipeline.endpoints.d.ts.map +0 -1
  153. package/dist/types/lib/style.endpoint.d.ts +0 -10
  154. package/dist/types/lib/style.endpoint.d.ts.map +0 -1
  155. package/dist/types/lib/tile-source.endpoints.d.ts +0 -11
  156. package/dist/types/lib/tile-source.endpoints.d.ts.map +0 -1
  157. package/dist/types/lib/tile.endpoints.d.ts +0 -12
  158. package/dist/types/lib/tile.endpoints.d.ts.map +0 -1
  159. package/dist/types/lib/upload.endpoints.d.ts +0 -22
  160. package/dist/types/lib/upload.endpoints.d.ts.map +0 -1
  161. package/dist/types/lib/user.endpoints.d.ts +0 -11
  162. package/dist/types/lib/user.endpoints.d.ts.map +0 -1
  163. package/dist/types/lib/web-socket-gateway.d.ts +0 -42
  164. package/dist/types/lib/web-socket-gateway.d.ts.map +0 -1
@@ -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\n/**\n * Contact point resource.\n */\nexport interface IContactPoint extends IBaseResource {\n id: string;\n applicationId: string;\n type: string;\n description: string;\n templates: string[];\n recipients: string[];\n /** Driver-specific host configuration for the contact point */\n host: string;\n /** Driver-specific port configuration for the contact point */\n port: number;\n /** Driver-specific user configuration for the contact point */\n user: string;\n /** Driver-specific password configuration for the contact point */\n password: string;\n metadata: IMetadata;\n createdAt: string;\n updatedAt: string;\n}\n\n/**\n * Request body for sending a notification to a contact point.\n */\nexport interface IContactPointSendRequest {\n /** ID of the template to use for the notification */\n template?: string;\n /** Subject of the notification */\n subject?: string;\n /** Recipients of the notification */\n recipients?: string[];\n /** Template key/value data for expanding the notification template */\n data?: any;\n}\n\n/**\n * Media resource.\n */\nexport interface IMedia extends IBaseResource {\n id: string;\n applicationId: string;\n type: string;\n mimeType: string;\n fileName: string;\n metadata: IMetadata;\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
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.edpoints.js","sourceRoot":"","sources":["../../../src/lib/auth.edpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;IAGE,uBAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAF3C,UAAK,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAEQ,CAAC;IAE/C,6BAAK,GAAL,UAAM,KAAa,EAAE,QAAgB,EAAE,aAAsB;QAC3D,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,KAAK,OAAA,EAAE,QAAQ,UAAA,EAAE,aAAa,eA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C3D,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,MAAM,EAAE,EAAE,KAAK,OAAA,EAAE,KAAK,OAAA,EAAE,QAAQ,UAAA,EAAE,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,4CAAoB,GAApB,UAAqB,KAAa,EAAE,aAAqB,EAAE,WAAmB;QAC5E,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,EAAE,KAAK,OAAA,EAAE,aAAa,eAAA,EAAE,WAAW,aAAA,EAAE,CAAC,CAAC;IACvG,CAAC;IAED,qCAAa,GAAb,UAAc,KAAa,EAAE,QAAgB,EAAE,aAAqB,EAAE,KAAa;QACjF,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,EAAE,KAAK,OAAA,EAAE,QAAQ,UAAA,EAAE,aAAa,eAAA,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;IACpG,CAAC;IACH,oBAAC;AAAD,CAAC,AAzED,IAyEC","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { ILoginResponse, ITokenRefreshResponse } from './api-interfaces';\nimport { Client } from './client';\nimport { UserEndpoint } from './user.endpoints';\n\nexport class AuthEndpoints {\n users = new UserEndpoint(this.client);\n\n constructor(private readonly client: Client) {}\n\n login(email: string, password: string, applicationId?: string): Promise<ILoginResponse> {\n return this.client._post('/api/v1/auth/login', { email, password, applicationId });\n }\n\n logout(accessToken: string, refreshToken: string): Promise<void> {\n return this.client._post(\n '/api/v1/auth/logout',\n { refreshToken },\n {\n headers: { Authorization: `Bearer ${accessToken}` }\n }\n );\n }\n\n refresh(refreshToken: string, applicationId: string): Promise<ITokenRefreshResponse> {\n return this.client._post('/api/v1/auth/refresh', { refreshToken, applicationId });\n }\n\n changePassword(password: string, newPassword: string, token: string): Promise<void> {\n return this.client._post(\n '/api/v1/auth/changepassword',\n {\n password,\n newPassword\n },\n {\n headers: { Authorization: `Bearer ${token}` }\n }\n );\n }\n\n signUp(\n firstName: string,\n lastName: string,\n email: string,\n password: string,\n applicationId: string,\n confirmUrl: string,\n redirectUrl?: string\n ): Promise<void> {\n // Support legacy signature, which was missing confirmUrl\n if (!redirectUrl) {\n redirectUrl = confirmUrl;\n confirmUrl = `${this.client.baseUrl}/api/v1/auth/confirmsignup`;\n }\n\n return this.client._post('/api/v1/auth/signup', {\n firstName,\n lastName,\n email,\n password,\n applicationId,\n confirmUrl,\n redirectUrl\n });\n }\n\n confirmSignUp(email: string, token: string, redirect?: string): Promise<void> {\n return this.client._get(`/api/v1/auth/confirmsignup`, { params: { email, token, redirect } });\n }\n\n requestPasswordReset(email: string, applicationId: string, redirectUrl: string): Promise<void> {\n return this.client._post('/api/v1/auth/requestpasswordreset', { email, applicationId, redirectUrl });\n }\n\n resetPassword(email: string, password: string, applicationId: string, token: string): Promise<void> {\n return this.client._post('/api/v1/auth/resetpassword', { email, password, applicationId, token });\n }\n}\n"]}
@@ -1,75 +0,0 @@
1
- /**
2
- * Copyright © 2018 Emu Analytics
3
- */
4
- var BaseEndpoints = /** @class */ (function () {
5
- function BaseEndpoints(client, resourcePath) {
6
- this.client = client;
7
- this.resourcePath = resourcePath;
8
- }
9
- Object.defineProperty(BaseEndpoints.prototype, "resourceEndpoint", {
10
- get: function () {
11
- return "/api/v1/".concat(this.resourcePath);
12
- },
13
- enumerable: false,
14
- configurable: true
15
- });
16
- BaseEndpoints.prototype.list = function (params) {
17
- // Reformat filter for query string
18
- if (params === null || params === void 0 ? void 0 : params.filter) {
19
- var filter_1 = params.filter;
20
- Object.keys(filter_1).forEach(function (key) {
21
- params["filter[".concat(key, "]")] = filter_1[key];
22
- });
23
- delete params.filter;
24
- }
25
- return this.client._get(this.resourceEndpoint, { params: params });
26
- };
27
- BaseEndpoints.prototype.get = function (id, params) {
28
- if (params === void 0) { params = {}; }
29
- return this.client._get("".concat(this.resourceEndpoint, "/").concat(id), { params: params });
30
- };
31
- BaseEndpoints.prototype.create = function (data, params) {
32
- if (params === void 0) { params = {}; }
33
- return this.client._post("".concat(this.resourceEndpoint), data, { params: params });
34
- };
35
- BaseEndpoints.prototype.update = function (id, data, params) {
36
- if (params === void 0) { params = {}; }
37
- return this.client._put("".concat(this.resourceEndpoint, "/").concat(id), data, { params: params });
38
- };
39
- BaseEndpoints.prototype.delete = function (id, params) {
40
- if (params === void 0) { params = {}; }
41
- return this.client._delete("".concat(this.resourceEndpoint, "/").concat(id), { params: params });
42
- };
43
- BaseEndpoints.prototype.getMetadata = function (id, key, params) {
44
- if (params === void 0) { params = {}; }
45
- var endpoint = key
46
- ? "".concat(this.resourceEndpoint, "/").concat(id, "/metadata/").concat(key)
47
- : "".concat(this.resourceEndpoint, "/").concat(id, "/metadata");
48
- return this.client._get(endpoint, { params: params });
49
- };
50
- BaseEndpoints.prototype.setMetadata = function (id, key, value, params) {
51
- if (params === void 0) { params = {}; }
52
- // Wrap primitives in value object
53
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
54
- value = { value: value };
55
- }
56
- return this.client._put("".concat(this.resourceEndpoint, "/").concat(id, "/metadata/").concat(key), value, {
57
- headers: {
58
- 'Content-Type': 'application/json'
59
- },
60
- params: params
61
- });
62
- };
63
- BaseEndpoints.prototype.deleteMetadata = function (id, key, params) {
64
- if (params === void 0) { params = {}; }
65
- return this.client._delete("".concat(this.resourceEndpoint, "/").concat(id, "/metadata/").concat(key), {
66
- headers: {
67
- 'Content-Type': 'application/json'
68
- },
69
- params: params
70
- });
71
- };
72
- return BaseEndpoints;
73
- }());
74
- export { BaseEndpoints };
75
- //# sourceMappingURL=base.endpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.endpoints.js","sourceRoot":"","sources":["../../../src/lib/base.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;IACE,uBAA+B,MAAc,EAAmB,YAAoB;QAArD,WAAM,GAAN,MAAM,CAAQ;QAAmB,iBAAY,GAAZ,YAAY,CA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,EAAA,WAAgC;QACtE,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,EAAE,uBAAa,GAAG,CAAE,EAAE;YAC3E,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,QAAA;SACP,CAAC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AAjED,IAiEC","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { IBaseResource, IQuery } from './api-interfaces';\n\nexport class BaseEndpoints<T extends IBaseResource> {\n constructor(protected readonly client: Client, private readonly resourcePath: string) {}\n\n protected get resourceEndpoint(): string {\n return `/api/v1/${this.resourcePath}`;\n }\n\n list(params?: IQuery): Promise<T[]> {\n // Reformat filter for query string\n if (params?.filter) {\n const filter = params.filter;\n Object.keys(filter).forEach(key => {\n (params as any)[`filter[${key}]`] = filter[key];\n });\n delete params.filter;\n }\n\n return this.client._get(this.resourceEndpoint, { params });\n }\n\n get(id: string, params: Record<string, any> = {}): Promise<T> {\n return this.client._get(`${this.resourceEndpoint}/${id}`, { params });\n }\n\n create(data: Partial<T>, params: Record<string, any> = {}): Promise<T> {\n return this.client._post(`${this.resourceEndpoint}`, data, { params });\n }\n\n update(id: string, data: Partial<T>, params: Record<string, any> = {}): Promise<T> {\n return this.client._put(`${this.resourceEndpoint}/${id}`, data, { params });\n }\n\n delete(id: string, params: Record<string, any> = {}) {\n return this.client._delete(`${this.resourceEndpoint}/${id}`, { params });\n }\n\n getMetadata(id: string, key?: string, params: Record<string, any> = {}): Promise<any> {\n const endpoint = key\n ? `${this.resourceEndpoint}/${id}/metadata/${key}`\n : `${this.resourceEndpoint}/${id}/metadata`;\n return this.client._get(endpoint, { params });\n }\n\n setMetadata(id: string, key: string, value: any, params: Record<string, any> = {}): Promise<any> {\n // Wrap primitives in value object\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n value = { value };\n }\n\n return this.client._put(`${this.resourceEndpoint}/${id}/metadata/${key}`, value, {\n headers: {\n 'Content-Type': 'application/json'\n },\n params\n });\n }\n\n deleteMetadata(id: string, key: string, params: Record<string, any> = {}): Promise<any> {\n return this.client._delete(`${this.resourceEndpoint}/${id}/metadata/${key}`, {\n headers: {\n 'Content-Type': 'application/json'\n },\n params\n });\n }\n}\n"]}
@@ -1,192 +0,0 @@
1
- /**
2
- * Copyright © 2018 Emu Analytics
3
- */
4
- var __assign = (this && this.__assign) || function () {
5
- __assign = Object.assign || function(t) {
6
- for (var s, i = 1, n = arguments.length; i < n; i++) {
7
- s = arguments[i];
8
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9
- t[p] = s[p];
10
- }
11
- return t;
12
- };
13
- return __assign.apply(this, arguments);
14
- };
15
- import Axios from 'axios';
16
- import Debug from 'debug';
17
- import { ApiKeyEndpoints } from './apikey.endpoints';
18
- import { AppConfigEndpoints } from './appconfig.endpoints';
19
- import { ApplicationEndpoints } from './application.endpoints';
20
- import { AuthEndpoints } from './auth.edpoints';
21
- import { ContactPointEndpoints } from './contact-point.endpoints';
22
- import { DatabaseEndpoints } from './database.endpoints';
23
- import { DatasetEndpoints } from './dataset.endpoints';
24
- import { FlowEngineError } from './errors';
25
- import { JobEndpoints } from './job.endpoints';
26
- import { MapEndpoints } from './map.endoints';
27
- import { MapLayerEndpoints } from './maplayer.endpoints';
28
- import { MediaEndpoints } from './media.endpoints';
29
- import { PipelineEndpoints } from './pipeline.endpoints';
30
- import { StyleEndpoints } from './style.endpoint';
31
- import { TileSourceEndpoints } from './tile-source.endpoints';
32
- import { TileEndpoints } from './tile.endpoints';
33
- import { UploadEndpoints } from './upload.endpoints';
34
- import { WebSocketGateway } from './web-socket-gateway';
35
- var Client = /** @class */ (function () {
36
- function Client(baseUrl, apiKey, options) {
37
- if (apiKey === void 0) { apiKey = null; }
38
- this.baseUrl = baseUrl;
39
- this.apiKey = apiKey;
40
- this.debug = Debug('flow-engine-client');
41
- this.accessToken = null;
42
- this.auth = new AuthEndpoints(this);
43
- this.tiles = new TileEndpoints(this);
44
- this.maps = new MapEndpoints(this);
45
- this.apiKeys = new ApiKeyEndpoints(this);
46
- this.applications = new ApplicationEndpoints(this);
47
- this.appconfig = new AppConfigEndpoints(this);
48
- this.contactpoints = new ContactPointEndpoints(this);
49
- this.databases = new DatabaseEndpoints(this);
50
- this.datasets = new DatasetEndpoints(this);
51
- this.styles = new StyleEndpoints(this);
52
- this.tileSources = new TileSourceEndpoints(this);
53
- this.uploads = new UploadEndpoints(this);
54
- this.jobs = new JobEndpoints(this);
55
- this.maplayers = new MapLayerEndpoints(this);
56
- this.media = new MediaEndpoints(this);
57
- this.pipelines = new PipelineEndpoints(this);
58
- this.axios = Axios.create({
59
- baseURL: baseUrl,
60
- maxContentLength: 524288000,
61
- transformResponse: [
62
- function transformResponse(data, headers) {
63
- var _a;
64
- if ((_a = headers === null || headers === void 0 ? void 0 : headers['content-type']) === null || _a === void 0 ? void 0 : _a.startsWith('application/json')) {
65
- // Force parsing of data if expected content type is JSON
66
- // This ensures that errors are thrown if JSON is truncated due to a query timeout
67
- // (default Axios behavior is simply to return a string if JSON parsing fails)
68
- return JSON.parse(data);
69
- }
70
- return data;
71
- }
72
- ]
73
- });
74
- this.webSocketGateway = new WebSocketGateway(this, options);
75
- }
76
- Client.prototype.useRequestInterceptor = function (interceptor) {
77
- return this.axios.interceptors.request.use(interceptor);
78
- };
79
- Client.prototype.ejectRequestInterceptor = function (id) {
80
- this.axios.interceptors.request.eject(id);
81
- };
82
- Client.prototype.connect = function () {
83
- return this.webSocketGateway.connect();
84
- };
85
- Client.prototype.disconnect = function () {
86
- return this.webSocketGateway.disconnect();
87
- };
88
- Client.prototype.config = function () {
89
- return this._get('/api/v1/config');
90
- };
91
- Client.prototype._get = function (path, options) {
92
- var _a;
93
- if (options === void 0) { options = {}; }
94
- // Move apiKey from params
95
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
96
- options.apiKey = options.params.apiKey;
97
- delete options.params.apiKey;
98
- }
99
- return this.axios(__assign(__assign({ method: 'get', url: path }, options), this.headers(options)))
100
- .then(function (res) { return res.data; })
101
- .catch(this.handleError);
102
- };
103
- Client.prototype._post = function (path, data, options) {
104
- var _a;
105
- if (options === void 0) { options = {}; }
106
- // Move apiKey from params
107
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
108
- options.apiKey = options.params.apiKey;
109
- delete options.params.apiKey;
110
- }
111
- return this.axios(__assign(__assign({ method: 'post', url: path, data: data, maxContentLength: Infinity, maxBodyLength: Infinity }, options), this.headers(options)))
112
- .then(function (res) { return res.data; })
113
- .catch(this.handleError);
114
- };
115
- Client.prototype._put = function (path, data, options) {
116
- var _a;
117
- if (options === void 0) { options = {}; }
118
- // Move apiKey from params
119
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
120
- options.apiKey = options.params.apiKey;
121
- delete options.params.apiKey;
122
- }
123
- return this.axios(__assign(__assign({ method: 'put', url: path, data: data }, options), this.headers(options)))
124
- .then(function (res) { return res.data; })
125
- .catch(this.handleError);
126
- };
127
- Client.prototype._delete = function (path, options) {
128
- var _a;
129
- if (options === void 0) { options = {}; }
130
- // Move apiKey from params
131
- if ((_a = options.params) === null || _a === void 0 ? void 0 : _a.apiKey) {
132
- options.apiKey = options.params.apiKey;
133
- delete options.params.apiKey;
134
- }
135
- return this.axios(__assign(__assign({ method: 'delete', url: path }, options), this.headers(options)))
136
- .then(function (res) { return res.data; })
137
- .catch(this.handleError);
138
- };
139
- // Subscribe to named channel - errors and messages are delivered via the callback
140
- Client.prototype._subscribe = function (channel, cb) {
141
- if (!this.webSocketGateway.isConnected) {
142
- this.webSocketGateway.connect();
143
- }
144
- return this.webSocketGateway.subscribe(channel, cb);
145
- };
146
- // Unsubscribe from named channel - optional callback is called on completion
147
- Client.prototype._unsubscribe = function (channel, cb) {
148
- if (!this.webSocketGateway.isConnected) {
149
- this.webSocketGateway.connect();
150
- }
151
- this.webSocketGateway.unsubscribe(channel, cb);
152
- };
153
- /**
154
- * Normalize errors
155
- * Throws a new error based on type of input error
156
- *
157
- * @param {AxiosError} e
158
- */
159
- Client.prototype.handleError = function (e) {
160
- // Flow API error
161
- if (e.response && e.response.data) {
162
- if (typeof e.response.data === 'object') {
163
- var data = e.response.data;
164
- throw new FlowEngineError(data.message || data.error, data.error, e.response.status);
165
- }
166
- else if (typeof e.response.data === 'string') {
167
- throw new FlowEngineError(e.response.data, null, e.response.status);
168
- }
169
- }
170
- // Generic error
171
- // Don't leak information in error
172
- var cleanError = e;
173
- delete cleanError.config;
174
- delete cleanError.request;
175
- delete cleanError.response;
176
- throw new FlowEngineError(cleanError.message, cleanError);
177
- };
178
- Client.prototype.headers = function (options) {
179
- var headers = options.headers || {};
180
- if (options.apiKey || this.apiKey) {
181
- headers['X-Api-Key'] = options.apiKey || this.apiKey;
182
- }
183
- // Add default auth header if token supplied and not already set in options
184
- if (this.accessToken) {
185
- headers.Authorization = headers.Authorization || "Bearer ".concat(this.accessToken);
186
- }
187
- return { headers: headers };
188
- };
189
- return Client;
190
- }());
191
- export { Client };
192
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/lib/client.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;AAEH,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;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M,IAAI,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC/C,MAAM,IAAI,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;QAED,gBAAgB;QAEhB,kCAAkC;QAClC,IAAM,UAAU,GAAQ,CAAC,CAAC;QAC1B,OAAO,UAAU,CAAC,MAAM,CAAC;QACzB,OAAO,UAAU,CAAC,OAAO,CAAC;QAC1B,OAAO,UAAU,CAAC,QAAQ,CAAC;QAE3B,MAAM,IAAI,eAAe,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC5D,CAAC;IAEO,wBAAO,GAAf,UAAgB,OAAY;QAC1B,IAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;QAEtC,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;QACvD,CAAC;QAED,2EAA2E;QAC3E,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,iBAAU,IAAI,CAAC,WAAW,CAAE,CAAC;QAChF,CAAC;QAED,OAAO,EAAE,OAAO,SAAA,EAAE,CAAC;IACrB,CAAC;IACH,aAAC;AAAD,CAAC,AArMD,IAqMC","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport Axios, { AxiosError, AxiosInstance } from 'axios';\nimport Debug from 'debug';\nimport { IConfig } from './api-interfaces';\nimport { ApiKeyEndpoints } from './apikey.endpoints';\nimport { AppConfigEndpoints } from './appconfig.endpoints';\nimport { ApplicationEndpoints } from './application.endpoints';\nimport { AuthEndpoints } from './auth.edpoints';\nimport { ContactPointEndpoints } from './contact-point.endpoints';\nimport { DatabaseEndpoints } from './database.endpoints';\nimport { DatasetEndpoints } from './dataset.endpoints';\nimport { FlowEngineError } from './errors';\nimport { JobEndpoints } from './job.endpoints';\nimport { MapEndpoints } from './map.endoints';\nimport { MapLayerEndpoints } from './maplayer.endpoints';\nimport { MediaEndpoints } from './media.endpoints';\nimport { PipelineEndpoints } from './pipeline.endpoints';\nimport { StyleEndpoints } from './style.endpoint';\nimport { TileSourceEndpoints } from './tile-source.endpoints';\nimport { TileEndpoints } from './tile.endpoints';\nimport { UploadEndpoints } from './upload.endpoints';\nimport {\n WebSocketGateway,\n WebSocketManagerOptions,\n WebSocketSubscribeCallback,\n WebSocketUnsubscribeCallback,\n WebSocketUnsubscriber\n} from './web-socket-gateway';\n\nexport type ClientOptions = WebSocketManagerOptions;\n\nexport class Client {\n private readonly axios: AxiosInstance;\n readonly debug = Debug('flow-engine-client');\n\n public webSocketGateway: WebSocketGateway;\n\n accessToken: string | null = null;\n\n auth = new AuthEndpoints(this);\n tiles = new TileEndpoints(this);\n maps = new MapEndpoints(this);\n apiKeys = new ApiKeyEndpoints(this);\n applications = new ApplicationEndpoints(this);\n appconfig = new AppConfigEndpoints(this);\n contactpoints = new ContactPointEndpoints(this);\n databases = new DatabaseEndpoints(this);\n datasets = new DatasetEndpoints(this);\n styles = new StyleEndpoints(this);\n tileSources = new TileSourceEndpoints(this);\n uploads = new UploadEndpoints(this);\n jobs = new JobEndpoints(this);\n maplayers = new MapLayerEndpoints(this);\n media = new MediaEndpoints(this);\n pipelines = new PipelineEndpoints(this);\n\n useRequestInterceptor(interceptor: (config: any) => any) {\n return this.axios.interceptors.request.use(interceptor);\n }\n\n ejectRequestInterceptor(id: number) {\n this.axios.interceptors.request.eject(id);\n }\n\n constructor(public baseUrl: string, public readonly apiKey: string | null = null, options?: ClientOptions) {\n this.axios = Axios.create({\n baseURL: baseUrl,\n maxContentLength: 524288000,\n transformResponse: [\n function transformResponse(data, headers) {\n if (headers?.['content-type']?.startsWith('application/json')) {\n // Force parsing of data if expected content type is JSON\n // This ensures that errors are thrown if JSON is truncated due to a query timeout\n // (default Axios behavior is simply to return a string if JSON parsing fails)\n return JSON.parse(data);\n }\n\n return data;\n }\n ]\n });\n\n this.webSocketGateway = new WebSocketGateway(this, options);\n }\n\n connect(): Promise<void> {\n return this.webSocketGateway.connect();\n }\n\n disconnect(): Promise<void> {\n return this.webSocketGateway.disconnect();\n }\n\n config(): Promise<IConfig> {\n return this._get('/api/v1/config');\n }\n\n _get(path: string, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'get',\n url: path,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n _post(path: string, data: object, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'post',\n url: path,\n data,\n maxContentLength: Infinity,\n maxBodyLength: Infinity,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n _put(path: string, data: object, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'put',\n url: path,\n data,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n _delete(path: string, options: any = {}): Promise<any> {\n // Move apiKey from params\n if (options.params?.apiKey) {\n options.apiKey = options.params.apiKey;\n delete options.params.apiKey;\n }\n\n return this.axios({\n method: 'delete',\n url: path,\n ...options,\n ...this.headers(options)\n })\n .then(res => res.data)\n .catch(this.handleError);\n }\n\n // Subscribe to named channel - errors and messages are delivered via the callback\n _subscribe(channel: string, cb: WebSocketSubscribeCallback): WebSocketUnsubscriber {\n if (!this.webSocketGateway.isConnected) {\n this.webSocketGateway.connect();\n }\n\n return this.webSocketGateway.subscribe(channel, cb);\n }\n\n // Unsubscribe from named channel - optional callback is called on completion\n _unsubscribe(channel: string, cb?: WebSocketUnsubscribeCallback) {\n if (!this.webSocketGateway.isConnected) {\n this.webSocketGateway.connect();\n }\n this.webSocketGateway.unsubscribe(channel, cb);\n }\n\n /**\n * Normalize errors\n * Throws a new error based on type of input error\n *\n * @param {AxiosError} e\n */\n private handleError(e: AxiosError) {\n // Flow API error\n if (e.response && e.response.data) {\n if (typeof e.response.data === 'object') {\n const data: any = e.response.data;\n throw new FlowEngineError(data.message || data.error, data.error, e.response.status);\n } else if (typeof e.response.data === 'string') {\n throw new FlowEngineError(e.response.data, null, e.response.status);\n }\n }\n\n // Generic error\n\n // Don't leak information in error\n const cleanError: any = e;\n delete cleanError.config;\n delete cleanError.request;\n delete cleanError.response;\n\n throw new FlowEngineError(cleanError.message, cleanError);\n }\n\n private headers(options: any) {\n const headers = options.headers || {};\n\n if (options.apiKey || this.apiKey) {\n headers['X-Api-Key'] = options.apiKey || this.apiKey;\n }\n\n // Add default auth header if token supplied and not already set in options\n if (this.accessToken) {\n headers.Authorization = headers.Authorization || `Bearer ${this.accessToken}`;\n }\n\n return { headers };\n }\n}\n"]}
@@ -1,43 +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 ContactPointEndpoints = /** @class */ (function (_super) {
21
- __extends(ContactPointEndpoints, _super);
22
- function ContactPointEndpoints(client) {
23
- return _super.call(this, client, 'contactpoints') || this;
24
- }
25
- /**
26
- * Send a notification to a contact point.
27
- */
28
- ContactPointEndpoints.prototype.send = function (contactPointId, params) {
29
- if (params === void 0) { params = {}; }
30
- return this.client._post("".concat(this.resourceEndpoint, "/").concat(contactPointId, "/send"), params);
31
- };
32
- /**
33
- * Get a list of available contact point drivers. Supported types include 'email', 'slack', 'teams', 'sns'.
34
- *
35
- * Drivers have different required parameters - refer to documentation for details.
36
- */
37
- ContactPointEndpoints.prototype.drivers = function () {
38
- return this.client._get("".concat(this.resourceEndpoint, "/drivers"));
39
- };
40
- return ContactPointEndpoints;
41
- }(BaseEndpoints));
42
- export { ContactPointEndpoints };
43
- //# sourceMappingURL=contact-point.endpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contact-point.endpoints.js","sourceRoot":"","sources":["../../../src/lib/contact-point.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD;IAA2C,yCAA4B;IACrE,+BAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,eAAe,CAAC,SAAC;IACjC,CAAC;IAED;;OAEG;IACH,oCAAI,GAAJ,UAAK,cAAsB,EAAE,MAAqC;QAArC,uBAAA,EAAA,WAAqC;QAChE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAG,IAAI,CAAC,gBAAgB,cAAI,cAAc,UAAO,EAAE,MAAM,CAAC,CAAC;IACtF,CAAC;IAED;;;;OAIG;IACH,uCAAO,GAAP;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAG,IAAI,CAAC,gBAAgB,aAAU,CAAC,CAAC;IAC9D,CAAC;IACH,4BAAC;AAAD,CAAC,AApBD,CAA2C,aAAa,GAoBvD","sourcesContent":["/**\n * Copyright © 2018-present Emu Analytics\n */\n\nimport { IContactPoint, IContactPointSendRequest } from './api-interfaces';\nimport { BaseEndpoints } from './base.endpoints';\nimport { Client } from './client';\n\nexport class ContactPointEndpoints extends BaseEndpoints<IContactPoint> {\n constructor(client: Client) {\n super(client, 'contactpoints');\n }\n\n /**\n * Send a notification to a contact point.\n */\n send(contactPointId: string, params: IContactPointSendRequest = {}): Promise<void> {\n return this.client._post(`${this.resourceEndpoint}/${contactPointId}/send`, params);\n }\n\n /**\n * Get a list of available contact point drivers. Supported types include 'email', 'slack', 'teams', 'sns'.\n *\n * Drivers have different required parameters - refer to documentation for details.\n */\n drivers(): Promise<string[]> {\n return this.client._get(`${this.resourceEndpoint}/drivers`);\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 DatabaseEndpoints = /** @class */ (function (_super) {
21
- __extends(DatabaseEndpoints, _super);
22
- function DatabaseEndpoints(client) {
23
- return _super.call(this, client, 'databases') || this;
24
- }
25
- DatabaseEndpoints.prototype.drivers = function () {
26
- return this.client._get("/api/v1/databases/drivers").catch(function (e) {
27
- if (e.status === 404) {
28
- // Backwards compatibility for pre-1.0.0 Flo.w
29
- return ['postgis', 'postgis-mapnik'];
30
- }
31
- });
32
- };
33
- return DatabaseEndpoints;
34
- }(BaseEndpoints));
35
- export { DatabaseEndpoints };
36
- //# sourceMappingURL=database.endpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database.endpoints.js","sourceRoot":"","sources":["../../../src/lib/database.endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD;IAAuC,qCAAwB;IAC7D,2BAAY,MAAc;QACxB,OAAA,MAAK,YAAC,MAAM,EAAE,WAAW,CAAC,SAAC;IAC7B,CAAC;IAED,mCAAO,GAAP;QACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,KAAK,CAAC,UAAA,CAAC;YAC1D,IAAI,CAAC,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBACrB,8CAA8C;gBAC9C,OAAO,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IACH,wBAAC;AAAD,CAAC,AAbD,CAAuC,aAAa,GAanD","sourcesContent":["/**\n * Copyright © 2018 Emu Analytics\n */\n\nimport { Client } from './client';\nimport { BaseEndpoints } from './base.endpoints';\nimport { IDatabase } from './api-interfaces';\n\nexport class DatabaseEndpoints extends BaseEndpoints<IDatabase> {\n constructor(client: Client) {\n super(client, 'databases');\n }\n\n drivers(): Promise<string[]> {\n return this.client._get(`/api/v1/databases/drivers`).catch(e => {\n if (e.status === 404) {\n // Backwards compatibility for pre-1.0.0 Flo.w\n return ['postgis', 'postgis-mapnik'];\n }\n });\n }\n}\n"]}