@or-sdk/idw-public 1.0.1
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/CHANGELOG.md +11 -0
- package/README.md +1 -0
- package/dist/cjs/IdwPublic.js +30 -0
- package/dist/cjs/IdwPublic.js.map +1 -0
- package/dist/cjs/constants.js +5 -0
- package/dist/cjs/constants.js.map +1 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/config.js +3 -0
- package/dist/cjs/types/config.js.map +1 -0
- package/dist/cjs/types/idwPublic.js +10 -0
- package/dist/cjs/types/idwPublic.js.map +1 -0
- package/dist/cjs/types/index.js +19 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/esm/IdwPublic.js +24 -0
- package/dist/esm/IdwPublic.js.map +1 -0
- package/dist/esm/constants.js +2 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/config.js +2 -0
- package/dist/esm/types/config.js.map +1 -0
- package/dist/esm/types/idwPublic.js +7 -0
- package/dist/esm/types/idwPublic.js.map +1 -0
- package/dist/esm/types/index.js +3 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/types/IdwPublic.d.ts +9 -0
- package/dist/types/IdwPublic.d.ts.map +1 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +7 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/idwPublic.d.ts +35 -0
- package/dist/types/types/idwPublic.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/package.json +30 -0
- package/src/IdwPublic.ts +41 -0
- package/src/constants.ts +1 -0
- package/src/index.ts +2 -0
- package/src/types/config.ts +18 -0
- package/src/types/idwPublic.ts +41 -0
- package/src/types/index.ts +2 -0
- package/tsconfig.dev.json +8 -0
- package/tsconfig.esm.json +12 -0
- package/tsconfig.json +7 -0
- package/tsconfig.types.json +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 1.0.1 (2023-09-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **@or-sdk/idw-public:** implement public idw api ([bb9f33f](https://gitlab.internal.onereach.io/onereach/platform/or-sdk-next/commit/bb9f33ff890c7915db26ae5b8eacd71a54b69a4f))
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Installation:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdwPublic = void 0;
|
|
4
|
+
var providers_1 = require("@or-sdk/providers");
|
|
5
|
+
var constants_1 = require("./constants");
|
|
6
|
+
var IdwPublic = (function () {
|
|
7
|
+
function IdwPublic(_a) {
|
|
8
|
+
var serviceDiscoveryUrl = _a.serviceDiscoveryUrl, emUrl = _a.emUrl, _b = _a.providerAccountId, providerAccountId = _b === void 0 ? undefined : _b, _c = _a.idwProviderNameSpace, idwProviderNameSpace = _c === void 0 ? constants_1.IDW_PROVIDER_NAME_SPACE : _c;
|
|
9
|
+
this.provider = new providers_1.Providers({
|
|
10
|
+
token: function () { return ''; },
|
|
11
|
+
eventManagerUrl: emUrl,
|
|
12
|
+
providersAccountId: providerAccountId,
|
|
13
|
+
discoveryUrl: serviceDiscoveryUrl,
|
|
14
|
+
});
|
|
15
|
+
this.idwProviderNameSpace = idwProviderNameSpace;
|
|
16
|
+
}
|
|
17
|
+
IdwPublic.prototype.getIdwInfoWithStatistic = function (params) {
|
|
18
|
+
return this.provider.makeRequest({
|
|
19
|
+
route: this.buildRoute('public'),
|
|
20
|
+
method: 'GET',
|
|
21
|
+
params: params,
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
IdwPublic.prototype.buildRoute = function (route) {
|
|
25
|
+
return "".concat(this.idwProviderNameSpace, "/").concat(route);
|
|
26
|
+
};
|
|
27
|
+
return IdwPublic;
|
|
28
|
+
}());
|
|
29
|
+
exports.IdwPublic = IdwPublic;
|
|
30
|
+
//# sourceMappingURL=IdwPublic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdwPublic.js","sourceRoot":"","sources":["../../src/IdwPublic.ts"],"names":[],"mappings":";;;AACA,+CAA8C;AAC9C,yCAAsD;AAEtD;IAIE,mBACE,EAKkB;YAJhB,mBAAmB,yBAAA,EACnB,KAAK,WAAA,EACL,yBAA6B,EAA7B,iBAAiB,mBAAG,SAAS,KAAA,EAC7B,4BAA8C,EAA9C,oBAAoB,mBAAG,mCAAuB,KAAA;QAEhD,IAAI,CAAC,QAAQ,GAAG,IAAI,qBAAS,CAAC;YAE5B,KAAK,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;YACf,eAAe,EAAE,KAAK;YACtB,kBAAkB,EAAE,iBAAiB;YACrC,YAAY,EAAE,mBAAmB;SAClC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAKD,2CAAuB,GAAvB,UAAwB,MAAuB;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;YAC/B,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,MAAM,QAAA;SACP,CAAC,CAAC;IACL,CAAC;IAEO,8BAAU,GAAlB,UAAmB,KAAa;QAC9B,OAAO,UAAG,IAAI,CAAC,oBAAoB,cAAI,KAAK,CAAE,CAAC;IACjD,CAAC;IAEH,gBAAC;AAAD,CAAC,AApCD,IAoCC;AApCY,8BAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.IdwPublic = void 0;
|
|
18
|
+
var IdwPublic_1 = require("./IdwPublic");
|
|
19
|
+
Object.defineProperty(exports, "IdwPublic", { enumerable: true, get: function () { return IdwPublic_1.IdwPublic; } });
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InitializationStatusEnum = void 0;
|
|
4
|
+
var InitializationStatusEnum;
|
|
5
|
+
(function (InitializationStatusEnum) {
|
|
6
|
+
InitializationStatusEnum["IN_PROGRESS"] = "IN_PROGRESS";
|
|
7
|
+
InitializationStatusEnum["COMPLETED"] = "COMPLETED";
|
|
8
|
+
InitializationStatusEnum["CANCELED"] = "CANCELED";
|
|
9
|
+
})(InitializationStatusEnum = exports.InitializationStatusEnum || (exports.InitializationStatusEnum = {}));
|
|
10
|
+
//# sourceMappingURL=idwPublic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idwPublic.js","sourceRoot":"","sources":["../../../src/types/idwPublic.ts"],"names":[],"mappings":";;;AAcA,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,uDAAyB,CAAA;IACzB,mDAAqB,CAAA;IACrB,iDAAmB,CAAA;AACrB,CAAC,EAJW,wBAAwB,GAAxB,gCAAwB,KAAxB,gCAAwB,QAInC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config"), exports);
|
|
18
|
+
__exportStar(require("./idwPublic"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,8CAA4B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Providers } from '@or-sdk/providers';
|
|
2
|
+
import { IDW_PROVIDER_NAME_SPACE } from './constants';
|
|
3
|
+
export class IdwPublic {
|
|
4
|
+
constructor({ serviceDiscoveryUrl, emUrl, providerAccountId = undefined, idwProviderNameSpace = IDW_PROVIDER_NAME_SPACE, }) {
|
|
5
|
+
this.provider = new Providers({
|
|
6
|
+
token: () => '',
|
|
7
|
+
eventManagerUrl: emUrl,
|
|
8
|
+
providersAccountId: providerAccountId,
|
|
9
|
+
discoveryUrl: serviceDiscoveryUrl,
|
|
10
|
+
});
|
|
11
|
+
this.idwProviderNameSpace = idwProviderNameSpace;
|
|
12
|
+
}
|
|
13
|
+
getIdwInfoWithStatistic(params) {
|
|
14
|
+
return this.provider.makeRequest({
|
|
15
|
+
route: this.buildRoute('public'),
|
|
16
|
+
method: 'GET',
|
|
17
|
+
params,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
buildRoute(route) {
|
|
21
|
+
return `${this.idwProviderNameSpace}/${route}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=IdwPublic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdwPublic.js","sourceRoot":"","sources":["../../src/IdwPublic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,OAAO,SAAS;IAIpB,YACE,EACE,mBAAmB,EACnB,KAAK,EACL,iBAAiB,GAAG,SAAS,EAC7B,oBAAoB,GAAG,uBAAuB,GAC9B;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,SAAS,CAAC;YAE5B,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE;YACf,eAAe,EAAE,KAAK;YACtB,kBAAkB,EAAE,iBAAiB;YACrC,YAAY,EAAE,mBAAmB;SAClC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAKD,uBAAuB,CAAC,MAAuB;QAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;YAC/B,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAEO,UAAU,CAAC,KAAa;QAC9B,OAAO,GAAG,IAAI,CAAC,oBAAoB,IAAI,KAAK,EAAE,CAAC;IACjD,CAAC;CAEF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var InitializationStatusEnum;
|
|
2
|
+
(function (InitializationStatusEnum) {
|
|
3
|
+
InitializationStatusEnum["IN_PROGRESS"] = "IN_PROGRESS";
|
|
4
|
+
InitializationStatusEnum["COMPLETED"] = "COMPLETED";
|
|
5
|
+
InitializationStatusEnum["CANCELED"] = "CANCELED";
|
|
6
|
+
})(InitializationStatusEnum || (InitializationStatusEnum = {}));
|
|
7
|
+
//# sourceMappingURL=idwPublic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idwPublic.js","sourceRoot":"","sources":["../../../src/types/idwPublic.ts"],"names":[],"mappings":"AAcA,MAAM,CAAN,IAAY,wBAIX;AAJD,WAAY,wBAAwB;IAClC,uDAAyB,CAAA;IACzB,mDAAqB,CAAA;IACrB,iDAAmB,CAAA;AACrB,CAAC,EAJW,wBAAwB,KAAxB,wBAAwB,QAInC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IDWPublicConfig, IdwPublicInfoWithStatistic, IdwPublicParams } from './types';
|
|
2
|
+
export declare class IdwPublic {
|
|
3
|
+
private readonly provider;
|
|
4
|
+
private readonly idwProviderNameSpace;
|
|
5
|
+
constructor({ serviceDiscoveryUrl, emUrl, providerAccountId, idwProviderNameSpace, }: IDWPublicConfig);
|
|
6
|
+
getIdwInfoWithStatistic(params: IdwPublicParams): Promise<IdwPublicInfoWithStatistic>;
|
|
7
|
+
private buildRoute;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=IdwPublic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdwPublic.d.ts","sourceRoot":"","sources":["../../src/IdwPublic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAIvF,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAY;IACrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;gBAG5C,EACE,mBAAmB,EACnB,KAAK,EACL,iBAA6B,EAC7B,oBAA8C,GAC/C,EAAE,eAAe;IAcpB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQrF,OAAO,CAAC,UAAU;CAInB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAI5B,KAAK,EAAE,MAAM,CAAC;IAId,mBAAmB,EAAE,MAAM,CAAC;IAI5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAI3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type IdwPublicParams = {
|
|
2
|
+
idwSlug: string;
|
|
3
|
+
};
|
|
4
|
+
export interface ActiveFlowTotalCounter {
|
|
5
|
+
activeFlowTotal: number;
|
|
6
|
+
}
|
|
7
|
+
export interface TotalStepsCounter {
|
|
8
|
+
totalSteps: number;
|
|
9
|
+
}
|
|
10
|
+
export declare enum InitializationStatusEnum {
|
|
11
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
12
|
+
COMPLETED = "COMPLETED",
|
|
13
|
+
CANCELED = "CANCELED"
|
|
14
|
+
}
|
|
15
|
+
export interface IdwPublicBaseInfo {
|
|
16
|
+
slug: string;
|
|
17
|
+
name: string;
|
|
18
|
+
role?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
avatar?: string;
|
|
21
|
+
initializationStatus?: InitializationStatusEnum;
|
|
22
|
+
}
|
|
23
|
+
export interface IdwPublicInfoWithStatistic extends IdwPublicBaseInfo, ActiveFlowTotalCounter, TotalStepsCounter {
|
|
24
|
+
channels: number;
|
|
25
|
+
memory: number;
|
|
26
|
+
wisdom: number;
|
|
27
|
+
skills: number;
|
|
28
|
+
lastActivationTime: number | null;
|
|
29
|
+
isOnline: boolean;
|
|
30
|
+
totalSteps: number;
|
|
31
|
+
totalSkillSteps: number;
|
|
32
|
+
totalChannelSteps: number;
|
|
33
|
+
domain: number;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=idwPublic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idwPublic.d.ts","sourceRoot":"","sources":["../../../src/types/idwPublic.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,oBAAY,wBAAwB;IAClC,WAAW,gBAAc;IACzB,SAAS,cAAY;IACrB,QAAQ,aAAW;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB,CAAC,EAAE,wBAAwB,CAAC;CACjD;AAED,MAAM,WAAW,0BAA2B,SAAQ,iBAAiB,EAAE,sBAAsB,EAAE,iBAAiB;IAC9G,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.1",
|
|
3
|
+
"name": "@or-sdk/idw-public",
|
|
4
|
+
"main": "dist/cjs/index.js",
|
|
5
|
+
"module": "dist/esm/index.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "pnpm clean && pnpm build:esm && pnpm build:cjs",
|
|
9
|
+
"build:cjs": "tsc --project tsconfig.json",
|
|
10
|
+
"build:esm": "tsc --project tsconfig.esm.json",
|
|
11
|
+
"build:types": "tsc --project tsconfig.types.json",
|
|
12
|
+
"build:watch": "concurrently -r --hide 1,2 \"pnpm build:watch:cjs\" \"pnpm build:watch:esm\" \"pnpm build:watch:types\"",
|
|
13
|
+
"build:watch:cjs": "tsc --project tsconfig.json -w",
|
|
14
|
+
"build:watch:esm": "tsc --project tsconfig.esm.json -w",
|
|
15
|
+
"build:watch:types": "tsc --project tsconfig.types.json -w",
|
|
16
|
+
"clean": "rm -rf ./dist",
|
|
17
|
+
"dev": "pnpm build:watch:esm"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"concurrently": "^6.4.0",
|
|
21
|
+
"typescript": "^4.4.4"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@or-sdk/providers": "^0.2.5"
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "59296a99275481b0176d9d70fd54852a6220ba20"
|
|
30
|
+
}
|
package/src/IdwPublic.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IDWPublicConfig, IdwPublicInfoWithStatistic, IdwPublicParams } from './types';
|
|
2
|
+
import { Providers } from '@or-sdk/providers';
|
|
3
|
+
import { IDW_PROVIDER_NAME_SPACE } from './constants';
|
|
4
|
+
|
|
5
|
+
export class IdwPublic {
|
|
6
|
+
private readonly provider: Providers;
|
|
7
|
+
private readonly idwProviderNameSpace: string;
|
|
8
|
+
|
|
9
|
+
constructor(
|
|
10
|
+
{
|
|
11
|
+
serviceDiscoveryUrl,
|
|
12
|
+
emUrl,
|
|
13
|
+
providerAccountId = undefined,
|
|
14
|
+
idwProviderNameSpace = IDW_PROVIDER_NAME_SPACE,
|
|
15
|
+
}: IDWPublicConfig) {
|
|
16
|
+
this.provider = new Providers({
|
|
17
|
+
// it's public instance of api, so token not needed
|
|
18
|
+
token: () => '',
|
|
19
|
+
eventManagerUrl: emUrl,
|
|
20
|
+
providersAccountId: providerAccountId,
|
|
21
|
+
discoveryUrl: serviceDiscoveryUrl,
|
|
22
|
+
});
|
|
23
|
+
this.idwProviderNameSpace = idwProviderNameSpace;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get extended public info about IDW with statistic
|
|
28
|
+
*/
|
|
29
|
+
getIdwInfoWithStatistic(params: IdwPublicParams): Promise<IdwPublicInfoWithStatistic> {
|
|
30
|
+
return this.provider.makeRequest({
|
|
31
|
+
route: this.buildRoute('public'),
|
|
32
|
+
method: 'GET',
|
|
33
|
+
params,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private buildRoute(route: string): string {
|
|
38
|
+
return `${this.idwProviderNameSpace}/${route}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const IDW_PROVIDER_NAME_SPACE = 'idw-provider';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type IDWPublicConfig = {
|
|
2
|
+
/**
|
|
3
|
+
* Event Manager url
|
|
4
|
+
*/
|
|
5
|
+
emUrl: string;
|
|
6
|
+
/**
|
|
7
|
+
* service Discovery url
|
|
8
|
+
*/
|
|
9
|
+
serviceDiscoveryUrl: string;
|
|
10
|
+
/**
|
|
11
|
+
* onereach account ID
|
|
12
|
+
*/
|
|
13
|
+
providerAccountId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Provider NameSpace
|
|
16
|
+
*/
|
|
17
|
+
idwProviderNameSpace?: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type IdwPublicParams = {
|
|
2
|
+
idwSlug: string;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
// todo copy-paste form @or-sdk/idw.
|
|
6
|
+
// We should move type to separate package aka 'idw-types' to share it between "public" and "private" instance of sdk
|
|
7
|
+
export interface ActiveFlowTotalCounter {
|
|
8
|
+
activeFlowTotal: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface TotalStepsCounter {
|
|
12
|
+
totalSteps: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum InitializationStatusEnum {
|
|
16
|
+
IN_PROGRESS='IN_PROGRESS',
|
|
17
|
+
COMPLETED='COMPLETED',
|
|
18
|
+
CANCELED='CANCELED',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface IdwPublicBaseInfo {
|
|
22
|
+
slug: string;
|
|
23
|
+
name: string;
|
|
24
|
+
role?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
avatar?: string;
|
|
27
|
+
initializationStatus?: InitializationStatusEnum;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface IdwPublicInfoWithStatistic extends IdwPublicBaseInfo, ActiveFlowTotalCounter, TotalStepsCounter {
|
|
31
|
+
channels: number;
|
|
32
|
+
memory: number;
|
|
33
|
+
wisdom: number;
|
|
34
|
+
skills: number;
|
|
35
|
+
lastActivationTime: number | null;
|
|
36
|
+
isOnline: boolean;
|
|
37
|
+
totalSteps: number;
|
|
38
|
+
totalSkillSteps: number;
|
|
39
|
+
totalChannelSteps: number;
|
|
40
|
+
domain: number;
|
|
41
|
+
}
|
package/tsconfig.json
ADDED