@or-sdk/bots 0.23.0-pgsql.0 → 0.23.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 +91 -0
- package/dist/cjs/Bots.js +22 -10
- package/dist/cjs/Bots.js.map +1 -1
- package/dist/cjs/constants.js +1 -3
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/utils/getListQuery.js +24 -0
- package/dist/cjs/utils/getListQuery.js.map +1 -0
- package/dist/cjs/utils/index.js +9 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/esm/Bots.js +20 -9
- package/dist/esm/Bots.js.map +1 -1
- package/dist/esm/constants.js +0 -44
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/utils/getListQuery.js +37 -0
- package/dist/esm/utils/getListQuery.js.map +1 -0
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/types/Bots.d.ts +2 -2
- package/dist/types/constants.d.ts +0 -2
- package/dist/types/types.d.ts +5 -0
- package/dist/types/utils/getListQuery.d.ts +5 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/Bots.ts +11 -5
- package/src/constants.ts +0 -46
- package/src/types.ts +6 -0
- package/src/utils/getListQuery.ts +39 -0
- package/src/utils/index.ts +5 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
### [0.23.1](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/bots@0.23.0...@or-sdk/bots@0.23.1) (2022-04-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @or-sdk/bots
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 0.23.0 (2022-04-21)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **bots:** Added ability to pass projection to listBots ([e050358](https://gitlab.com/onereach/platform/or-sdk-next/commit/e05035865d5cf0b10b3467657b2ce1790ecb1987))
|
|
20
|
+
|
|
21
|
+
### 0.22.4 (2022-03-30)
|
|
22
|
+
|
|
23
|
+
### 0.22.4-brokenloc.0 (2022-03-30)
|
|
24
|
+
|
|
25
|
+
### 0.22.3 (2022-03-29)
|
|
26
|
+
|
|
27
|
+
### 0.22.3-tablesfilters.0 (2022-03-29)
|
|
28
|
+
|
|
29
|
+
### 0.22.2 (2022-03-28)
|
|
30
|
+
|
|
31
|
+
### 0.22.1 (2022-03-28)
|
|
32
|
+
|
|
33
|
+
### 0.22.1-fixorderoptionstype.1 (2022-03-28)
|
|
34
|
+
|
|
35
|
+
### 0.22.1-fixorderoptionstype.0 (2022-03-28)
|
|
36
|
+
|
|
37
|
+
## 0.22.0 (2022-03-28)
|
|
38
|
+
|
|
39
|
+
### 0.21.2-auth.1 (2022-03-28)
|
|
40
|
+
|
|
41
|
+
### 0.21.2-auth.0 (2022-03-28)
|
|
42
|
+
|
|
43
|
+
### 0.21.1 (2022-03-28)
|
|
44
|
+
|
|
45
|
+
### 0.21.1-addserviceurl.1 (2022-03-27)
|
|
46
|
+
|
|
47
|
+
### 0.21.1-addserviceurl.0 (2022-03-25)
|
|
48
|
+
|
|
49
|
+
## 0.21.0 (2022-03-22)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### Features
|
|
53
|
+
|
|
54
|
+
* add users api ([1829d50](https://gitlab.com/onereach/platform/or-sdk-next/commit/1829d50b2e3d4deccaf176d0f861a4f101e77486))
|
|
55
|
+
|
|
56
|
+
## 0.20.0 (2022-03-18)
|
|
57
|
+
|
|
58
|
+
### 0.19.3 (2022-03-15)
|
|
59
|
+
|
|
60
|
+
### 0.19.2 (2022-03-14)
|
|
61
|
+
|
|
62
|
+
### 0.19.1 (2022-03-14)
|
|
63
|
+
|
|
64
|
+
## 0.19.0 (2022-03-07)
|
|
65
|
+
|
|
66
|
+
## 0.18.0 (2022-03-07)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### Features
|
|
70
|
+
|
|
71
|
+
* **flows:** add ability to override projection for listFlows method ([a302e8e](https://gitlab.com/onereach/platform/or-sdk-next/commit/a302e8e38e82c72a0895d93681195452fd5b9a46))
|
|
72
|
+
|
|
73
|
+
### 0.17.1 (2022-02-22)
|
|
74
|
+
|
|
75
|
+
## 0.17.0 (2022-02-22)
|
|
76
|
+
|
|
77
|
+
### 0.16.1 (2022-02-22)
|
|
78
|
+
|
|
79
|
+
## 0.16.0 (2022-02-02)
|
|
80
|
+
|
|
81
|
+
## 0.15.0 (2022-01-31)
|
|
82
|
+
|
|
83
|
+
## 0.14.0 (2022-01-24)
|
|
84
|
+
|
|
85
|
+
### 0.13.1 (2022-01-20)
|
|
86
|
+
|
|
87
|
+
## 0.13.0 (2022-01-12)
|
|
88
|
+
|
|
89
|
+
## 0.12.0 (2022-01-12)
|
|
90
|
+
|
|
91
|
+
## 0.11.0 (2022-01-12)
|
package/dist/cjs/Bots.js
CHANGED
|
@@ -46,11 +46,23 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
49
60
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
61
|
exports.Bots = void 0;
|
|
51
62
|
var data_hub_1 = require("@or-sdk/data-hub");
|
|
52
63
|
var constants_1 = require("./constants");
|
|
53
64
|
var tags_1 = require("@or-sdk/tags");
|
|
65
|
+
var utils_1 = require("./utils");
|
|
54
66
|
var Bots = (function () {
|
|
55
67
|
function Bots(params) {
|
|
56
68
|
var token = params.token, discoveryUrl = params.discoveryUrl, accountId = params.accountId, dataHubUrl = params.dataHubUrl;
|
|
@@ -82,19 +94,19 @@ var Bots = (function () {
|
|
|
82
94
|
});
|
|
83
95
|
});
|
|
84
96
|
};
|
|
85
|
-
Bots.prototype.listBots = function () {
|
|
97
|
+
Bots.prototype.listBots = function (params) {
|
|
98
|
+
if (params === void 0) { params = {}; }
|
|
86
99
|
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var variables, data;
|
|
88
|
-
return __generator(this, function (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
includeDeleted: false,
|
|
92
|
-
includeExisting: true,
|
|
93
|
-
limit: 30,
|
|
94
|
-
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
100
|
+
var _a, projection, varPrams, variables, data;
|
|
101
|
+
return __generator(this, function (_b) {
|
|
102
|
+
_a = params.projection, projection = _a === void 0 ? [] : _a, varPrams = __rest(params, ["projection"]);
|
|
103
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, params: __assign({ queryParams: {}, includeDeleted: false, includeExisting: true, limit: 30 }, varPrams) }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
95
104
|
data = {
|
|
96
105
|
operationName: this.dataHub.getOperationName('list'),
|
|
97
|
-
query:
|
|
106
|
+
query: (0, utils_1.getListQuery)({
|
|
107
|
+
crossAccount: this.dataHub.isCrossAccount,
|
|
108
|
+
projection: projection,
|
|
109
|
+
}),
|
|
98
110
|
variables: variables,
|
|
99
111
|
};
|
|
100
112
|
return [2, this.dataHub.getFullList('POST', '/graphql', data)];
|
package/dist/cjs/Bots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bots.js","sourceRoot":"","sources":["../../src/Bots.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Bots.js","sourceRoot":"","sources":["../../src/Bots.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAAkH;AAElH,yCAGqB;AACrB,qCAAsF;AACtF,iCAAuC;AASvC;IAUE,cAAY,MAAkB;QACpB,IAAA,KAAK,GAA0C,MAAM,MAAhD,EAAE,YAAY,GAA4B,MAAM,aAAlC,EAAE,SAAS,GAAiB,MAAM,UAAvB,EAAE,UAAU,GAAK,MAAM,WAAX,CAAY;QAE9D,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC;YACzB,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,SAAS,WAAA;YACT,UAAU,YAAA;SACX,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,IAAI,WAAI,CAAC;YACnB,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,SAAS,WAAA;YACT,UAAU,YAAA;SACX,CAAC,CAAC;IACL,CAAC;IAEK,mBAAI,GAAV;;;;4BACE,WAAM,OAAO,CAAC,GAAG,CAAC;4BAChB,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;4BACnB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;yBACjB,CAAC,EAAA;;wBAHF,SAGE,CAAC;;;;;KACJ;IAQY,uBAAQ,GAArB,UAAsB,MAA2B;QAA3B,uBAAA,EAAA,WAA2B;;;;gBACvC,KAAiC,MAAM,WAAxB,EAAf,UAAU,mBAAG,EAAE,KAAA,EAAK,QAAQ,UAAK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ty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENTITY_NAME = exports.QUERY_DELETE =
|
|
4
|
-
exports.QUERY_LIST = "query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {\n list(entity: $entity, params: $params, sandbox: $sandbox) {\n records {\n ... on Bot {\n id\n data {\n label\n color\n description\n iconUrl\n password\n deploy {\n logsTTL\n }\n }\n tags\n dateModified\n }\n }\n last\n }\n}";
|
|
5
|
-
exports.QUERY_LIST_CROSSACCOUNT = "query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {\n listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {\n records {\n ... on Bot {\n id\n data {\n label\n color\n description\n iconUrl\n password\n deploy {\n logsTTL\n }\n }\n tags\n dateModified\n }\n }\n last\n }\n}";
|
|
3
|
+
exports.ENTITY_NAME = exports.QUERY_DELETE = void 0;
|
|
6
4
|
exports.QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n }\n }\n}";
|
|
7
5
|
exports.ENTITY_NAME = 'BOT';
|
|
8
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,yLAM1B,CAAC;AAEU,QAAA,WAAW,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var data_hub_1 = require("@or-sdk/data-hub");
|
|
4
|
+
function getListQuery(_a) {
|
|
5
|
+
var _b = _a.projection, projection = _b === void 0 ? [] : _b, _c = _a.crossAccount, crossAccount = _c === void 0 ? false : _c;
|
|
6
|
+
var baseProjection = [
|
|
7
|
+
'id',
|
|
8
|
+
'data',
|
|
9
|
+
'data.label',
|
|
10
|
+
'data.color',
|
|
11
|
+
'data.description',
|
|
12
|
+
'data.iconUrl',
|
|
13
|
+
'data.password',
|
|
14
|
+
'data.deploy',
|
|
15
|
+
'data.deploy.logsTTL',
|
|
16
|
+
'tags',
|
|
17
|
+
'dateModified',
|
|
18
|
+
];
|
|
19
|
+
return crossAccount ?
|
|
20
|
+
"query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {\n listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {\n records {\n ... on Bot {".concat((0, data_hub_1.getQueryProjectionPart)(projection.length ? projection : baseProjection), "\n }\n }\n last\n }\n}") :
|
|
21
|
+
"query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {\n list(entity: $entity, params: $params, sandbox: $sandbox) {\n records {\n ... on Bot {".concat((0, data_hub_1.getQueryProjectionPart)(projection.length ? projection : baseProjection), "\n }\n }\n last\n }\n}");
|
|
22
|
+
}
|
|
23
|
+
exports.default = getListQuery;
|
|
24
|
+
//# sourceMappingURL=getListQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getListQuery.js","sourceRoot":"","sources":["../../../src/utils/getListQuery.ts"],"names":[],"mappings":";;AAAA,6CAA0D;AAE1D,SAAS,YAAY,CAAC,EAAyF;QAAvF,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA,EAAE,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA;IAC3D,IAAM,cAAc,GAAG;QACrB,IAAI;QACJ,MAAM;QACN,YAAY;QACZ,YAAY;QACZ,kBAAkB;QAClB,cAAc;QACd,eAAe;QACf,aAAa;QACb,qBAAqB;QACrB,MAAM;QACN,cAAc;KACf,CAAC;IAEF,OAAO,YAAY,CAAC,CAAC;QACnB,oNAGgB,IAAA,iCAAsB,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,uCAKzF,CAAC,CAAC;QACA,sLAGgB,IAAA,iCAAsB,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC,uCAKzF,CAAC;AACH,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getListQuery = void 0;
|
|
7
|
+
var getListQuery_1 = require("./getListQuery");
|
|
8
|
+
Object.defineProperty(exports, "getListQuery", { enumerable: true, get: function () { return __importDefault(getListQuery_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAIA,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB"}
|
package/dist/esm/Bots.js
CHANGED
|
@@ -7,9 +7,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
import { DataHub } from '@or-sdk/data-hub';
|
|
11
|
-
import {
|
|
22
|
+
import { QUERY_DELETE, ENTITY_NAME, } from './constants';
|
|
12
23
|
import { Tags, filterTagIds, addTagsIds, removeTagIds } from '@or-sdk/tags';
|
|
24
|
+
import { getListQuery } from './utils';
|
|
13
25
|
export class Bots {
|
|
14
26
|
constructor(params) {
|
|
15
27
|
const { token, discoveryUrl, accountId, dataHubUrl } = params;
|
|
@@ -34,17 +46,16 @@ export class Bots {
|
|
|
34
46
|
]);
|
|
35
47
|
});
|
|
36
48
|
}
|
|
37
|
-
listBots() {
|
|
49
|
+
listBots(params = {}) {
|
|
38
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
includeDeleted: false,
|
|
42
|
-
includeExisting: true,
|
|
43
|
-
limit: 30,
|
|
44
|
-
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
51
|
+
const { projection = [] } = params, varPrams = __rest(params, ["projection"]);
|
|
52
|
+
const variables = Object.assign({ entity: ENTITY_NAME, params: Object.assign({ queryParams: {}, includeDeleted: false, includeExisting: true, limit: 30 }, varPrams) }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
45
53
|
const data = {
|
|
46
54
|
operationName: this.dataHub.getOperationName('list'),
|
|
47
|
-
query:
|
|
55
|
+
query: getListQuery({
|
|
56
|
+
crossAccount: this.dataHub.isCrossAccount,
|
|
57
|
+
projection,
|
|
58
|
+
}),
|
|
48
59
|
variables,
|
|
49
60
|
};
|
|
50
61
|
return this.dataHub.getFullList('POST', '/graphql', data);
|
package/dist/esm/Bots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bots.js","sourceRoot":"","sources":["../../src/Bots.ts"],"names":[],"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CAAC,OAAO,iCACd,MAAM,KACT,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IACrC,CAAC;QACL,CAAC;KAAA;IAQY,UAAU,CAAC,MAAW,EAAE,QAAkB;;YACrD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;YAC7D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAG,CAAC,CAAC;YAExC,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAE1D,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;gBACvB,MAAM,KAAK,CAAC,oBAAoB,CAAC,CAAC;aACnC;YAED,OAAO,IAAI,CAAC,OAAO,iCACd,MAAM,KACT,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAC5C,CAAC;QACL,CAAC;KAAA;CAEF"}
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,47 +1,3 @@
|
|
|
1
|
-
export const QUERY_LIST = `query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {
|
|
2
|
-
list(entity: $entity, params: $params, sandbox: $sandbox) {
|
|
3
|
-
records {
|
|
4
|
-
... on Bot {
|
|
5
|
-
id
|
|
6
|
-
data {
|
|
7
|
-
label
|
|
8
|
-
color
|
|
9
|
-
description
|
|
10
|
-
iconUrl
|
|
11
|
-
password
|
|
12
|
-
deploy {
|
|
13
|
-
logsTTL
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
tags
|
|
17
|
-
dateModified
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
last
|
|
21
|
-
}
|
|
22
|
-
}`;
|
|
23
|
-
export const QUERY_LIST_CROSSACCOUNT = `query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
24
|
-
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
25
|
-
records {
|
|
26
|
-
... on Bot {
|
|
27
|
-
id
|
|
28
|
-
data {
|
|
29
|
-
label
|
|
30
|
-
color
|
|
31
|
-
description
|
|
32
|
-
iconUrl
|
|
33
|
-
password
|
|
34
|
-
deploy {
|
|
35
|
-
logsTTL
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
tags
|
|
39
|
-
dateModified
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
last
|
|
43
|
-
}
|
|
44
|
-
}`;
|
|
45
1
|
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
46
2
|
deleteTemporarily(entity: $entity, data: $data) {
|
|
47
3
|
... on AsyncRequest {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;EAM1B,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { getQueryProjectionPart } from '@or-sdk/data-hub';
|
|
2
|
+
function getListQuery({ projection = [], crossAccount = false }) {
|
|
3
|
+
const baseProjection = [
|
|
4
|
+
'id',
|
|
5
|
+
'data',
|
|
6
|
+
'data.label',
|
|
7
|
+
'data.color',
|
|
8
|
+
'data.description',
|
|
9
|
+
'data.iconUrl',
|
|
10
|
+
'data.password',
|
|
11
|
+
'data.deploy',
|
|
12
|
+
'data.deploy.logsTTL',
|
|
13
|
+
'tags',
|
|
14
|
+
'dateModified',
|
|
15
|
+
];
|
|
16
|
+
return crossAccount ?
|
|
17
|
+
`query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
18
|
+
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
19
|
+
records {
|
|
20
|
+
... on Bot {${getQueryProjectionPart(projection.length ? projection : baseProjection)}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
last
|
|
24
|
+
}
|
|
25
|
+
}` :
|
|
26
|
+
`query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {
|
|
27
|
+
list(entity: $entity, params: $params, sandbox: $sandbox) {
|
|
28
|
+
records {
|
|
29
|
+
... on Bot {${getQueryProjectionPart(projection.length ? projection : baseProjection)}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
last
|
|
33
|
+
}
|
|
34
|
+
}`;
|
|
35
|
+
}
|
|
36
|
+
export default getListQuery;
|
|
37
|
+
//# sourceMappingURL=getListQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getListQuery.js","sourceRoot":"","sources":["../../../src/utils/getListQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,SAAS,YAAY,CAAC,EAAE,UAAU,GAAG,EAAE,EAAE,YAAY,GAAG,KAAK,EAAkD;IAC7G,MAAM,cAAc,GAAG;QACrB,IAAI;QACJ,MAAM;QACN,YAAY;QACZ,YAAY;QACZ,kBAAkB;QAClB,cAAc;QACd,eAAe;QACf,aAAa;QACb,qBAAqB;QACrB,MAAM;QACN,cAAc;KACf,CAAC;IAEF,OAAO,YAAY,CAAC,CAAC;QACnB;;;oBAGgB,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;;;;;EAKzF,CAAC,CAAC;QACA;;;oBAGgB,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,cAAc,CAAC;;;;;EAKzF,CAAC;AACH,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/types/Bots.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { List } from '@or-sdk/base';
|
|
2
2
|
import { GraphqlResponseCheckExecution } from '@or-sdk/data-hub';
|
|
3
|
-
import { BotsConfig, Bot } from './types';
|
|
3
|
+
import { BotsConfig, Bot, ListBotsParams } from './types';
|
|
4
4
|
import { Taggable } from '@or-sdk/tags';
|
|
5
5
|
export declare class Bots implements Taggable<Bot> {
|
|
6
6
|
private readonly dataHub;
|
|
7
7
|
private readonly tags;
|
|
8
8
|
constructor(params: BotsConfig);
|
|
9
9
|
init(): Promise<void>;
|
|
10
|
-
listBots(): Promise<List<Bot>>;
|
|
10
|
+
listBots(params?: ListBotsParams): Promise<List<Bot>>;
|
|
11
11
|
getBot(id: string): Promise<Bot>;
|
|
12
12
|
saveBot(source: Bot): Promise<Bot>;
|
|
13
13
|
deleteBot(botId: string): Promise<GraphqlResponseCheckExecution>;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export declare const QUERY_LIST = "query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {\n list(entity: $entity, params: $params, sandbox: $sandbox) {\n records {\n ... on Bot {\n id\n data {\n label\n color\n description\n iconUrl\n password\n deploy {\n logsTTL\n }\n }\n tags\n dateModified\n }\n }\n last\n }\n}";
|
|
2
|
-
export declare const QUERY_LIST_CROSSACCOUNT = "query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {\n listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {\n records {\n ... on Bot {\n id\n data {\n label\n color\n description\n iconUrl\n password\n deploy {\n logsTTL\n }\n }\n tags\n dateModified\n }\n }\n last\n }\n}";
|
|
3
1
|
export declare const QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n }\n }\n}";
|
|
4
2
|
export declare const ENTITY_NAME = "BOT";
|
package/dist/types/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as getListQuery } from './getListQuery';
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.23.
|
|
2
|
+
"version": "0.23.1",
|
|
3
3
|
"name": "@or-sdk/bots",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@or-sdk/base": "^0.23.0
|
|
27
|
-
"@or-sdk/data-hub": "^0.23.
|
|
28
|
-
"@or-sdk/tags": "^0.23.
|
|
26
|
+
"@or-sdk/base": "^0.23.0",
|
|
27
|
+
"@or-sdk/data-hub": "^0.23.1",
|
|
28
|
+
"@or-sdk/tags": "^0.23.1"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "f2e2c1ea16be1a1aa178dbaf3767f9acfac8d982"
|
|
31
31
|
}
|
package/src/Bots.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { List } from '@or-sdk/base';
|
|
2
2
|
import { DataHub, GraphqlResponse, GraphqlResponseCheckExecution, GraphqlResponseDelete } from '@or-sdk/data-hub';
|
|
3
|
-
import { BotsConfig, Bot } from './types';
|
|
3
|
+
import { BotsConfig, Bot, ListBotsParams } from './types';
|
|
4
4
|
import {
|
|
5
|
-
QUERY_LIST,
|
|
6
5
|
QUERY_DELETE,
|
|
7
6
|
ENTITY_NAME,
|
|
8
|
-
QUERY_LIST_CROSSACCOUNT,
|
|
9
7
|
} from './constants';
|
|
10
8
|
import { Tags, Taggable, filterTagIds, addTagsIds, removeTagIds } from '@or-sdk/tags';
|
|
9
|
+
import { getListQuery } from './utils';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* OneReach Bots service client
|
|
@@ -56,7 +55,8 @@ export class Bots implements Taggable<Bot> {
|
|
|
56
55
|
* const botList = await bots.listBots();
|
|
57
56
|
* ```
|
|
58
57
|
*/
|
|
59
|
-
public async listBots(): Promise<List<Bot>> {
|
|
58
|
+
public async listBots(params: ListBotsParams = {}): Promise<List<Bot>> {
|
|
59
|
+
const { projection = [], ...varPrams } = params;
|
|
60
60
|
const variables = {
|
|
61
61
|
entity: ENTITY_NAME,
|
|
62
62
|
params: {
|
|
@@ -64,13 +64,19 @@ export class Bots implements Taggable<Bot> {
|
|
|
64
64
|
includeDeleted: false,
|
|
65
65
|
includeExisting: true,
|
|
66
66
|
limit: 30,
|
|
67
|
+
|
|
68
|
+
// overrides
|
|
69
|
+
...varPrams,
|
|
67
70
|
},
|
|
68
71
|
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false },
|
|
69
72
|
};
|
|
70
73
|
|
|
71
74
|
const data = {
|
|
72
75
|
operationName: this.dataHub.getOperationName('list'),
|
|
73
|
-
query:
|
|
76
|
+
query: getListQuery({
|
|
77
|
+
crossAccount: this.dataHub.isCrossAccount,
|
|
78
|
+
projection,
|
|
79
|
+
}),
|
|
74
80
|
variables,
|
|
75
81
|
};
|
|
76
82
|
|
package/src/constants.ts
CHANGED
|
@@ -1,49 +1,3 @@
|
|
|
1
|
-
export const QUERY_LIST = `query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {
|
|
2
|
-
list(entity: $entity, params: $params, sandbox: $sandbox) {
|
|
3
|
-
records {
|
|
4
|
-
... on Bot {
|
|
5
|
-
id
|
|
6
|
-
data {
|
|
7
|
-
label
|
|
8
|
-
color
|
|
9
|
-
description
|
|
10
|
-
iconUrl
|
|
11
|
-
password
|
|
12
|
-
deploy {
|
|
13
|
-
logsTTL
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
tags
|
|
17
|
-
dateModified
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
last
|
|
21
|
-
}
|
|
22
|
-
}`;
|
|
23
|
-
|
|
24
|
-
export const QUERY_LIST_CROSSACCOUNT = `query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
25
|
-
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
26
|
-
records {
|
|
27
|
-
... on Bot {
|
|
28
|
-
id
|
|
29
|
-
data {
|
|
30
|
-
label
|
|
31
|
-
color
|
|
32
|
-
description
|
|
33
|
-
iconUrl
|
|
34
|
-
password
|
|
35
|
-
deploy {
|
|
36
|
-
logsTTL
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
tags
|
|
40
|
-
dateModified
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
last
|
|
44
|
-
}
|
|
45
|
-
}`;
|
|
46
|
-
|
|
47
1
|
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
48
2
|
deleteTemporarily(entity: $entity, data: $data) {
|
|
49
3
|
... on AsyncRequest {
|
package/src/types.ts
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getQueryProjectionPart } from '@or-sdk/data-hub';
|
|
2
|
+
|
|
3
|
+
function getListQuery({ projection = [], crossAccount = false }: {projection: string[]; crossAccount: boolean;}): string {
|
|
4
|
+
const baseProjection = [
|
|
5
|
+
'id',
|
|
6
|
+
'data',
|
|
7
|
+
'data.label',
|
|
8
|
+
'data.color',
|
|
9
|
+
'data.description',
|
|
10
|
+
'data.iconUrl',
|
|
11
|
+
'data.password',
|
|
12
|
+
'data.deploy',
|
|
13
|
+
'data.deploy.logsTTL',
|
|
14
|
+
'tags',
|
|
15
|
+
'dateModified',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
return crossAccount ?
|
|
19
|
+
`query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
20
|
+
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
21
|
+
records {
|
|
22
|
+
... on Bot {${getQueryProjectionPart(projection.length ? projection : baseProjection)}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
last
|
|
26
|
+
}
|
|
27
|
+
}` :
|
|
28
|
+
`query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {
|
|
29
|
+
list(entity: $entity, params: $params, sandbox: $sandbox) {
|
|
30
|
+
records {
|
|
31
|
+
... on Bot {${getQueryProjectionPart(projection.length ? projection : baseProjection)}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
last
|
|
35
|
+
}
|
|
36
|
+
}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default getListQuery;
|