@or-sdk/idw-public 1.1.0-beta.1818.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/README.md +1 -0
- package/dist/cjs/IdwPublic.js +28 -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 +22 -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 +6 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/idwPublic.d.ts +32 -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 +34 -0
- package/src/constants.ts +1 -0
- package/src/index.ts +2 -0
- package/src/types/config.ts +14 -0
- package/src/types/idwPublic.ts +37 -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/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
## Installation:
|
|
@@ -0,0 +1,28 @@
|
|
|
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 providerAccountId = _a.providerAccountId, emUrl = _a.emUrl, _b = _a.idwProviderNameSpace, idwProviderNameSpace = _b === void 0 ? constants_1.IDW_PROVIDER_NAME_SPACE : _b;
|
|
9
|
+
this.provider = new providers_1.Providers({
|
|
10
|
+
token: function () { return ''; },
|
|
11
|
+
eventManagerUrl: emUrl,
|
|
12
|
+
providersAccountId: providerAccountId,
|
|
13
|
+
});
|
|
14
|
+
this.idwProviderNameSpace = idwProviderNameSpace;
|
|
15
|
+
}
|
|
16
|
+
IdwPublic.prototype.getIdwInfoWithStatistic = function () {
|
|
17
|
+
return this.provider.makeRequest({
|
|
18
|
+
route: this.buildRoute('public'),
|
|
19
|
+
method: 'GET',
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
IdwPublic.prototype.buildRoute = function (route) {
|
|
23
|
+
return "".concat(this.idwProviderNameSpace, "/").concat(route);
|
|
24
|
+
};
|
|
25
|
+
return IdwPublic;
|
|
26
|
+
}());
|
|
27
|
+
exports.IdwPublic = IdwPublic;
|
|
28
|
+
//# sourceMappingURL=IdwPublic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdwPublic.js","sourceRoot":"","sources":["../../src/IdwPublic.ts"],"names":[],"mappings":";;;AACA,+CAA8C;AAC9C,yCAAsD;AAGtD;IAIE,mBAAY,EAA6F;YAA3F,iBAAiB,uBAAA,EAAE,KAAK,WAAA,EAAE,4BAA8C,EAA9C,oBAAoB,mBAAG,mCAAuB,KAAA;QACpF,IAAI,CAAC,QAAQ,GAAG,IAAI,qBAAS,CAAC;YAE5B,KAAK,EAAE,cAAM,OAAA,EAAE,EAAF,CAAE;YACf,eAAe,EAAE,KAAK;YACtB,kBAAkB,EAAE,iBAAiB;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAKD,2CAAuB,GAAvB;QACE,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;YAC/B,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE,KAAK;SACd,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,AA5BD,IA4BC;AA5BY,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":";;;AAUA,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,22 @@
|
|
|
1
|
+
import { Providers } from '@or-sdk/providers';
|
|
2
|
+
import { IDW_PROVIDER_NAME_SPACE } from './constants';
|
|
3
|
+
export class IdwPublic {
|
|
4
|
+
constructor({ providerAccountId, emUrl, idwProviderNameSpace = IDW_PROVIDER_NAME_SPACE }) {
|
|
5
|
+
this.provider = new Providers({
|
|
6
|
+
token: () => '',
|
|
7
|
+
eventManagerUrl: emUrl,
|
|
8
|
+
providersAccountId: providerAccountId,
|
|
9
|
+
});
|
|
10
|
+
this.idwProviderNameSpace = idwProviderNameSpace;
|
|
11
|
+
}
|
|
12
|
+
getIdwInfoWithStatistic() {
|
|
13
|
+
return this.provider.makeRequest({
|
|
14
|
+
route: this.buildRoute('public'),
|
|
15
|
+
method: 'GET',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
buildRoute(route) {
|
|
19
|
+
return `${this.idwProviderNameSpace}/${route}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# 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;AAGtD,MAAM,OAAO,SAAS;IAIpB,YAAY,EAAE,iBAAiB,EAAE,KAAK,EAAE,oBAAoB,GAAG,uBAAuB,EAAmB;QACvG,IAAI,CAAC,QAAQ,GAAG,IAAI,SAAS,CAAC;YAE5B,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE;YACf,eAAe,EAAE,KAAK;YACtB,kBAAkB,EAAE,iBAAiB;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,CAAC;IAKD,uBAAuB;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;YAC/B,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAChC,MAAM,EAAE,KAAK;SACd,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":"AAUA,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 } from './types';
|
|
2
|
+
export declare class IdwPublic {
|
|
3
|
+
private readonly provider;
|
|
4
|
+
private readonly idwProviderNameSpace;
|
|
5
|
+
constructor({ providerAccountId, emUrl, idwProviderNameSpace }: IDWPublicConfig);
|
|
6
|
+
getIdwInfoWithStatistic(): 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,MAAM,SAAS,CAAC;AAKtE,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAY;IACrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;gBAElC,EAAE,iBAAiB,EAAE,KAAK,EAAE,oBAA8C,EAAE,EAAE,eAAe;IAazG,uBAAuB,IAAI,OAAO,CAAC,0BAA0B,CAAC;IAO9D,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,iBAAiB,EAAE,MAAM,CAAC;IAI1B,KAAK,EAAE,MAAM,CAAC;IAId,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface ActiveFlowTotalCounter {
|
|
2
|
+
activeFlowTotal: number;
|
|
3
|
+
}
|
|
4
|
+
export interface TotalStepsCounter {
|
|
5
|
+
totalSteps: number;
|
|
6
|
+
}
|
|
7
|
+
export declare enum InitializationStatusEnum {
|
|
8
|
+
IN_PROGRESS = "IN_PROGRESS",
|
|
9
|
+
COMPLETED = "COMPLETED",
|
|
10
|
+
CANCELED = "CANCELED"
|
|
11
|
+
}
|
|
12
|
+
export interface IdwPublicBaseInfo {
|
|
13
|
+
slug: string;
|
|
14
|
+
name: string;
|
|
15
|
+
role?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
avatar?: string;
|
|
18
|
+
initializationStatus?: InitializationStatusEnum;
|
|
19
|
+
}
|
|
20
|
+
export interface IdwPublicInfoWithStatistic extends IdwPublicBaseInfo, ActiveFlowTotalCounter, TotalStepsCounter {
|
|
21
|
+
channels: number;
|
|
22
|
+
memory: number;
|
|
23
|
+
wisdom: number;
|
|
24
|
+
skills: number;
|
|
25
|
+
lastActivationTime: number | null;
|
|
26
|
+
isOnline: boolean;
|
|
27
|
+
totalSteps: number;
|
|
28
|
+
totalSkillSteps: number;
|
|
29
|
+
totalChannelSteps: number;
|
|
30
|
+
domain: number;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=idwPublic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idwPublic.d.ts","sourceRoot":"","sources":["../../../src/types/idwPublic.ts"],"names":[],"mappings":"AAEA,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.1.0-beta.1818.0",
|
|
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/base": "^0.29.0",
|
|
28
|
+
"@or-sdk/providers": "^0.2.5"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/IdwPublic.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IDWPublicConfig, IdwPublicInfoWithStatistic } from './types';
|
|
2
|
+
import { Providers } from '@or-sdk/providers';
|
|
3
|
+
import { IDW_PROVIDER_NAME_SPACE } from './constants';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class IdwPublic {
|
|
7
|
+
private readonly provider: Providers;
|
|
8
|
+
private readonly idwProviderNameSpace: string;
|
|
9
|
+
|
|
10
|
+
constructor({ providerAccountId, emUrl, idwProviderNameSpace = IDW_PROVIDER_NAME_SPACE }: IDWPublicConfig) {
|
|
11
|
+
this.provider = new Providers({
|
|
12
|
+
// it's public instance of api, so token not needed
|
|
13
|
+
token: () => '',
|
|
14
|
+
eventManagerUrl: emUrl,
|
|
15
|
+
providersAccountId: providerAccountId,
|
|
16
|
+
});
|
|
17
|
+
this.idwProviderNameSpace = idwProviderNameSpace;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get extended public info about IDW with statistic
|
|
22
|
+
*/
|
|
23
|
+
getIdwInfoWithStatistic(): Promise<IdwPublicInfoWithStatistic> {
|
|
24
|
+
return this.provider.makeRequest({
|
|
25
|
+
route: this.buildRoute('public'),
|
|
26
|
+
method: 'GET',
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private buildRoute(route: string): string {
|
|
31
|
+
return `${this.idwProviderNameSpace}/${route}`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
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,37 @@
|
|
|
1
|
+
// todo copy-paste form @or-sdk/idw.
|
|
2
|
+
// We should move type to separate package aka 'idw-types' to share it between "public" and "private" instance of sdk
|
|
3
|
+
export interface ActiveFlowTotalCounter {
|
|
4
|
+
activeFlowTotal: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface TotalStepsCounter {
|
|
8
|
+
totalSteps: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum InitializationStatusEnum {
|
|
12
|
+
IN_PROGRESS='IN_PROGRESS',
|
|
13
|
+
COMPLETED='COMPLETED',
|
|
14
|
+
CANCELED='CANCELED',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface IdwPublicBaseInfo {
|
|
18
|
+
slug: string;
|
|
19
|
+
name: string;
|
|
20
|
+
role?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
avatar?: string;
|
|
23
|
+
initializationStatus?: InitializationStatusEnum;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface IdwPublicInfoWithStatistic extends IdwPublicBaseInfo, ActiveFlowTotalCounter, TotalStepsCounter {
|
|
27
|
+
channels: number;
|
|
28
|
+
memory: number;
|
|
29
|
+
wisdom: number;
|
|
30
|
+
skills: number;
|
|
31
|
+
lastActivationTime: number | null;
|
|
32
|
+
isOnline: boolean;
|
|
33
|
+
totalSteps: number;
|
|
34
|
+
totalSkillSteps: number;
|
|
35
|
+
totalChannelSteps: number;
|
|
36
|
+
domain: number;
|
|
37
|
+
}
|
package/tsconfig.json
ADDED