@or-sdk/views 0.26.0 → 0.27.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/CHANGELOG.md +0 -13
- package/README.md +1 -1
- package/dist/cjs/Views.js +121 -64
- package/dist/cjs/Views.js.map +1 -1
- package/dist/cjs/constants.js +13 -3
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/utils/addTagsIds.js +20 -0
- package/dist/cjs/utils/addTagsIds.js.map +1 -0
- package/dist/cjs/utils/filterTagIds.js +25 -0
- package/dist/cjs/utils/filterTagIds.js.map +1 -0
- package/dist/cjs/utils/index.js +13 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/removeTagIds.js +11 -0
- package/dist/cjs/utils/removeTagIds.js.map +1 -0
- package/dist/esm/Views.js +92 -47
- package/dist/esm/Views.js.map +1 -1
- package/dist/esm/constants.js +331 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/utils/addTagsIds.js +9 -0
- package/dist/esm/utils/addTagsIds.js.map +1 -0
- package/dist/esm/utils/filterTagIds.js +23 -0
- package/dist/esm/utils/filterTagIds.js.map +1 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/removeTagIds.js +9 -0
- package/dist/esm/utils/removeTagIds.js.map +1 -0
- package/dist/types/Views.d.ts +6 -5
- package/dist/types/Views.d.ts.map +1 -1
- package/dist/types/constants.d.ts +11 -1
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -13
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/addTagsIds.d.ts +4 -0
- package/dist/types/utils/addTagsIds.d.ts.map +1 -0
- package/dist/types/utils/filterTagIds.d.ts +7 -0
- package/dist/types/utils/filterTagIds.d.ts.map +1 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/dist/types/utils/index.d.ts.map +1 -0
- package/dist/types/utils/removeTagIds.d.ts +4 -0
- package/dist/types/utils/removeTagIds.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/Views.ts +131 -64
- package/src/constants.ts +341 -1
- package/src/types.ts +2 -16
- package/src/utils/addTagsIds.ts +15 -0
- package/src/utils/filterTagIds.ts +27 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/removeTagIds.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,19 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [0.26.0](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/views@0.25.6...@or-sdk/views@0.26.0) (2022-10-21)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### ⚠ BREAKING CHANGES
|
|
10
|
-
|
|
11
|
-
* **data-hub-svc:** DataHub changed to DataHubSvc, now constructor needs `dataHubSvcUrl` instead of `dataHubUrl`
|
|
12
|
-
|
|
13
|
-
### Features
|
|
14
|
-
|
|
15
|
-
* **data-hub-svc:** DataHub changed to DataHubSvc, now constructor needs `dataHubSvcUrl` instead of `dataHubUrl` ([bf9c8ff](https://gitlab.com/onereach/platform/or-sdk-next/commit/bf9c8ff0c660e19f174ad04a135320c98152c4e7))
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
6
|
### [0.25.6](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/views@0.25.5...@or-sdk/views@0.25.6) (2022-09-09)
|
|
20
7
|
|
|
21
8
|
**Note:** Version bump only for package @or-sdk/views
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ import { Views } from '@or-sdk/views'
|
|
|
10
10
|
// with direct api url
|
|
11
11
|
const views = new Views({
|
|
12
12
|
token: 'my-account-token-string',
|
|
13
|
-
|
|
13
|
+
dataHubUrl: 'http://example.views/endpoint'
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
// with service discovery(slower)
|
package/dist/cjs/Views.js
CHANGED
|
@@ -48,125 +48,182 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
50
|
exports.Views = void 0;
|
|
51
|
-
var
|
|
52
|
-
var
|
|
51
|
+
var data_hub_1 = require("@or-sdk/data-hub");
|
|
52
|
+
var constants_1 = require("./constants");
|
|
53
53
|
var tags_1 = require("@or-sdk/tags");
|
|
54
54
|
var Views = (function () {
|
|
55
55
|
function Views(params) {
|
|
56
|
-
var token = params.token, discoveryUrl = params.discoveryUrl, accountId = params.accountId,
|
|
57
|
-
this.
|
|
56
|
+
var token = params.token, discoveryUrl = params.discoveryUrl, accountId = params.accountId, dataHubUrl = params.dataHubUrl;
|
|
57
|
+
this.dataHub = new data_hub_1.DataHub({
|
|
58
58
|
token: token,
|
|
59
59
|
discoveryUrl: discoveryUrl,
|
|
60
60
|
accountId: accountId,
|
|
61
|
-
|
|
61
|
+
dataHubUrl: dataHubUrl,
|
|
62
62
|
});
|
|
63
63
|
this.tags = new tags_1.Tags({
|
|
64
64
|
token: token,
|
|
65
65
|
discoveryUrl: discoveryUrl,
|
|
66
66
|
accountId: accountId,
|
|
67
|
-
|
|
67
|
+
dataHubUrl: dataHubUrl,
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
Views.prototype.
|
|
71
|
-
if (params === void 0) { params = {}; }
|
|
72
|
-
if (paginationOptions === void 0) { paginationOptions = {}; }
|
|
70
|
+
Views.prototype.init = function () {
|
|
73
71
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var result;
|
|
75
72
|
return __generator(this, function (_a) {
|
|
76
73
|
switch (_a.label) {
|
|
77
|
-
case 0: return [4,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})];
|
|
74
|
+
case 0: return [4, Promise.all([
|
|
75
|
+
this.dataHub.init(),
|
|
76
|
+
this.tags.init(),
|
|
77
|
+
])];
|
|
82
78
|
case 1:
|
|
83
|
-
|
|
84
|
-
return [2
|
|
79
|
+
_a.sent();
|
|
80
|
+
return [2];
|
|
85
81
|
}
|
|
86
82
|
});
|
|
87
83
|
});
|
|
88
84
|
};
|
|
85
|
+
Views.prototype.listViews = function () {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
var variables, operationName, data;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, params: {
|
|
90
|
+
queryParams: {},
|
|
91
|
+
includeDeleted: false,
|
|
92
|
+
includeExisting: true,
|
|
93
|
+
limit: 30,
|
|
94
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
95
|
+
operationName = this.dataHub.getOperationName(data_hub_1.OperationNames.LIST);
|
|
96
|
+
data = {
|
|
97
|
+
operationName: operationName,
|
|
98
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_LIST_CROSSACCOUNT : constants_1.QUERY_LIST,
|
|
99
|
+
variables: variables,
|
|
100
|
+
};
|
|
101
|
+
return [2, this.dataHub.getFullList('POST', '/graphql', data)];
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
89
105
|
Views.prototype.getView = function (id) {
|
|
90
106
|
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var variables, operationName, data, result;
|
|
91
108
|
return __generator(this, function (_a) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, params: {
|
|
112
|
+
id: id,
|
|
113
|
+
includeDeleted: false,
|
|
114
|
+
includeExisting: true,
|
|
115
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
116
|
+
operationName = this.dataHub.getOperationName(data_hub_1.OperationNames.GET);
|
|
117
|
+
data = {
|
|
118
|
+
operationName: operationName,
|
|
119
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_GET_CROSSACCOUNT : constants_1.QUERY_GET,
|
|
120
|
+
variables: variables,
|
|
121
|
+
};
|
|
122
|
+
return [4, this.dataHub.makeRequest({
|
|
123
|
+
method: 'POST',
|
|
124
|
+
route: '/graphql',
|
|
125
|
+
data: data,
|
|
126
|
+
})];
|
|
127
|
+
case 1:
|
|
128
|
+
result = _a.sent();
|
|
129
|
+
return [2, result.data[operationName]];
|
|
130
|
+
}
|
|
97
131
|
});
|
|
98
132
|
});
|
|
99
133
|
};
|
|
100
134
|
Views.prototype.saveView = function (source) {
|
|
101
135
|
return __awaiter(this, void 0, void 0, function () {
|
|
102
136
|
return __generator(this, function (_a) {
|
|
103
|
-
return [2,
|
|
137
|
+
return [2, source.id ? this.updateView(source) : this.createView(source)];
|
|
104
138
|
});
|
|
105
139
|
});
|
|
106
140
|
};
|
|
107
141
|
Views.prototype.createView = function (source) {
|
|
108
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
109
|
-
var result;
|
|
143
|
+
var variables, operationName, data, result;
|
|
110
144
|
return __generator(this, function (_a) {
|
|
111
145
|
switch (_a.label) {
|
|
112
|
-
case 0:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
146
|
+
case 0:
|
|
147
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, data: {
|
|
148
|
+
body: source,
|
|
149
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
150
|
+
operationName = this.dataHub.getOperationName(data_hub_1.OperationNames.CREATE);
|
|
151
|
+
data = {
|
|
152
|
+
operationName: operationName,
|
|
153
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_CREATE_CROSSACCOUNT : constants_1.QUERY_CREATE,
|
|
154
|
+
variables: variables,
|
|
155
|
+
};
|
|
156
|
+
return [4, this.dataHub.makeRequest({
|
|
157
|
+
method: 'POST',
|
|
158
|
+
route: '/graphql',
|
|
159
|
+
data: data,
|
|
160
|
+
})];
|
|
120
161
|
case 1:
|
|
121
162
|
result = _a.sent();
|
|
122
|
-
return [2,
|
|
163
|
+
return [2, result.data[operationName]];
|
|
123
164
|
}
|
|
124
165
|
});
|
|
125
166
|
});
|
|
126
167
|
};
|
|
127
168
|
Views.prototype.updateView = function (source) {
|
|
128
169
|
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
-
var result;
|
|
170
|
+
var variables, operationName, data, result;
|
|
130
171
|
return __generator(this, function (_a) {
|
|
131
172
|
switch (_a.label) {
|
|
132
|
-
case 0:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
173
|
+
case 0:
|
|
174
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, data: {
|
|
175
|
+
id: source.id,
|
|
176
|
+
body: source,
|
|
177
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
178
|
+
operationName = this.dataHub.getOperationName(data_hub_1.OperationNames.UPDATE);
|
|
179
|
+
data = {
|
|
180
|
+
operationName: operationName,
|
|
181
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_UPDATE_CROSSACCOUNT : constants_1.QUERY_UPDATE,
|
|
182
|
+
variables: variables,
|
|
183
|
+
};
|
|
184
|
+
return [4, this.dataHub.makeRequest({
|
|
185
|
+
method: 'POST',
|
|
186
|
+
route: '/graphql',
|
|
187
|
+
data: data,
|
|
188
|
+
})];
|
|
140
189
|
case 1:
|
|
141
190
|
result = _a.sent();
|
|
142
|
-
return [2,
|
|
191
|
+
return [2, result.data[operationName]];
|
|
143
192
|
}
|
|
144
193
|
});
|
|
145
194
|
});
|
|
146
195
|
};
|
|
147
|
-
Views.prototype.deleteView = function (viewId
|
|
148
|
-
if (temporarily === void 0) { temporarily = true; }
|
|
196
|
+
Views.prototype.deleteView = function (viewId) {
|
|
149
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
198
|
+
var variables, operationName, data, result;
|
|
150
199
|
return __generator(this, function (_a) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
200
|
+
switch (_a.label) {
|
|
201
|
+
case 0:
|
|
202
|
+
if (this.dataHub.isCrossAccount) {
|
|
203
|
+
throw Error('Cross-account deleting is not implemented.');
|
|
204
|
+
}
|
|
205
|
+
variables = {
|
|
206
|
+
entity: constants_1.ENTITY_NAME,
|
|
207
|
+
data: {
|
|
208
|
+
id: viewId,
|
|
209
|
+
subscribe: true,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
operationName = this.dataHub.getOperationName(data_hub_1.OperationNames.DELETE_TEMPORARILY);
|
|
213
|
+
data = {
|
|
214
|
+
operationName: operationName,
|
|
215
|
+
query: constants_1.QUERY_DELETE,
|
|
216
|
+
variables: variables,
|
|
217
|
+
};
|
|
218
|
+
return [4, this.dataHub.makeRequest({
|
|
219
|
+
method: 'POST',
|
|
220
|
+
route: '/graphql',
|
|
221
|
+
data: data,
|
|
222
|
+
})];
|
|
223
|
+
case 1:
|
|
224
|
+
result = _a.sent();
|
|
225
|
+
return [2, this.dataHub.subscribe(result.data[operationName].requestId)];
|
|
226
|
+
}
|
|
170
227
|
});
|
|
171
228
|
});
|
|
172
229
|
};
|
package/dist/cjs/Views.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Views.js","sourceRoot":"","sources":["../../src/Views.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,KACnB,cAAc,EAAE,IAAA,mBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,UAG9E,EAAC;;;;KACJ;IACH,YAAC;AAAD,CAAC,AAnQD,IAmQC;AAnQY,sBAAK"}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.ENTITY_NAME = exports.QUERY_DELETE = exports.QUERY_UPDATE_CROSSACCOUNT = exports.QUERY_UPDATE = exports.QUERY_CREATE_CROSSACCOUNT = exports.QUERY_CREATE = exports.QUERY_GET_CROSSACCOUNT = exports.QUERY_GET = exports.QUERY_LIST_CROSSACCOUNT = exports.QUERY_LIST = exports.DATA_HUB_SERVICE_KEY = void 0;
|
|
4
|
+
var data_hub_1 = require("@or-sdk/data-hub");
|
|
5
|
+
Object.defineProperty(exports, "DATA_HUB_SERVICE_KEY", { enumerable: true, get: function () { return data_hub_1.DATA_HUB_SERVICE_KEY; } });
|
|
6
|
+
exports.QUERY_LIST = "query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {\n list(entity: $entity, params: $params, sandbox: $sandbox) {\n records {\n ... on View {\n id\n data {\n data\n }\n cardIds\n mirrorCardIds\n linkId\n linkType\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n reference\n }\n }\n last\n }\n}\n";
|
|
7
|
+
exports.QUERY_LIST_CROSSACCOUNT = "query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {\n listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {\n records {\n ... on View {\n id\n data {\n data\n }\n cardIds\n mirrorCardIds\n linkId\n linkType\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n reference\n }\n }\n last\n }\n}\n";
|
|
8
|
+
exports.QUERY_GET = "query get($entity: EntityType!, $params: GetInput!) {\n get(entity: $entity, params: $params) {\n ... on View {\n id\n cardIds\n linkId\n mirrorCardIds\n schemaVersion\n dateCreated\n dateModified\n data {\n data\n form {\n code\n data\n style\n template\n }\n presentation {\n code\n data\n style\n template\n }\n }\n linkType\n reference\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n }\n }\n}";
|
|
9
|
+
exports.QUERY_GET_CROSSACCOUNT = "query getCrossAccount($entity: EntityType!, $params: GetInput!, $accountId: String!) {\n getCrossAccount(entity: $entity, params: $params, accountId: $accountId) {\n ... on View {\n id\n cardIds\n linkId\n mirrorCardIds\n schemaVersion\n dateCreated\n dateModified\n data {\n data\n form {\n code\n data\n style\n template\n }\n presentation {\n code\n data\n style\n template\n }\n }\n linkType\n reference\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n }\n }\n}";
|
|
10
|
+
exports.QUERY_CREATE = "mutation create($entity: EntityType!, $data: CreateInput!) {\n create(entity: $entity, data: $data) {\n ... on View {\n id\n cardIds\n linkId\n mirrorCardIds\n schemaVersion\n dateCreated\n dateModified\n data {\n data\n form {\n code\n data\n style\n template\n }\n presentation {\n code\n data\n style\n template\n }\n }\n linkType\n reference\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n }\n }\n}";
|
|
11
|
+
exports.QUERY_CREATE_CROSSACCOUNT = "mutation createCrossAccount($entity: EntityType!, $data: CreateInput!, $accountId: String!) {\n createCrossAccount(entity: $entity, data: $data, accountId: $accountId) {\n ... on View {\n id\n cardIds\n linkId\n mirrorCardIds\n schemaVersion\n dateCreated\n dateModified\n data {\n data\n form {\n code\n data\n style\n template\n }\n presentation {\n code\n data\n style\n template\n }\n }\n linkType\n reference\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n }\n }\n}";
|
|
12
|
+
exports.QUERY_UPDATE = "mutation update($entity: EntityType!, $data: UpdateInput!) {\n update(entity: $entity, data: $data) {\n ... on View {\n id\n cardIds\n linkId\n mirrorCardIds\n schemaVersion\n dateCreated\n dateModified\n data {\n data\n form {\n code\n data\n style\n template\n }\n presentation {\n code\n data\n style\n template\n }\n }\n linkType\n reference\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n }\n }\n}";
|
|
13
|
+
exports.QUERY_UPDATE_CROSSACCOUNT = "mutation updateCrossAccount($entity: EntityType!, $data: UpdateInput!, $accountId: String!) {\n updateCrossAccount(entity: $entity, data: $data, accountId: $accountId) {\n ... on View {\n id\n cardIds\n linkId\n mirrorCardIds\n schemaVersion\n dateCreated\n dateModified\n data {\n data\n form {\n code\n data\n style\n template\n }\n presentation {\n code\n data\n style\n template\n }\n }\n linkType\n reference\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n }\n }\n}";
|
|
14
|
+
exports.QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n }\n }\n}";
|
|
15
|
+
exports.ENTITY_NAME = 'VIEW';
|
|
6
16
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAA/C,gHAAA,oBAAoB,OAAA;AAEhB,QAAA,UAAU,GAAG,qlBA+BzB,CAAC;AAEW,QAAA,uBAAuB,GAAG,mnBA+BtC,CAAC;AAEW,QAAA,SAAS,GAAG,8tBA0CvB,CAAC;AAEU,QAAA,sBAAsB,GAAG,kyBA0CpC,CAAC;AAEU,QAAA,YAAY,GAAG,ouBA0C1B,CAAC;AAEU,QAAA,yBAAyB,GAAG,wyBA0CvC,CAAC;AAEU,QAAA,YAAY,GAAG,ouBA0C1B,CAAC;AAEU,QAAA,yBAAyB,GAAG,wyBA0CvC,CAAC;AAEU,QAAA,YAAY,GAAG,yLAM1B,CAAC;AAEU,QAAA,WAAW,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
function addTagIds(source, tagIds) {
|
|
13
|
+
if (!Array.isArray(source.data.data.filterByTagIds)) {
|
|
14
|
+
source.data.data.filterByTagIds = [];
|
|
15
|
+
}
|
|
16
|
+
source.data.data.filterByTagIds = __spreadArray(__spreadArray([], source.data.data.filterByTagIds, true), tagIds, true);
|
|
17
|
+
return source;
|
|
18
|
+
}
|
|
19
|
+
exports.default = addTagIds;
|
|
20
|
+
//# sourceMappingURL=addTagsIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addTagsIds.js","sourceRoot":"","sources":["../../../src/utils/addTagsIds.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,SAAS,SAAS,CAAC,MAAY,EAAE,MAAgB;IAC/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QACnD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;KACtC;IAED,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,mCAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,SAAK,MAAM,OAAC,CAAC;IAElF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function filterTagIds(source, tagIdsToFilter) {
|
|
4
|
+
var newIds = [];
|
|
5
|
+
var existingIds = [];
|
|
6
|
+
if (!Array.isArray(source.data.data.filterByTagIds)) {
|
|
7
|
+
newIds = tagIdsToFilter;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
tagIdsToFilter.forEach(function (tagId) {
|
|
11
|
+
if (source.data.data.filterByTagIds.indexOf(tagId) !== -1) {
|
|
12
|
+
existingIds.push(tagId);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
newIds.push(tagId);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
newIds: newIds,
|
|
21
|
+
existingIds: existingIds,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
exports.default = filterTagIds;
|
|
25
|
+
//# sourceMappingURL=filterTagIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filterTagIds.js","sourceRoot":"","sources":["../../../src/utils/filterTagIds.ts"],"names":[],"mappings":";;AAIA,SAAS,YAAY,CAAC,MAAY,EAAE,cAAwB;IAC1D,IAAI,MAAM,GAAa,EAAE,CAAC;IAC1B,IAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QACnD,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM;QACL,cAAc,CAAC,OAAO,CAAC,UAAA,KAAK;YAC1B,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAe,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC1D,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACzB;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO;QACL,MAAM,QAAA;QACN,WAAW,aAAA;KACZ,CAAC;AACJ,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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.removeTagIds = exports.addTagsIds = exports.filterTagIds = void 0;
|
|
7
|
+
var filterTagIds_1 = require("./filterTagIds");
|
|
8
|
+
Object.defineProperty(exports, "filterTagIds", { enumerable: true, get: function () { return __importDefault(filterTagIds_1).default; } });
|
|
9
|
+
var addTagsIds_1 = require("./addTagsIds");
|
|
10
|
+
Object.defineProperty(exports, "addTagsIds", { enumerable: true, get: function () { return __importDefault(addTagsIds_1).default; } });
|
|
11
|
+
var removeTagIds_1 = require("./removeTagIds");
|
|
12
|
+
Object.defineProperty(exports, "removeTagIds", { enumerable: true, get: function () { return __importDefault(removeTagIds_1).default; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAGA,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB;AAChC,2CAAqD;AAA5C,yHAAA,OAAO,OAAc;AAC9B,+CAAyD;AAAhD,6HAAA,OAAO,OAAgB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function removeTagIds(source, tagIds) {
|
|
4
|
+
if (!Array.isArray(source.data.data.filterByTagIds)) {
|
|
5
|
+
source.data.data.filterByTagIds = [];
|
|
6
|
+
}
|
|
7
|
+
source.data.data.filterByTagIds = source.data.data.filterByTagIds.filter(function (id) { return tagIds.indexOf(id) === -1; });
|
|
8
|
+
return source;
|
|
9
|
+
}
|
|
10
|
+
exports.default = removeTagIds;
|
|
11
|
+
//# sourceMappingURL=removeTagIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removeTagIds.js","sourceRoot":"","sources":["../../../src/utils/removeTagIds.ts"],"names":[],"mappings":";;AAIA,SAAS,YAAY,CAAC,MAAY,EAAE,MAAgB;IAClD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QACnD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;KACtC;IAED,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,UAAC,EAAU,IAAK,OAAA,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAzB,CAAyB,CAAC,CAAC;IAEpH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
package/dist/esm/Views.js
CHANGED
|
@@ -7,94 +7,139 @@ 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 {
|
|
11
|
-
import {
|
|
10
|
+
import { DataHub, OperationNames } from '@or-sdk/data-hub';
|
|
11
|
+
import { ENTITY_NAME, QUERY_LIST, QUERY_GET, QUERY_CREATE, QUERY_UPDATE, QUERY_DELETE, QUERY_GET_CROSSACCOUNT, QUERY_LIST_CROSSACCOUNT, QUERY_CREATE_CROSSACCOUNT, QUERY_UPDATE_CROSSACCOUNT, } from './constants';
|
|
12
12
|
import { Tags, filterTagIds, addTagsIds, removeTagIds } from '@or-sdk/tags';
|
|
13
13
|
export class Views {
|
|
14
14
|
constructor(params) {
|
|
15
|
-
const { token, discoveryUrl, accountId,
|
|
16
|
-
this.
|
|
15
|
+
const { token, discoveryUrl, accountId, dataHubUrl } = params;
|
|
16
|
+
this.dataHub = new DataHub({
|
|
17
17
|
token,
|
|
18
18
|
discoveryUrl,
|
|
19
19
|
accountId,
|
|
20
|
-
|
|
20
|
+
dataHubUrl,
|
|
21
21
|
});
|
|
22
22
|
this.tags = new Tags({
|
|
23
23
|
token,
|
|
24
24
|
discoveryUrl,
|
|
25
25
|
accountId,
|
|
26
|
-
|
|
26
|
+
dataHubUrl,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
init() {
|
|
30
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
yield Promise.all([
|
|
32
|
+
this.dataHub.init(),
|
|
33
|
+
this.tags.init(),
|
|
34
|
+
]);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
listViews() {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const variables = Object.assign({ entity: ENTITY_NAME, params: {
|
|
40
|
+
queryParams: {},
|
|
41
|
+
includeDeleted: false,
|
|
42
|
+
includeExisting: true,
|
|
43
|
+
limit: 30,
|
|
44
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
45
|
+
const operationName = this.dataHub.getOperationName(OperationNames.LIST);
|
|
46
|
+
const data = {
|
|
47
|
+
operationName,
|
|
48
|
+
query: this.dataHub.isCrossAccount ? QUERY_LIST_CROSSACCOUNT : QUERY_LIST,
|
|
49
|
+
variables,
|
|
50
|
+
};
|
|
51
|
+
return this.dataHub.getFullList('POST', '/graphql', data);
|
|
37
52
|
});
|
|
38
53
|
}
|
|
39
54
|
getView(id) {
|
|
40
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
const variables = Object.assign({ entity: ENTITY_NAME, params: {
|
|
57
|
+
id,
|
|
58
|
+
includeDeleted: false,
|
|
59
|
+
includeExisting: true,
|
|
60
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
61
|
+
const operationName = this.dataHub.getOperationName(OperationNames.GET);
|
|
62
|
+
const data = {
|
|
63
|
+
operationName,
|
|
64
|
+
query: this.dataHub.isCrossAccount ? QUERY_GET_CROSSACCOUNT : QUERY_GET,
|
|
65
|
+
variables,
|
|
66
|
+
};
|
|
67
|
+
const result = yield this.dataHub.makeRequest({
|
|
68
|
+
method: 'POST',
|
|
69
|
+
route: '/graphql',
|
|
70
|
+
data,
|
|
45
71
|
});
|
|
72
|
+
return result.data[operationName];
|
|
46
73
|
});
|
|
47
74
|
}
|
|
48
75
|
saveView(source) {
|
|
49
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
return
|
|
77
|
+
return source.id ? this.updateView(source) : this.createView(source);
|
|
51
78
|
});
|
|
52
79
|
}
|
|
53
80
|
createView(source) {
|
|
54
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const
|
|
82
|
+
const variables = Object.assign({ entity: ENTITY_NAME, data: {
|
|
83
|
+
body: source,
|
|
84
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
85
|
+
const operationName = this.dataHub.getOperationName(OperationNames.CREATE);
|
|
86
|
+
const data = {
|
|
87
|
+
operationName,
|
|
88
|
+
query: this.dataHub.isCrossAccount ? QUERY_CREATE_CROSSACCOUNT : QUERY_CREATE,
|
|
89
|
+
variables,
|
|
90
|
+
};
|
|
91
|
+
const result = yield this.dataHub.makeRequest({
|
|
56
92
|
method: 'POST',
|
|
57
|
-
route: '
|
|
58
|
-
data
|
|
59
|
-
view: Object.assign(Object.assign({}, source), { id: 'new' }),
|
|
60
|
-
},
|
|
61
|
-
params: Object.assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
93
|
+
route: '/graphql',
|
|
94
|
+
data,
|
|
62
95
|
});
|
|
63
|
-
return
|
|
96
|
+
return result.data[operationName];
|
|
64
97
|
});
|
|
65
98
|
}
|
|
66
99
|
updateView(source) {
|
|
67
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
const
|
|
101
|
+
const variables = Object.assign({ entity: ENTITY_NAME, data: {
|
|
102
|
+
id: source.id,
|
|
103
|
+
body: source,
|
|
104
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
105
|
+
const operationName = this.dataHub.getOperationName(OperationNames.UPDATE);
|
|
106
|
+
const data = {
|
|
107
|
+
operationName,
|
|
108
|
+
query: this.dataHub.isCrossAccount ? QUERY_UPDATE_CROSSACCOUNT : QUERY_UPDATE,
|
|
109
|
+
variables,
|
|
110
|
+
};
|
|
111
|
+
const result = yield this.dataHub.makeRequest({
|
|
69
112
|
method: 'POST',
|
|
70
|
-
route:
|
|
71
|
-
data
|
|
72
|
-
view: source,
|
|
73
|
-
},
|
|
74
|
-
params: Object.assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
113
|
+
route: '/graphql',
|
|
114
|
+
data,
|
|
75
115
|
});
|
|
76
|
-
return
|
|
116
|
+
return result.data[operationName];
|
|
77
117
|
});
|
|
78
118
|
}
|
|
79
|
-
deleteView(viewId
|
|
119
|
+
deleteView(viewId) {
|
|
80
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
121
|
+
if (this.dataHub.isCrossAccount) {
|
|
122
|
+
throw Error('Cross-account deleting is not implemented.');
|
|
123
|
+
}
|
|
124
|
+
const variables = {
|
|
125
|
+
entity: ENTITY_NAME,
|
|
84
126
|
data: {
|
|
85
|
-
|
|
127
|
+
id: viewId,
|
|
128
|
+
subscribe: true,
|
|
86
129
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
130
|
+
};
|
|
131
|
+
const operationName = this.dataHub.getOperationName(OperationNames.DELETE_TEMPORARILY);
|
|
132
|
+
const data = {
|
|
133
|
+
operationName,
|
|
134
|
+
query: QUERY_DELETE,
|
|
135
|
+
variables,
|
|
136
|
+
};
|
|
137
|
+
const result = yield this.dataHub.makeRequest({
|
|
138
|
+
method: 'POST',
|
|
139
|
+
route: '/graphql',
|
|
140
|
+
data,
|
|
97
141
|
});
|
|
142
|
+
return this.dataHub.subscribe(result.data[operationName].requestId);
|
|
98
143
|
});
|
|
99
144
|
}
|
|
100
145
|
addTags(source, tagNames) {
|