@or-sdk/discovery 1.2.0 → 1.3.0-beta.529.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Discovery.js +21 -0
- package/dist/cjs/Discovery.js.map +1 -1
- package/dist/esm/Discovery.js +14 -1
- package/dist/esm/Discovery.js.map +1 -1
- package/dist/types/Discovery.d.ts +3 -2
- package/dist/types/Discovery.d.ts.map +1 -1
- package/dist/types/types.d.ts +17 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/Discovery.ts +21 -2
- package/src/types.ts +18 -0
package/dist/cjs/Discovery.js
CHANGED
|
@@ -74,6 +74,27 @@ var Discovery = (function (_super) {
|
|
|
74
74
|
_this.route = "api/".concat(base_1.VERSION);
|
|
75
75
|
return _this;
|
|
76
76
|
}
|
|
77
|
+
Discovery.prototype.listServices = function (_a) {
|
|
78
|
+
var _b = _a === void 0 ? {} : _a, type = _b.type, feature = _b.feature;
|
|
79
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
+
var services;
|
|
81
|
+
return __generator(this, function (_c) {
|
|
82
|
+
switch (_c.label) {
|
|
83
|
+
case 0: return [4, this.callApi({
|
|
84
|
+
method: 'GET',
|
|
85
|
+
route: "".concat(this.route, "/services"),
|
|
86
|
+
params: {
|
|
87
|
+
type: type,
|
|
88
|
+
feature: feature,
|
|
89
|
+
},
|
|
90
|
+
})];
|
|
91
|
+
case 1:
|
|
92
|
+
services = (_c.sent()).services;
|
|
93
|
+
return [2, (0, base_1.makeList)(services)];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
77
98
|
Discovery.prototype.getServiceUrl = function (serviceName) {
|
|
78
99
|
return __awaiter(this, void 0, void 0, function () {
|
|
79
100
|
var url;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Discovery.js","sourceRoot":"","sources":["../../src/Discovery.ts"],"names":[],"mappings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1C,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,AAlED,CAA+B,WAAI,GAkElC;AAlEY,8BAAS"}
|
package/dist/esm/Discovery.js
CHANGED
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { Base, VERSION } from '@or-sdk/base';
|
|
10
|
+
import { Base, makeList, VERSION } from '@or-sdk/base';
|
|
11
11
|
export class Discovery extends Base {
|
|
12
12
|
constructor({ token, discoveryUrl }) {
|
|
13
13
|
super({
|
|
@@ -17,6 +17,19 @@ export class Discovery extends Base {
|
|
|
17
17
|
});
|
|
18
18
|
this.route = `api/${VERSION}`;
|
|
19
19
|
}
|
|
20
|
+
listServices({ type, feature } = {}) {
|
|
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
|
+
feature,
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
return makeList(services);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
20
33
|
getServiceUrl(serviceName) {
|
|
21
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
35
|
const { url } = yield this.callApi({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Discovery.js","sourceRoot":"","sources":["../../src/Discovery.ts"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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
|
-
import { Base } from '@or-sdk/base';
|
|
2
|
-
import { DiscoveryConfig } from './types';
|
|
1
|
+
import { Base, List } from '@or-sdk/base';
|
|
2
|
+
import { DiscoveryConfig, ListServicesPayload, Service } from './types';
|
|
3
3
|
export declare class Discovery extends Base {
|
|
4
4
|
private readonly route;
|
|
5
5
|
constructor({ token, discoveryUrl }: DiscoveryConfig);
|
|
6
|
+
listServices({ type, feature }?: ListServicesPayload): Promise<List<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,
|
|
1
|
+
{"version":3,"file":"Discovery.d.ts","sourceRoot":"","sources":["../../src/Discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAA+C,MAAM,cAAc,CAAC;AACvF,OAAO,EAAC,eAAe,EAAwB,mBAAmB,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAU5F,qBAAa,SAAU,SAAQ,IAAI;IACjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;gBAQ9B,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,eAAe;IAcvC,YAAY,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAmBjF,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAkBnD,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAMvE"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -3,6 +3,23 @@ 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 ListServicesPayload = {
|
|
10
|
+
type?: string;
|
|
11
|
+
feature?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type Service = {
|
|
14
|
+
version: string;
|
|
15
|
+
url: string;
|
|
16
|
+
serviceKey: string;
|
|
17
|
+
type: string;
|
|
18
|
+
logo?: string;
|
|
19
|
+
translations?: {
|
|
20
|
+
[language: string]: ServiceTranslation;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
6
23
|
export declare type GetServiceUrlsResult = {
|
|
7
24
|
[key: string]: string;
|
|
8
25
|
};
|
|
@@ -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,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,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.
|
|
3
|
+
"version": "1.3.0-beta.529.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
|
-
import { Base, ServiceDiscoveryResponse, VERSION } from '@or-sdk/base';
|
|
2
|
-
import {
|
|
1
|
+
import { Base, List, makeList, ServiceDiscoveryResponse, VERSION } from '@or-sdk/base';
|
|
2
|
+
import {DiscoveryConfig, GetServiceUrlsResult, ListServicesPayload, Service} from './types';
|
|
3
3
|
import { convertUrlsResult } from './utils';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -26,6 +26,25 @@ export class Discovery extends Base {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Get services list
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const result = await discovery.listServices({ type: 'type', feature: 'feature' });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
public async listServices({ type, feature }: ListServicesPayload = {}): Promise<List<Service>> {
|
|
36
|
+
const { services } = await this.callApi<{ services: Service[] }>({
|
|
37
|
+
method: 'GET',
|
|
38
|
+
route: `${this.route}/services`,
|
|
39
|
+
params: {
|
|
40
|
+
type,
|
|
41
|
+
feature,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return makeList(services);
|
|
46
|
+
}
|
|
47
|
+
|
|
29
48
|
/**
|
|
30
49
|
* Get service url
|
|
31
50
|
* ```typescript
|
package/src/types.ts
CHANGED
|
@@ -12,6 +12,24 @@ export type DiscoveryConfig = {
|
|
|
12
12
|
discoveryUrl: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
export type ServiceTranslation = {
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ListServicesPayload = {
|
|
20
|
+
type?: string;
|
|
21
|
+
feature?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type Service = {
|
|
25
|
+
version: string;
|
|
26
|
+
url: string;
|
|
27
|
+
serviceKey: string;
|
|
28
|
+
type: string;
|
|
29
|
+
logo?: string;
|
|
30
|
+
translations?: { [language: string]: ServiceTranslation },
|
|
31
|
+
};
|
|
32
|
+
|
|
15
33
|
export type GetServiceUrlsResult = {
|
|
16
34
|
[key: string]: string;
|
|
17
35
|
};
|