@or-sdk/discovery 1.2.0 → 1.3.0-beta.523.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.
@@ -74,6 +74,25 @@ var Discovery = (function (_super) {
74
74
  _this.route = "api/".concat(base_1.VERSION);
75
75
  return _this;
76
76
  }
77
+ Discovery.prototype.getServices = function (type) {
78
+ return __awaiter(this, void 0, void 0, function () {
79
+ var services;
80
+ return __generator(this, function (_a) {
81
+ switch (_a.label) {
82
+ case 0: return [4, this.callApi({
83
+ method: 'GET',
84
+ route: "".concat(this.route, "/services"),
85
+ params: {
86
+ type: type,
87
+ },
88
+ })];
89
+ case 1:
90
+ services = (_a.sent()).services;
91
+ return [2, services];
92
+ }
93
+ });
94
+ });
95
+ };
77
96
  Discovery.prototype.getServiceUrl = function (serviceName) {
78
97
  return __awaiter(this, void 0, void 0, function () {
79
98
  var url;
@@ -1 +1 @@
1
- {"version":3,"file":"Discovery.js","sourceRoot":"","sources":["../../src/Discovery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAuE;AAWvE;IAA+B,6BAAI;IASjC,mBAAY,EAAwC;YAAtC,KAAK,WAAA,EAAE,YAAY,kBAAA;QAAjC,YACE,kBAAM;YACJ,KAAK,EAAE,KAAM;YACb,UAAU,EAAE,YAAY;YACxB,UAAU,EAAE,EAAE;SACf,CAAC,SACH;QAdgB,WAAK,GAAG,cAAO,cAAO,CAAE,CAAC;;IAc1C,CAAC;IAQY,iCAAa,GAA1B,UAA2B,WAAmB;;;;;4BAC5B,WAAM,IAAI,CAAC,OAAO,CAA2B;4BAC3D,MAAM,EAAE,KAAK;4BACb,KAAK,EAAE,IAAI,CAAC,KAAK;4BACjB,MAAM,EAAE;gCACN,WAAW,aAAA;6BACZ;yBACF,CAAC,EAAA;;wBANM,GAAG,GAAK,CAAA,SAMd,CAAA,IANS;w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;4BACb,KAAK,EAAE,IAAI,CAAC,KAAK;4BACjB,MAAM,EAAE;gCACN,WAAW,aAAA;6BACZ;yBACF,CAAC,EAAA;;wBANM,GAAG,GAAK,CAAA,SAMd,CAAA,IANS;wBAQX,WAAO,GAAG,EAAC;;;;KACZ;IAQY,kCAAc,GAA3B,UAA4B,YAAsB;;;;;;;wBAC1C,SAAS,qBAAO,IAAI,GAAG,CAAC,YAAY,CAA6B,OAAC,CAAC;wBAC1D,WAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,UAAA,WAAW,IAAI,OAAA,KAAI,CAAC,aAAa,CAAC,WAAW,CAAC,EAA/B,CAA+B,CAAC,CAAC,EAAA;;wBAAzF,MAAM,GAAG,SAAgF;wBAE/F,WAAO,MAAM,EAAC;;;;KACf;IACH,gBAAC;AAAD,CAAC,AAjED,CAA+B,WAAI,GAiElC;AAjEY,8BAAS"}
@@ -17,6 +17,18 @@ export class Discovery extends Base {
17
17
  });
18
18
  this.route = `api/${VERSION}`;
19
19
  }
20
+ getServices(type) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ const { services } = yield this.callApi({
23
+ method: 'GET',
24
+ route: `${this.route}/services`,
25
+ params: {
26
+ type,
27
+ },
28
+ });
29
+ return services;
30
+ });
31
+ }
20
32
  getServiceUrl(serviceName) {
21
33
  return __awaiter(this, void 0, void 0, function* () {
22
34
  const { url } = yield this.callApi({
@@ -1 +1 @@
1
- {"version":3,"file":"Discovery.js","sourceRoot":"","sources":["../../src/Discovery.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAA4B,OAAO,EAAE,MAAM,cAAc,CAAC;AAWvE,MAAM,OAAO,SAAU,SAAQ,IAAI;IASjC,YAAY,EAAE,KAAK,EAAE,YAAY,EAAmB;QAClD,KAAK,CAAC;YACJ,KAAK,EAAE,KAAM;YACb,UAAU,EAAE,YAAY;YACxB,UAAU,EAAE,EAAE;SACf,CAAC,CAAC;QAbY,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AO,QAAQ,CAAC;QAClB,CAAC;KAAA;IAQY,aAAa,CAAC,WAAmB;;YAC5C,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAA2B;gBAC3D,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE;oBACN,WAAW;iBACZ;aACF,CAAC,CAAC;YAEH,OAAO,GAAG,CAAC;QACb,CAAC;KAAA;IAQY,cAAc,CAAC,YAAsB;;YAChD,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAA6B,CAAC,CAAC;YACzE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;YAEhG,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF"}
@@ -1,8 +1,9 @@
1
1
  import { Base } from '@or-sdk/base';
2
- import { DiscoveryConfig } from './types';
2
+ import { DiscoveryConfig, Service } from './types';
3
3
  export declare class Discovery extends Base {
4
4
  private readonly route;
5
5
  constructor({ token, discoveryUrl }: DiscoveryConfig);
6
+ getServices(type?: string): Promise<Service[]>;
6
7
  getServiceUrl(serviceName: string): Promise<string>;
7
8
  getServiceUrls(serviceNames: string[]): Promise<string[]>;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Discovery.d.ts","sourceRoot":"","sources":["../../src/Discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAqC,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,eAAe,EAAwB,MAAM,SAAS,CAAC;AAUhE,qBAAa,SAAU,SAAQ,IAAI;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;gBAQ9B,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,eAAe;IAcvC,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAkBnD,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAMvE"}
1
+ {"version":3,"file":"Discovery.d.ts","sourceRoot":"","sources":["../../src/Discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAqC,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,eAAe,EAAwB,OAAO,EAAE,MAAM,SAAS,CAAC;AAUzE,qBAAa,SAAU,SAAQ,IAAI;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;gBAQ9B,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,eAAe;IAcvC,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAkB9C,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAkBnD,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAMvE"}
@@ -3,6 +3,19 @@ export declare type DiscoveryConfig = {
3
3
  token?: Token;
4
4
  discoveryUrl: string;
5
5
  };
6
+ export declare type ServiceTranslation = {
7
+ label: string;
8
+ };
9
+ export declare type Service = {
10
+ version: string;
11
+ url: string;
12
+ serviceKey: string;
13
+ type: string;
14
+ logo?: string;
15
+ translations?: {
16
+ [language: string]: ServiceTranslation;
17
+ };
18
+ };
6
19
  export declare type GetServiceUrlsResult = {
7
20
  [key: string]: string;
8
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,oBAAY,eAAe,GAAG;IAI5B,KAAK,CAAC,EAAE,KAAK,CAAC;IAKd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,oBAAY,eAAe,GAAG;IAI5B,KAAK,CAAC,EAAE,KAAK,CAAC;IAKd,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE;QAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAAA;KAAE,CAAC;CAC3D,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@or-sdk/discovery",
3
- "version": "1.2.0",
3
+ "version": "1.3.0-beta.523.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -25,6 +25,5 @@
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"
28
- },
29
- "gitHead": "2359a0fc3850132af47bd9e0766b62185e66c986"
28
+ }
30
29
  }
package/src/Discovery.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Base, ServiceDiscoveryResponse, VERSION } from '@or-sdk/base';
2
- import { DiscoveryConfig, GetServiceUrlsResult } from './types';
2
+ import { DiscoveryConfig, GetServiceUrlsResult, Service } from './types';
3
3
  import { convertUrlsResult } from './utils';
4
4
 
5
5
  /**
@@ -26,6 +26,24 @@ export class Discovery extends Base {
26
26
  });
27
27
  }
28
28
 
29
+ /**
30
+ * Get services
31
+ * ```typescript
32
+ * const result = await discovery.getServices('type');
33
+ * ```
34
+ */
35
+ public async getServices(type?: string): Promise<Service[]> {
36
+ const { services } = await this.callApi<{ services: Service[] }>({
37
+ method: 'GET',
38
+ route: `${this.route}/services`,
39
+ params: {
40
+ type,
41
+ },
42
+ });
43
+
44
+ return services;
45
+ }
46
+
29
47
  /**
30
48
  * Get service url
31
49
  * ```typescript
package/src/types.ts CHANGED
@@ -12,6 +12,19 @@ export type DiscoveryConfig = {
12
12
  discoveryUrl: string;
13
13
  };
14
14
 
15
+ export type ServiceTranslation = {
16
+ label: string;
17
+ };
18
+
19
+ export type Service = {
20
+ version: string;
21
+ url: string;
22
+ serviceKey: string;
23
+ type: string;
24
+ logo?: string;
25
+ translations?: { [language: string]: ServiceTranslation },
26
+ };
27
+
15
28
  export type GetServiceUrlsResult = {
16
29
  [key: string]: string;
17
30
  };