@or-sdk/views 0.15.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Views.js +41 -44
- package/dist/cjs/Views.js.map +1 -1
- package/dist/cjs/constants.js +5 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/esm/Views.js +37 -40
- package/dist/esm/Views.js.map +1 -1
- package/dist/esm/constants.js +161 -0
- package/dist/esm/constants.js.map +1 -1
- package/dist/types/constants.d.ts +4 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +5 -5
- package/src/Views.ts +51 -21
- package/src/constants.ts +165 -0
- package/src/types.ts +4 -0
package/dist/cjs/Views.js
CHANGED
|
@@ -53,14 +53,16 @@ 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;
|
|
56
|
+
var token = params.token, discoveryUrl = params.discoveryUrl, accountId = params.accountId;
|
|
57
57
|
this.dataHub = new data_hub_1.DataHub({
|
|
58
58
|
token: token,
|
|
59
59
|
discoveryUrl: discoveryUrl,
|
|
60
|
+
accountId: accountId,
|
|
60
61
|
});
|
|
61
62
|
this.tags = new tags_1.Tags({
|
|
62
63
|
token: token,
|
|
63
64
|
discoveryUrl: discoveryUrl,
|
|
65
|
+
accountId: accountId,
|
|
64
66
|
});
|
|
65
67
|
}
|
|
66
68
|
Views.prototype.init = function () {
|
|
@@ -80,21 +82,18 @@ var Views = (function () {
|
|
|
80
82
|
};
|
|
81
83
|
Views.prototype.listViews = function () {
|
|
82
84
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
var variables, data;
|
|
85
|
+
var variables, operationName, data;
|
|
84
86
|
return __generator(this, function (_a) {
|
|
85
|
-
variables = {
|
|
86
|
-
entity: constants_1.ENTITY_NAME,
|
|
87
|
-
params: {
|
|
87
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, params: {
|
|
88
88
|
queryParams: {},
|
|
89
89
|
includeDeleted: false,
|
|
90
90
|
includeExisting: true,
|
|
91
91
|
limit: 30,
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
};
|
|
92
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
93
|
+
operationName = this.dataHub.getOperationName('list');
|
|
95
94
|
data = {
|
|
96
|
-
operationName:
|
|
97
|
-
query: constants_1.QUERY_LIST,
|
|
95
|
+
operationName: operationName,
|
|
96
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_LIST_CROSSACCOUNT : constants_1.QUERY_LIST,
|
|
98
97
|
variables: variables,
|
|
99
98
|
};
|
|
100
99
|
return [2, this.dataHub.getFullList('POST', '/graphql', data)];
|
|
@@ -103,21 +102,19 @@ var Views = (function () {
|
|
|
103
102
|
};
|
|
104
103
|
Views.prototype.getView = function (id) {
|
|
105
104
|
return __awaiter(this, void 0, void 0, function () {
|
|
106
|
-
var variables, data,
|
|
105
|
+
var variables, operationName, data, result;
|
|
107
106
|
return __generator(this, function (_a) {
|
|
108
107
|
switch (_a.label) {
|
|
109
108
|
case 0:
|
|
110
|
-
variables = {
|
|
111
|
-
entity: constants_1.ENTITY_NAME,
|
|
112
|
-
params: {
|
|
109
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, params: {
|
|
113
110
|
id: id,
|
|
114
111
|
includeDeleted: false,
|
|
115
112
|
includeExisting: true,
|
|
116
|
-
},
|
|
117
|
-
|
|
113
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
114
|
+
operationName = this.dataHub.getOperationName('get');
|
|
118
115
|
data = {
|
|
119
|
-
operationName:
|
|
120
|
-
query: constants_1.QUERY_GET,
|
|
116
|
+
operationName: operationName,
|
|
117
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_GET_CROSSACCOUNT : constants_1.QUERY_GET,
|
|
121
118
|
variables: variables,
|
|
122
119
|
};
|
|
123
120
|
return [4, this.dataHub.makeRequest({
|
|
@@ -126,8 +123,8 @@ var Views = (function () {
|
|
|
126
123
|
data: data,
|
|
127
124
|
})];
|
|
128
125
|
case 1:
|
|
129
|
-
|
|
130
|
-
return [2,
|
|
126
|
+
result = _a.sent();
|
|
127
|
+
return [2, result.data[operationName]];
|
|
131
128
|
}
|
|
132
129
|
});
|
|
133
130
|
});
|
|
@@ -141,19 +138,17 @@ var Views = (function () {
|
|
|
141
138
|
};
|
|
142
139
|
Views.prototype.createView = function (source) {
|
|
143
140
|
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
-
var variables, data,
|
|
141
|
+
var variables, operationName, data, result;
|
|
145
142
|
return __generator(this, function (_a) {
|
|
146
143
|
switch (_a.label) {
|
|
147
144
|
case 0:
|
|
148
|
-
variables = {
|
|
149
|
-
entity: constants_1.ENTITY_NAME,
|
|
150
|
-
data: {
|
|
145
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, data: {
|
|
151
146
|
body: source,
|
|
152
|
-
},
|
|
153
|
-
|
|
147
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
148
|
+
operationName = this.dataHub.getOperationName('create');
|
|
154
149
|
data = {
|
|
155
|
-
operationName:
|
|
156
|
-
query: constants_1.QUERY_CREATE,
|
|
150
|
+
operationName: operationName,
|
|
151
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_CREATE_CROSSACCOUNT : constants_1.QUERY_CREATE,
|
|
157
152
|
variables: variables,
|
|
158
153
|
};
|
|
159
154
|
return [4, this.dataHub.makeRequest({
|
|
@@ -162,28 +157,26 @@ var Views = (function () {
|
|
|
162
157
|
data: data,
|
|
163
158
|
})];
|
|
164
159
|
case 1:
|
|
165
|
-
|
|
166
|
-
return [2,
|
|
160
|
+
result = _a.sent();
|
|
161
|
+
return [2, result.data[operationName]];
|
|
167
162
|
}
|
|
168
163
|
});
|
|
169
164
|
});
|
|
170
165
|
};
|
|
171
166
|
Views.prototype.updateView = function (source) {
|
|
172
167
|
return __awaiter(this, void 0, void 0, function () {
|
|
173
|
-
var variables, data,
|
|
168
|
+
var variables, operationName, data, result;
|
|
174
169
|
return __generator(this, function (_a) {
|
|
175
170
|
switch (_a.label) {
|
|
176
171
|
case 0:
|
|
177
|
-
variables = {
|
|
178
|
-
entity: constants_1.ENTITY_NAME,
|
|
179
|
-
data: {
|
|
172
|
+
variables = __assign({ entity: constants_1.ENTITY_NAME, data: {
|
|
180
173
|
id: source.id,
|
|
181
174
|
body: source,
|
|
182
|
-
},
|
|
183
|
-
|
|
175
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
176
|
+
operationName = this.dataHub.getOperationName('update');
|
|
184
177
|
data = {
|
|
185
|
-
operationName:
|
|
186
|
-
query:
|
|
178
|
+
operationName: operationName,
|
|
179
|
+
query: this.dataHub.isCrossAccount ? constants_1.QUERY_UPDATE_CROSSACCOUNT : constants_1.QUERY_UPDATE,
|
|
187
180
|
variables: variables,
|
|
188
181
|
};
|
|
189
182
|
return [4, this.dataHub.makeRequest({
|
|
@@ -192,18 +185,21 @@ var Views = (function () {
|
|
|
192
185
|
data: data,
|
|
193
186
|
})];
|
|
194
187
|
case 1:
|
|
195
|
-
|
|
196
|
-
return [2,
|
|
188
|
+
result = _a.sent();
|
|
189
|
+
return [2, result.data[operationName]];
|
|
197
190
|
}
|
|
198
191
|
});
|
|
199
192
|
});
|
|
200
193
|
};
|
|
201
194
|
Views.prototype.deleteView = function (viewId) {
|
|
202
195
|
return __awaiter(this, void 0, void 0, function () {
|
|
203
|
-
var variables, data,
|
|
196
|
+
var variables, operationName, data, result;
|
|
204
197
|
return __generator(this, function (_a) {
|
|
205
198
|
switch (_a.label) {
|
|
206
199
|
case 0:
|
|
200
|
+
if (this.dataHub.isCrossAccount) {
|
|
201
|
+
throw Error('Cross-account deleting is not implemented.');
|
|
202
|
+
}
|
|
207
203
|
variables = {
|
|
208
204
|
entity: constants_1.ENTITY_NAME,
|
|
209
205
|
data: {
|
|
@@ -211,8 +207,9 @@ var Views = (function () {
|
|
|
211
207
|
subscribe: true,
|
|
212
208
|
},
|
|
213
209
|
};
|
|
210
|
+
operationName = this.dataHub.getOperationName('deleteTemporarily');
|
|
214
211
|
data = {
|
|
215
|
-
operationName:
|
|
212
|
+
operationName: operationName,
|
|
216
213
|
query: constants_1.QUERY_DELETE,
|
|
217
214
|
variables: variables,
|
|
218
215
|
};
|
|
@@ -222,8 +219,8 @@ var Views = (function () {
|
|
|
222
219
|
data: data,
|
|
223
220
|
})];
|
|
224
221
|
case 1:
|
|
225
|
-
|
|
226
|
-
return [2, this.dataHub.subscribe(requestId)];
|
|
222
|
+
result = _a.sent();
|
|
223
|
+
return [2, this.dataHub.subscribe(result.data[operationName].requestId)];
|
|
227
224
|
}
|
|
228
225
|
});
|
|
229
226
|
});
|
package/dist/cjs/Views.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Views.js","sourceRoot":"","sources":["../../src/Views.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"Views.js","sourceRoot":"","sources":["../../src/Views.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6CAAkH;AAElH,yCAWqB;AACrB,qCAAsF;AAStF;IAWE,eAAY,MAAmB;QACrB,IAAA,KAAK,GAA8B,MAAM,MAApC,EAAE,YAAY,GAAgB,MAAM,aAAtB,EAAE,SAAS,GAAK,MAAM,UAAX,CAAY;QAElD,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC;YACzB,KAAK,OAAA;YACL,YAAY,cAAA;YACZ,SAAS,WAAA;SACV,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,I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c,EAAE,MAAM,CAAC,UAGvE,EAAC;;;;KACJ;IAQY,0BAAU,GAAvB,UAAwB,MAAY,EAAE,QAAkB;;;;;4BACzC,WAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAA;;wBAAtD,IAAI,GAAG,SAA+C;wBACtD,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,EAAG,EAAP,CAAO,CAAC,CAAC;wBAEhC,WAAW,GAAK,IAAA,mBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,YAA1D,CAA2D;wBAE9E,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;4BACvB,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;yBACtC;wBAED,WAAO,IAAI,CAAC,QAAQ,uBACf,MAAM,KACT,IAAI,wBACC,MAAM,CAAC,IAAI,KACd,IAAI,wBACC,MAAM,CAAC,IAAI,CAAC,IAAI,KACnB,cAAc,EAAE,IAAA,mBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,UAG9E,EAAC;;;;KACJ;IACH,YAAC;AAAD,CAAC,AAxQD,IAwQC;AAxQY,sBAAK"}
|
package/dist/cjs/constants.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ENTITY_NAME = exports.QUERY_DELETE = exports.QUERY_UPDATE = exports.QUERY_CREATE = exports.QUERY_GET = exports.QUERY_LIST = void 0;
|
|
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 = void 0;
|
|
4
4
|
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";
|
|
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 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";
|
|
5
6
|
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}";
|
|
7
|
+
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}";
|
|
6
8
|
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}";
|
|
9
|
+
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}";
|
|
7
10
|
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}";
|
|
11
|
+
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}";
|
|
8
12
|
exports.QUERY_DELETE = "mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {\n deleteTemporarily(entity: $entity, data: $data) {\n ... on AsyncRequest {\n requestId\n }\n }\n}";
|
|
9
13
|
exports.ENTITY_NAME = 'VIEW';
|
|
10
14
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG,qlBA+BzB,CAAC;AAEW,QAAA,SAAS,GAAG,8tBA0CvB,CAAC;AAEU,QAAA,YAAY,GAAG,ouBA0C1B,CAAC;AAEU,QAAA,YAAY,GAAG,ouBA0C1B,CAAC;AAEU,QAAA,YAAY,GAAG,yLAM1B,CAAC;AAEU,QAAA,WAAW,GAAG,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,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"}
|
package/dist/esm/Views.js
CHANGED
|
@@ -8,18 +8,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { DataHub } from '@or-sdk/data-hub';
|
|
11
|
-
import { ENTITY_NAME, QUERY_LIST, QUERY_GET, QUERY_CREATE, QUERY_UPDATE, QUERY_DELETE } from './constants';
|
|
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 } = params;
|
|
15
|
+
const { token, discoveryUrl, accountId } = params;
|
|
16
16
|
this.dataHub = new DataHub({
|
|
17
17
|
token,
|
|
18
18
|
discoveryUrl,
|
|
19
|
+
accountId,
|
|
19
20
|
});
|
|
20
21
|
this.tags = new Tags({
|
|
21
22
|
token,
|
|
22
23
|
discoveryUrl,
|
|
24
|
+
accountId,
|
|
23
25
|
});
|
|
24
26
|
}
|
|
25
27
|
init() {
|
|
@@ -32,19 +34,16 @@ export class Views {
|
|
|
32
34
|
}
|
|
33
35
|
listViews() {
|
|
34
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
const variables = {
|
|
36
|
-
entity: ENTITY_NAME,
|
|
37
|
-
params: {
|
|
37
|
+
const variables = Object.assign({ entity: ENTITY_NAME, params: {
|
|
38
38
|
queryParams: {},
|
|
39
39
|
includeDeleted: false,
|
|
40
40
|
includeExisting: true,
|
|
41
41
|
limit: 30,
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
};
|
|
42
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false });
|
|
43
|
+
const operationName = this.dataHub.getOperationName('list');
|
|
45
44
|
const data = {
|
|
46
|
-
operationName
|
|
47
|
-
query: QUERY_LIST,
|
|
45
|
+
operationName,
|
|
46
|
+
query: this.dataHub.isCrossAccount ? QUERY_LIST_CROSSACCOUNT : QUERY_LIST,
|
|
48
47
|
variables,
|
|
49
48
|
};
|
|
50
49
|
return this.dataHub.getFullList('POST', '/graphql', data);
|
|
@@ -52,25 +51,23 @@ export class Views {
|
|
|
52
51
|
}
|
|
53
52
|
getView(id) {
|
|
54
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const variables = {
|
|
56
|
-
entity: ENTITY_NAME,
|
|
57
|
-
params: {
|
|
54
|
+
const variables = Object.assign({ entity: ENTITY_NAME, params: {
|
|
58
55
|
id,
|
|
59
56
|
includeDeleted: false,
|
|
60
57
|
includeExisting: true,
|
|
61
|
-
},
|
|
62
|
-
|
|
58
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
59
|
+
const operationName = this.dataHub.getOperationName('get');
|
|
63
60
|
const data = {
|
|
64
|
-
operationName
|
|
65
|
-
query: QUERY_GET,
|
|
61
|
+
operationName,
|
|
62
|
+
query: this.dataHub.isCrossAccount ? QUERY_GET_CROSSACCOUNT : QUERY_GET,
|
|
66
63
|
variables,
|
|
67
64
|
};
|
|
68
|
-
const
|
|
65
|
+
const result = yield this.dataHub.makeRequest({
|
|
69
66
|
method: 'POST',
|
|
70
67
|
route: '/graphql',
|
|
71
68
|
data,
|
|
72
69
|
});
|
|
73
|
-
return
|
|
70
|
+
return result.data[operationName];
|
|
74
71
|
});
|
|
75
72
|
}
|
|
76
73
|
saveView(source) {
|
|
@@ -80,49 +77,48 @@ export class Views {
|
|
|
80
77
|
}
|
|
81
78
|
createView(source) {
|
|
82
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
const variables = {
|
|
84
|
-
entity: ENTITY_NAME,
|
|
85
|
-
data: {
|
|
80
|
+
const variables = Object.assign({ entity: ENTITY_NAME, data: {
|
|
86
81
|
body: source,
|
|
87
|
-
},
|
|
88
|
-
|
|
82
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
83
|
+
const operationName = this.dataHub.getOperationName('create');
|
|
89
84
|
const data = {
|
|
90
|
-
operationName
|
|
91
|
-
query: QUERY_CREATE,
|
|
85
|
+
operationName,
|
|
86
|
+
query: this.dataHub.isCrossAccount ? QUERY_CREATE_CROSSACCOUNT : QUERY_CREATE,
|
|
92
87
|
variables,
|
|
93
88
|
};
|
|
94
|
-
const
|
|
89
|
+
const result = yield this.dataHub.makeRequest({
|
|
95
90
|
method: 'POST',
|
|
96
91
|
route: '/graphql',
|
|
97
92
|
data,
|
|
98
93
|
});
|
|
99
|
-
return
|
|
94
|
+
return result.data[operationName];
|
|
100
95
|
});
|
|
101
96
|
}
|
|
102
97
|
updateView(source) {
|
|
103
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const variables = {
|
|
105
|
-
entity: ENTITY_NAME,
|
|
106
|
-
data: {
|
|
99
|
+
const variables = Object.assign({ entity: ENTITY_NAME, data: {
|
|
107
100
|
id: source.id,
|
|
108
101
|
body: source,
|
|
109
|
-
},
|
|
110
|
-
|
|
102
|
+
} }, this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {});
|
|
103
|
+
const operationName = this.dataHub.getOperationName('update');
|
|
111
104
|
const data = {
|
|
112
|
-
operationName
|
|
113
|
-
query:
|
|
105
|
+
operationName,
|
|
106
|
+
query: this.dataHub.isCrossAccount ? QUERY_UPDATE_CROSSACCOUNT : QUERY_UPDATE,
|
|
114
107
|
variables,
|
|
115
108
|
};
|
|
116
|
-
const
|
|
109
|
+
const result = yield this.dataHub.makeRequest({
|
|
117
110
|
method: 'POST',
|
|
118
111
|
route: '/graphql',
|
|
119
112
|
data,
|
|
120
113
|
});
|
|
121
|
-
return
|
|
114
|
+
return result.data[operationName];
|
|
122
115
|
});
|
|
123
116
|
}
|
|
124
117
|
deleteView(viewId) {
|
|
125
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
if (this.dataHub.isCrossAccount) {
|
|
120
|
+
throw Error('Cross-account deleting is not implemented.');
|
|
121
|
+
}
|
|
126
122
|
const variables = {
|
|
127
123
|
entity: ENTITY_NAME,
|
|
128
124
|
data: {
|
|
@@ -130,17 +126,18 @@ export class Views {
|
|
|
130
126
|
subscribe: true,
|
|
131
127
|
},
|
|
132
128
|
};
|
|
129
|
+
const operationName = this.dataHub.getOperationName('deleteTemporarily');
|
|
133
130
|
const data = {
|
|
134
|
-
operationName
|
|
131
|
+
operationName,
|
|
135
132
|
query: QUERY_DELETE,
|
|
136
133
|
variables,
|
|
137
134
|
};
|
|
138
|
-
const
|
|
135
|
+
const result = yield this.dataHub.makeRequest({
|
|
139
136
|
method: 'POST',
|
|
140
137
|
route: '/graphql',
|
|
141
138
|
data,
|
|
142
139
|
});
|
|
143
|
-
return this.dataHub.subscribe(requestId);
|
|
140
|
+
return this.dataHub.subscribe(result.data[operationName].requestId);
|
|
144
141
|
});
|
|
145
142
|
}
|
|
146
143
|
addTags(source, tagNames) {
|
package/dist/esm/Views.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Views.js","sourceRoot":"","sources":["../../src/Views.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"Views.js","sourceRoot":"","sources":["../../src/Views.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,OAAO,EAAyE,MAAM,kBAAkB,CAAC;AAElH,OAAO,EACL,WAAW,EACX,UAAU,EACV,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAY,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAStF,MAAM,OAAO,KAAK;IAWhB,YAAY,MAAmB;QAC7B,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAElD,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC;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AAM,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,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;YAE9E,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;gBACvB,MAAM,KAAK,CAAC,uBAAuB,CAAC,CAAC;aACtC;YAED,OAAO,IAAI,CAAC,QAAQ,iCACf,MAAM,KACT,IAAI,kCACC,MAAM,CAAC,IAAI,KACd,IAAI,kCACC,MAAM,CAAC,IAAI,CAAC,IAAI,KACnB,cAAc,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,CAAC,UAG9E,CAAC;QACL,CAAC;KAAA;CACF"}
|
package/dist/esm/constants.js
CHANGED
|
@@ -30,6 +30,38 @@ export const QUERY_LIST = `query list($entity: EntityType!, $params: ListInput!,
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
|
+
export const QUERY_LIST_CROSSACCOUNT = `query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
34
|
+
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
35
|
+
records {
|
|
36
|
+
... on View {
|
|
37
|
+
id
|
|
38
|
+
data {
|
|
39
|
+
data
|
|
40
|
+
}
|
|
41
|
+
cardIds
|
|
42
|
+
mirrorCardIds
|
|
43
|
+
linkId
|
|
44
|
+
linkType
|
|
45
|
+
template {
|
|
46
|
+
category
|
|
47
|
+
description
|
|
48
|
+
help
|
|
49
|
+
icon
|
|
50
|
+
iconUrl
|
|
51
|
+
implicitly
|
|
52
|
+
label
|
|
53
|
+
publishedBy
|
|
54
|
+
tags
|
|
55
|
+
type
|
|
56
|
+
version
|
|
57
|
+
}
|
|
58
|
+
reference
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
last
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
33
65
|
export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
|
|
34
66
|
get(entity: $entity, params: $params) {
|
|
35
67
|
... on View {
|
|
@@ -73,6 +105,49 @@ export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
|
|
|
73
105
|
}
|
|
74
106
|
}
|
|
75
107
|
}`;
|
|
108
|
+
export const QUERY_GET_CROSSACCOUNT = `query getCrossAccount($entity: EntityType!, $params: GetInput!, $accountId: String!) {
|
|
109
|
+
getCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
110
|
+
... on View {
|
|
111
|
+
id
|
|
112
|
+
cardIds
|
|
113
|
+
linkId
|
|
114
|
+
mirrorCardIds
|
|
115
|
+
schemaVersion
|
|
116
|
+
dateCreated
|
|
117
|
+
dateModified
|
|
118
|
+
data {
|
|
119
|
+
data
|
|
120
|
+
form {
|
|
121
|
+
code
|
|
122
|
+
data
|
|
123
|
+
style
|
|
124
|
+
template
|
|
125
|
+
}
|
|
126
|
+
presentation {
|
|
127
|
+
code
|
|
128
|
+
data
|
|
129
|
+
style
|
|
130
|
+
template
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
linkType
|
|
134
|
+
reference
|
|
135
|
+
template {
|
|
136
|
+
category
|
|
137
|
+
description
|
|
138
|
+
help
|
|
139
|
+
icon
|
|
140
|
+
iconUrl
|
|
141
|
+
implicitly
|
|
142
|
+
label
|
|
143
|
+
publishedBy
|
|
144
|
+
tags
|
|
145
|
+
type
|
|
146
|
+
version
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}`;
|
|
76
151
|
export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: CreateInput!) {
|
|
77
152
|
create(entity: $entity, data: $data) {
|
|
78
153
|
... on View {
|
|
@@ -116,6 +191,49 @@ export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: Create
|
|
|
116
191
|
}
|
|
117
192
|
}
|
|
118
193
|
}`;
|
|
194
|
+
export const QUERY_CREATE_CROSSACCOUNT = `mutation createCrossAccount($entity: EntityType!, $data: CreateInput!, $accountId: String!) {
|
|
195
|
+
createCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
196
|
+
... on View {
|
|
197
|
+
id
|
|
198
|
+
cardIds
|
|
199
|
+
linkId
|
|
200
|
+
mirrorCardIds
|
|
201
|
+
schemaVersion
|
|
202
|
+
dateCreated
|
|
203
|
+
dateModified
|
|
204
|
+
data {
|
|
205
|
+
data
|
|
206
|
+
form {
|
|
207
|
+
code
|
|
208
|
+
data
|
|
209
|
+
style
|
|
210
|
+
template
|
|
211
|
+
}
|
|
212
|
+
presentation {
|
|
213
|
+
code
|
|
214
|
+
data
|
|
215
|
+
style
|
|
216
|
+
template
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
linkType
|
|
220
|
+
reference
|
|
221
|
+
template {
|
|
222
|
+
category
|
|
223
|
+
description
|
|
224
|
+
help
|
|
225
|
+
icon
|
|
226
|
+
iconUrl
|
|
227
|
+
implicitly
|
|
228
|
+
label
|
|
229
|
+
publishedBy
|
|
230
|
+
tags
|
|
231
|
+
type
|
|
232
|
+
version
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}`;
|
|
119
237
|
export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: UpdateInput!) {
|
|
120
238
|
update(entity: $entity, data: $data) {
|
|
121
239
|
... on View {
|
|
@@ -159,6 +277,49 @@ export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: Update
|
|
|
159
277
|
}
|
|
160
278
|
}
|
|
161
279
|
}`;
|
|
280
|
+
export const QUERY_UPDATE_CROSSACCOUNT = `mutation updateCrossAccount($entity: EntityType!, $data: UpdateInput!, $accountId: String!) {
|
|
281
|
+
updateCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
282
|
+
... on View {
|
|
283
|
+
id
|
|
284
|
+
cardIds
|
|
285
|
+
linkId
|
|
286
|
+
mirrorCardIds
|
|
287
|
+
schemaVersion
|
|
288
|
+
dateCreated
|
|
289
|
+
dateModified
|
|
290
|
+
data {
|
|
291
|
+
data
|
|
292
|
+
form {
|
|
293
|
+
code
|
|
294
|
+
data
|
|
295
|
+
style
|
|
296
|
+
template
|
|
297
|
+
}
|
|
298
|
+
presentation {
|
|
299
|
+
code
|
|
300
|
+
data
|
|
301
|
+
style
|
|
302
|
+
template
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
linkType
|
|
306
|
+
reference
|
|
307
|
+
template {
|
|
308
|
+
category
|
|
309
|
+
description
|
|
310
|
+
help
|
|
311
|
+
icon
|
|
312
|
+
iconUrl
|
|
313
|
+
implicitly
|
|
314
|
+
label
|
|
315
|
+
publishedBy
|
|
316
|
+
tags
|
|
317
|
+
type
|
|
318
|
+
version
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}`;
|
|
162
323
|
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
163
324
|
deleteTemporarily(entity: $entity, data: $data) {
|
|
164
325
|
... on AsyncRequest {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BzB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CvB,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C1B,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C1B,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;EAM1B,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BzB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BtC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CvB,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CpC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C1B,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CvC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0C1B,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0CvC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;EAM1B,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
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 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";
|
|
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 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";
|
|
2
3
|
export declare const 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}";
|
|
4
|
+
export declare const 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}";
|
|
3
5
|
export declare const 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}";
|
|
6
|
+
export declare const 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}";
|
|
4
7
|
export declare const 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}";
|
|
8
|
+
export declare const 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}";
|
|
5
9
|
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}";
|
|
6
10
|
export declare const ENTITY_NAME = "VIEW";
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.18.0",
|
|
3
3
|
"name": "@or-sdk/views",
|
|
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.
|
|
27
|
-
"@or-sdk/data-hub": "^0.
|
|
28
|
-
"@or-sdk/tags": "^0.
|
|
26
|
+
"@or-sdk/base": "^0.18.0",
|
|
27
|
+
"@or-sdk/data-hub": "^0.18.0",
|
|
28
|
+
"@or-sdk/tags": "^0.18.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "ad94e1383fbf7d40e63d762f1afb30c0530898f1"
|
|
31
31
|
}
|
package/src/Views.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { List } from '@or-sdk/base';
|
|
2
|
-
import { DataHub, GraphqlResponse, GraphqlResponseCheckExecution } from '@or-sdk/data-hub';
|
|
2
|
+
import { DataHub, GraphqlResponse, GraphqlResponseCheckExecution, GraphqlResponseDelete } from '@or-sdk/data-hub';
|
|
3
3
|
import { ViewsConfig, View } from './types';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ENTITY_NAME,
|
|
6
|
+
QUERY_LIST,
|
|
7
|
+
QUERY_GET,
|
|
8
|
+
QUERY_CREATE,
|
|
9
|
+
QUERY_UPDATE,
|
|
10
|
+
QUERY_DELETE,
|
|
11
|
+
QUERY_GET_CROSSACCOUNT,
|
|
12
|
+
QUERY_LIST_CROSSACCOUNT,
|
|
13
|
+
QUERY_CREATE_CROSSACCOUNT,
|
|
14
|
+
QUERY_UPDATE_CROSSACCOUNT,
|
|
15
|
+
} from './constants';
|
|
5
16
|
import { Tags, Taggable, filterTagIds, addTagsIds, removeTagIds } from '@or-sdk/tags';
|
|
6
17
|
|
|
7
18
|
/**
|
|
@@ -23,15 +34,17 @@ export class Views implements Taggable<View> {
|
|
|
23
34
|
* ```
|
|
24
35
|
*/
|
|
25
36
|
constructor(params: ViewsConfig) {
|
|
26
|
-
const { token, discoveryUrl } = params;
|
|
37
|
+
const { token, discoveryUrl, accountId } = params;
|
|
27
38
|
|
|
28
39
|
this.dataHub = new DataHub({
|
|
29
40
|
token,
|
|
30
41
|
discoveryUrl,
|
|
42
|
+
accountId,
|
|
31
43
|
});
|
|
32
44
|
this.tags = new Tags({
|
|
33
45
|
token,
|
|
34
46
|
discoveryUrl,
|
|
47
|
+
accountId,
|
|
35
48
|
});
|
|
36
49
|
}
|
|
37
50
|
|
|
@@ -57,12 +70,14 @@ export class Views implements Taggable<View> {
|
|
|
57
70
|
includeExisting: true,
|
|
58
71
|
limit: 30,
|
|
59
72
|
},
|
|
60
|
-
sandbox: false,
|
|
73
|
+
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : { sandbox: false },
|
|
61
74
|
};
|
|
62
75
|
|
|
76
|
+
const operationName = this.dataHub.getOperationName('list');
|
|
77
|
+
|
|
63
78
|
const data = {
|
|
64
|
-
operationName
|
|
65
|
-
query: QUERY_LIST,
|
|
79
|
+
operationName,
|
|
80
|
+
query: this.dataHub.isCrossAccount ? QUERY_LIST_CROSSACCOUNT : QUERY_LIST,
|
|
66
81
|
variables,
|
|
67
82
|
};
|
|
68
83
|
|
|
@@ -83,21 +98,24 @@ export class Views implements Taggable<View> {
|
|
|
83
98
|
includeDeleted: false,
|
|
84
99
|
includeExisting: true,
|
|
85
100
|
},
|
|
101
|
+
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
86
102
|
};
|
|
87
103
|
|
|
104
|
+
const operationName = this.dataHub.getOperationName('get');
|
|
105
|
+
|
|
88
106
|
const data = {
|
|
89
|
-
operationName
|
|
90
|
-
query: QUERY_GET,
|
|
107
|
+
operationName,
|
|
108
|
+
query: this.dataHub.isCrossAccount ? QUERY_GET_CROSSACCOUNT : QUERY_GET,
|
|
91
109
|
variables,
|
|
92
110
|
};
|
|
93
111
|
|
|
94
|
-
const
|
|
112
|
+
const result = await this.dataHub.makeRequest<GraphqlResponse<View>>({
|
|
95
113
|
method: 'POST',
|
|
96
114
|
route: '/graphql',
|
|
97
115
|
data,
|
|
98
116
|
});
|
|
99
117
|
|
|
100
|
-
return
|
|
118
|
+
return result.data[operationName] as View;
|
|
101
119
|
}
|
|
102
120
|
|
|
103
121
|
/**
|
|
@@ -124,21 +142,24 @@ export class Views implements Taggable<View> {
|
|
|
124
142
|
data: {
|
|
125
143
|
body: source,
|
|
126
144
|
},
|
|
145
|
+
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
127
146
|
};
|
|
128
147
|
|
|
148
|
+
const operationName = this.dataHub.getOperationName('create');
|
|
149
|
+
|
|
129
150
|
const data = {
|
|
130
|
-
operationName
|
|
131
|
-
query: QUERY_CREATE,
|
|
151
|
+
operationName,
|
|
152
|
+
query: this.dataHub.isCrossAccount ? QUERY_CREATE_CROSSACCOUNT : QUERY_CREATE,
|
|
132
153
|
variables,
|
|
133
154
|
};
|
|
134
155
|
|
|
135
|
-
const
|
|
156
|
+
const result = await this.dataHub.makeRequest<GraphqlResponse<View>>({
|
|
136
157
|
method: 'POST',
|
|
137
158
|
route: '/graphql',
|
|
138
159
|
data,
|
|
139
160
|
});
|
|
140
161
|
|
|
141
|
-
return
|
|
162
|
+
return result.data[operationName] as View;
|
|
142
163
|
}
|
|
143
164
|
|
|
144
165
|
/**
|
|
@@ -154,21 +175,24 @@ export class Views implements Taggable<View> {
|
|
|
154
175
|
id: source.id,
|
|
155
176
|
body: source,
|
|
156
177
|
},
|
|
178
|
+
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
157
179
|
};
|
|
158
180
|
|
|
181
|
+
const operationName = this.dataHub.getOperationName('update');
|
|
182
|
+
|
|
159
183
|
const data = {
|
|
160
|
-
operationName
|
|
161
|
-
query:
|
|
184
|
+
operationName,
|
|
185
|
+
query: this.dataHub.isCrossAccount ? QUERY_UPDATE_CROSSACCOUNT : QUERY_UPDATE,
|
|
162
186
|
variables,
|
|
163
187
|
};
|
|
164
188
|
|
|
165
|
-
const
|
|
189
|
+
const result = await this.dataHub.makeRequest<GraphqlResponse<View>>({
|
|
166
190
|
method: 'POST',
|
|
167
191
|
route: '/graphql',
|
|
168
192
|
data,
|
|
169
193
|
});
|
|
170
194
|
|
|
171
|
-
return
|
|
195
|
+
return result.data[operationName] as View;
|
|
172
196
|
}
|
|
173
197
|
|
|
174
198
|
/**
|
|
@@ -178,6 +202,10 @@ export class Views implements Taggable<View> {
|
|
|
178
202
|
* ```
|
|
179
203
|
*/
|
|
180
204
|
public async deleteView(viewId: string): Promise<GraphqlResponseCheckExecution> {
|
|
205
|
+
if (this.dataHub.isCrossAccount) {
|
|
206
|
+
throw Error('Cross-account deleting is not implemented.');
|
|
207
|
+
}
|
|
208
|
+
|
|
181
209
|
const variables = {
|
|
182
210
|
entity: ENTITY_NAME,
|
|
183
211
|
data: {
|
|
@@ -186,19 +214,21 @@ export class Views implements Taggable<View> {
|
|
|
186
214
|
},
|
|
187
215
|
};
|
|
188
216
|
|
|
217
|
+
const operationName = this.dataHub.getOperationName('deleteTemporarily');
|
|
218
|
+
|
|
189
219
|
const data = {
|
|
190
|
-
operationName
|
|
220
|
+
operationName,
|
|
191
221
|
query: QUERY_DELETE,
|
|
192
222
|
variables,
|
|
193
223
|
};
|
|
194
224
|
|
|
195
|
-
const
|
|
225
|
+
const result = await this.dataHub.makeRequest<GraphqlResponse<void>>({
|
|
196
226
|
method: 'POST',
|
|
197
227
|
route: '/graphql',
|
|
198
228
|
data,
|
|
199
229
|
});
|
|
200
230
|
|
|
201
|
-
return this.dataHub.subscribe(requestId);
|
|
231
|
+
return this.dataHub.subscribe((result.data[operationName] as GraphqlResponseDelete).requestId);
|
|
202
232
|
}
|
|
203
233
|
|
|
204
234
|
/**
|
package/src/constants.ts
CHANGED
|
@@ -31,6 +31,39 @@ export const QUERY_LIST = `query list($entity: EntityType!, $params: ListInput!,
|
|
|
31
31
|
}
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
+
export const QUERY_LIST_CROSSACCOUNT = `query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
35
|
+
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
36
|
+
records {
|
|
37
|
+
... on View {
|
|
38
|
+
id
|
|
39
|
+
data {
|
|
40
|
+
data
|
|
41
|
+
}
|
|
42
|
+
cardIds
|
|
43
|
+
mirrorCardIds
|
|
44
|
+
linkId
|
|
45
|
+
linkType
|
|
46
|
+
template {
|
|
47
|
+
category
|
|
48
|
+
description
|
|
49
|
+
help
|
|
50
|
+
icon
|
|
51
|
+
iconUrl
|
|
52
|
+
implicitly
|
|
53
|
+
label
|
|
54
|
+
publishedBy
|
|
55
|
+
tags
|
|
56
|
+
type
|
|
57
|
+
version
|
|
58
|
+
}
|
|
59
|
+
reference
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
last
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
34
67
|
export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
|
|
35
68
|
get(entity: $entity, params: $params) {
|
|
36
69
|
... on View {
|
|
@@ -75,6 +108,50 @@ export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
|
|
|
75
108
|
}
|
|
76
109
|
}`;
|
|
77
110
|
|
|
111
|
+
export const QUERY_GET_CROSSACCOUNT = `query getCrossAccount($entity: EntityType!, $params: GetInput!, $accountId: String!) {
|
|
112
|
+
getCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
113
|
+
... on View {
|
|
114
|
+
id
|
|
115
|
+
cardIds
|
|
116
|
+
linkId
|
|
117
|
+
mirrorCardIds
|
|
118
|
+
schemaVersion
|
|
119
|
+
dateCreated
|
|
120
|
+
dateModified
|
|
121
|
+
data {
|
|
122
|
+
data
|
|
123
|
+
form {
|
|
124
|
+
code
|
|
125
|
+
data
|
|
126
|
+
style
|
|
127
|
+
template
|
|
128
|
+
}
|
|
129
|
+
presentation {
|
|
130
|
+
code
|
|
131
|
+
data
|
|
132
|
+
style
|
|
133
|
+
template
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
linkType
|
|
137
|
+
reference
|
|
138
|
+
template {
|
|
139
|
+
category
|
|
140
|
+
description
|
|
141
|
+
help
|
|
142
|
+
icon
|
|
143
|
+
iconUrl
|
|
144
|
+
implicitly
|
|
145
|
+
label
|
|
146
|
+
publishedBy
|
|
147
|
+
tags
|
|
148
|
+
type
|
|
149
|
+
version
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}`;
|
|
154
|
+
|
|
78
155
|
export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: CreateInput!) {
|
|
79
156
|
create(entity: $entity, data: $data) {
|
|
80
157
|
... on View {
|
|
@@ -119,6 +196,50 @@ export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: Create
|
|
|
119
196
|
}
|
|
120
197
|
}`;
|
|
121
198
|
|
|
199
|
+
export const QUERY_CREATE_CROSSACCOUNT = `mutation createCrossAccount($entity: EntityType!, $data: CreateInput!, $accountId: String!) {
|
|
200
|
+
createCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
201
|
+
... on View {
|
|
202
|
+
id
|
|
203
|
+
cardIds
|
|
204
|
+
linkId
|
|
205
|
+
mirrorCardIds
|
|
206
|
+
schemaVersion
|
|
207
|
+
dateCreated
|
|
208
|
+
dateModified
|
|
209
|
+
data {
|
|
210
|
+
data
|
|
211
|
+
form {
|
|
212
|
+
code
|
|
213
|
+
data
|
|
214
|
+
style
|
|
215
|
+
template
|
|
216
|
+
}
|
|
217
|
+
presentation {
|
|
218
|
+
code
|
|
219
|
+
data
|
|
220
|
+
style
|
|
221
|
+
template
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
linkType
|
|
225
|
+
reference
|
|
226
|
+
template {
|
|
227
|
+
category
|
|
228
|
+
description
|
|
229
|
+
help
|
|
230
|
+
icon
|
|
231
|
+
iconUrl
|
|
232
|
+
implicitly
|
|
233
|
+
label
|
|
234
|
+
publishedBy
|
|
235
|
+
tags
|
|
236
|
+
type
|
|
237
|
+
version
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}`;
|
|
242
|
+
|
|
122
243
|
export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: UpdateInput!) {
|
|
123
244
|
update(entity: $entity, data: $data) {
|
|
124
245
|
... on View {
|
|
@@ -163,6 +284,50 @@ export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: Update
|
|
|
163
284
|
}
|
|
164
285
|
}`;
|
|
165
286
|
|
|
287
|
+
export const QUERY_UPDATE_CROSSACCOUNT = `mutation updateCrossAccount($entity: EntityType!, $data: UpdateInput!, $accountId: String!) {
|
|
288
|
+
updateCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
289
|
+
... on View {
|
|
290
|
+
id
|
|
291
|
+
cardIds
|
|
292
|
+
linkId
|
|
293
|
+
mirrorCardIds
|
|
294
|
+
schemaVersion
|
|
295
|
+
dateCreated
|
|
296
|
+
dateModified
|
|
297
|
+
data {
|
|
298
|
+
data
|
|
299
|
+
form {
|
|
300
|
+
code
|
|
301
|
+
data
|
|
302
|
+
style
|
|
303
|
+
template
|
|
304
|
+
}
|
|
305
|
+
presentation {
|
|
306
|
+
code
|
|
307
|
+
data
|
|
308
|
+
style
|
|
309
|
+
template
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
linkType
|
|
313
|
+
reference
|
|
314
|
+
template {
|
|
315
|
+
category
|
|
316
|
+
description
|
|
317
|
+
help
|
|
318
|
+
icon
|
|
319
|
+
iconUrl
|
|
320
|
+
implicitly
|
|
321
|
+
label
|
|
322
|
+
publishedBy
|
|
323
|
+
tags
|
|
324
|
+
type
|
|
325
|
+
version
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}`;
|
|
330
|
+
|
|
166
331
|
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
167
332
|
deleteTemporarily(entity: $entity, data: $data) {
|
|
168
333
|
... on AsyncRequest {
|
package/src/types.ts
CHANGED