@or-sdk/view-templates 1.3.0-beta.647.0 → 2.0.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 +13 -0
- package/README.md +1 -1
- package/dist/cjs/ViewTemplates.js +46 -112
- package/dist/cjs/ViewTemplates.js.map +1 -1
- package/dist/cjs/constants.js +3 -58
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/utils/index.js +1 -5
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/esm/ViewTemplates.js +54 -86
- package/dist/esm/ViewTemplates.js.map +1 -1
- package/dist/esm/constants.js +1 -106
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/utils/index.js +0 -2
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/types/ViewTemplates.d.ts +6 -8
- package/dist/types/ViewTemplates.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -6
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/types.d.ts +20 -28
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +0 -2
- package/dist/types/utils/index.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/ViewTemplates.ts +50 -101
- package/src/constants.ts +1 -111
- package/src/types.ts +25 -32
- package/src/utils/index.ts +0 -2
- package/tsconfig.esm.json +1 -1
- package/dist/cjs/utils/getGetByIdQuery.js +0 -10
- package/dist/cjs/utils/getGetByIdQuery.js.map +0 -1
- package/dist/cjs/utils/getListQuery.js +0 -10
- package/dist/cjs/utils/getListQuery.js.map +0 -1
- package/dist/esm/utils/getGetByIdQuery.js +0 -12
- package/dist/esm/utils/getGetByIdQuery.js.map +0 -1
- package/dist/esm/utils/getListQuery.js +0 -15
- package/dist/esm/utils/getListQuery.js.map +0 -1
- package/dist/types/utils/getGetByIdQuery.d.ts +0 -5
- package/dist/types/utils/getGetByIdQuery.d.ts.map +0 -1
- package/dist/types/utils/getListQuery.d.ts +0 -5
- package/dist/types/utils/getListQuery.d.ts.map +0 -1
- package/src/utils/getGetByIdQuery.ts +0 -13
- package/src/utils/getListQuery.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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
|
+
## [2.0.0](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/view-templates@1.2.5...@or-sdk/view-templates@2.0.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
|
+
|
|
6
19
|
### [1.2.5](https://gitlab.com/onereach/platform/or-sdk-next/compare/@or-sdk/view-templates@1.2.4...@or-sdk/view-templates@1.2.5) (2022-09-09)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @or-sdk/view-templates
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ import { ViewTemplates } from '@or-sdk/view-templates'
|
|
|
10
10
|
// with direct api url
|
|
11
11
|
const viewTemplates = new ViewTemplates({
|
|
12
12
|
token: 'my-account-token-string',
|
|
13
|
-
|
|
13
|
+
dataHubSvcUrl: 'http://example.data-hub-svc/endpoint'
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
// with service discovery(slower)
|
|
@@ -46,147 +46,81 @@ 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
|
-
};
|
|
60
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
50
|
exports.ViewTemplates = void 0;
|
|
62
|
-
var
|
|
51
|
+
var base_1 = require("@or-sdk/base");
|
|
52
|
+
var data_hub_svc_1 = require("@or-sdk/data-hub-svc");
|
|
63
53
|
var utils_1 = require("./utils");
|
|
64
|
-
var constants_1 = require("./constants");
|
|
65
54
|
var ViewTemplates = (function () {
|
|
66
55
|
function ViewTemplates(params) {
|
|
67
|
-
var token = params.token, discoveryUrl = params.discoveryUrl,
|
|
68
|
-
this.
|
|
56
|
+
var token = params.token, discoveryUrl = params.discoveryUrl, accountId = params.accountId, dataHubSvcUrl = params.dataHubSvcUrl;
|
|
57
|
+
this.dataHubSvc = new data_hub_svc_1.DataHubSvc({
|
|
69
58
|
token: token,
|
|
70
59
|
discoveryUrl: discoveryUrl,
|
|
71
|
-
|
|
60
|
+
accountId: accountId,
|
|
61
|
+
dataHubSvcUrl: dataHubSvcUrl,
|
|
72
62
|
});
|
|
73
63
|
}
|
|
74
|
-
ViewTemplates.prototype.listViewTemplates = function (params) {
|
|
75
|
-
var _a;
|
|
64
|
+
ViewTemplates.prototype.listViewTemplates = function (params, paginationOptions) {
|
|
76
65
|
if (params === void 0) { params = {}; }
|
|
66
|
+
if (paginationOptions === void 0) { paginationOptions = {}; }
|
|
77
67
|
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
-
var
|
|
79
|
-
return __generator(this, function (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
query: (0, utils_1.getListQuery)({
|
|
91
|
-
projection: projection,
|
|
92
|
-
}),
|
|
93
|
-
variables: variables,
|
|
94
|
-
};
|
|
95
|
-
return [2, this.dataHub.getFullList('POST', '/graphql', data)];
|
|
68
|
+
var result;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0: return [4, this.dataHubSvc.makeRequest({
|
|
72
|
+
method: 'GET',
|
|
73
|
+
route: 'view-templates',
|
|
74
|
+
params: __assign(__assign(__assign({}, params), paginationOptions), this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
75
|
+
})];
|
|
76
|
+
case 1:
|
|
77
|
+
result = _a.sent();
|
|
78
|
+
return [2, (0, base_1.makeList)(result)];
|
|
79
|
+
}
|
|
96
80
|
});
|
|
97
81
|
});
|
|
98
82
|
};
|
|
99
|
-
ViewTemplates.prototype.getViewTemplateById = function (
|
|
100
|
-
if (params === void 0) { params = {}; }
|
|
83
|
+
ViewTemplates.prototype.getViewTemplateById = function (id) {
|
|
101
84
|
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
entity: constants_1.ENTITY_NAME,
|
|
109
|
-
params: __assign({ id: viewTemplateId }, varPrams),
|
|
110
|
-
};
|
|
111
|
-
operationName = 'getTemplate';
|
|
112
|
-
data = {
|
|
113
|
-
operationName: operationName,
|
|
114
|
-
query: (0, utils_1.getGetByIdQuery)({
|
|
115
|
-
projection: projection,
|
|
116
|
-
}),
|
|
117
|
-
variables: variables,
|
|
118
|
-
};
|
|
119
|
-
return [4, this.dataHub.makeRequest({
|
|
120
|
-
method: 'POST',
|
|
121
|
-
route: '/graphql',
|
|
122
|
-
data: data,
|
|
123
|
-
})];
|
|
124
|
-
case 1:
|
|
125
|
-
result = _b.sent();
|
|
126
|
-
return [2, result.data[operationName]];
|
|
127
|
-
}
|
|
85
|
+
return __generator(this, function (_a) {
|
|
86
|
+
return [2, this.dataHubSvc.makeRequest({
|
|
87
|
+
method: 'GET',
|
|
88
|
+
route: "view-templates/".concat(id),
|
|
89
|
+
params: __assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
90
|
+
})];
|
|
128
91
|
});
|
|
129
92
|
});
|
|
130
93
|
};
|
|
131
|
-
ViewTemplates.prototype.download = function (viewTemplateId, options) {
|
|
94
|
+
ViewTemplates.prototype.download = function (viewTemplateId, options, sandbox) {
|
|
132
95
|
if (options === void 0) { options = {}; }
|
|
96
|
+
if (sandbox === void 0) { sandbox = true; }
|
|
133
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
var variables, operationName, data, result;
|
|
135
98
|
return __generator(this, function (_a) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
data = {
|
|
147
|
-
operationName: operationName,
|
|
148
|
-
query: constants_1.QUERY_DOWNLOAD_TO,
|
|
149
|
-
variables: variables,
|
|
150
|
-
};
|
|
151
|
-
return [4, this.dataHub.makeRequest({
|
|
152
|
-
method: 'POST',
|
|
153
|
-
route: '/graphql',
|
|
154
|
-
data: data,
|
|
155
|
-
})];
|
|
156
|
-
case 1:
|
|
157
|
-
result = _a.sent();
|
|
158
|
-
return [2, result.data[operationName]];
|
|
159
|
-
}
|
|
99
|
+
return [2, this.dataHubSvc.makeRequest({
|
|
100
|
+
method: 'PUT',
|
|
101
|
+
route: 'view-templates',
|
|
102
|
+
data: {
|
|
103
|
+
viewId: viewTemplateId,
|
|
104
|
+
options: options,
|
|
105
|
+
sandbox: sandbox,
|
|
106
|
+
},
|
|
107
|
+
params: __assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
108
|
+
})];
|
|
160
109
|
});
|
|
161
110
|
});
|
|
162
111
|
};
|
|
163
112
|
ViewTemplates.prototype.upgrade = function (viewTemplateId, options) {
|
|
164
113
|
if (options === void 0) { options = {}; }
|
|
165
114
|
return __awaiter(this, void 0, void 0, function () {
|
|
166
|
-
var variables, operationName, data, result;
|
|
167
115
|
return __generator(this, function (_a) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
id: viewTemplateId,
|
|
116
|
+
return [2, this.dataHubSvc.makeRequest({
|
|
117
|
+
method: 'PATCH',
|
|
118
|
+
route: "view-templates/".concat(viewTemplateId),
|
|
119
|
+
data: {
|
|
173
120
|
options: options,
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
operationName: operationName,
|
|
178
|
-
query: constants_1.QUERY_UPGRADE,
|
|
179
|
-
variables: variables,
|
|
180
|
-
};
|
|
181
|
-
return [4, this.dataHub.makeRequest({
|
|
182
|
-
method: 'POST',
|
|
183
|
-
route: '/graphql',
|
|
184
|
-
data: data,
|
|
185
|
-
})];
|
|
186
|
-
case 1:
|
|
187
|
-
result = _a.sent();
|
|
188
|
-
return [2, result.data[operationName]];
|
|
189
|
-
}
|
|
121
|
+
},
|
|
122
|
+
params: __assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
123
|
+
})];
|
|
190
124
|
});
|
|
191
125
|
});
|
|
192
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewTemplates.js","sourceRoot":"","sources":["../../src/View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
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
exports.DEFAULT_PROJECTION_LIST = [
|
|
7
|
-
'id',
|
|
8
|
-
'template',
|
|
9
|
-
'template.category',
|
|
10
|
-
'template.description',
|
|
11
|
-
'template.help',
|
|
12
|
-
'template.icon',
|
|
13
|
-
'template.iconUrl',
|
|
14
|
-
'template.implicitly',
|
|
15
|
-
'template.label',
|
|
16
|
-
'template.publishedBy',
|
|
17
|
-
'template.tags',
|
|
18
|
-
'template.type',
|
|
19
|
-
'template.version',
|
|
20
|
-
'cardIds',
|
|
21
|
-
];
|
|
22
|
-
exports.DEFAULT_PROJECTION_GET_LIST = [
|
|
23
|
-
'id',
|
|
24
|
-
'cardIds',
|
|
25
|
-
'linkId',
|
|
26
|
-
'mirrorCardIds',
|
|
27
|
-
'schemaVersion',
|
|
28
|
-
'dateCreated',
|
|
29
|
-
'dateModified',
|
|
30
|
-
'data',
|
|
31
|
-
'data.data',
|
|
32
|
-
'data.form',
|
|
33
|
-
'data.form.code',
|
|
34
|
-
'data.form.data',
|
|
35
|
-
'data.form.style',
|
|
36
|
-
'data.form.template',
|
|
37
|
-
'data.presentation',
|
|
38
|
-
'data.presentation.code',
|
|
39
|
-
'data.presentation.data',
|
|
40
|
-
'data.presentation.style',
|
|
41
|
-
'data.presentation.template',
|
|
42
|
-
'linkType',
|
|
43
|
-
'reference',
|
|
44
|
-
'template',
|
|
45
|
-
'template.category',
|
|
46
|
-
'template.description',
|
|
47
|
-
'template.help',
|
|
48
|
-
'template.icon',
|
|
49
|
-
'template.iconUrl',
|
|
50
|
-
'template.implicitly',
|
|
51
|
-
'template.label',
|
|
52
|
-
'template.publishedBy',
|
|
53
|
-
'template.tags',
|
|
54
|
-
'template.type',
|
|
55
|
-
'template.version',
|
|
56
|
-
'deletedDate @include(if: false)',
|
|
57
|
-
];
|
|
58
|
-
exports.QUERY_DOWNLOAD_TO = "mutation downloadTo($entity: TemplateType!, $data: DownloadInput!) {\n downloadTo(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 deletedDate @include(if: false)\n }\n }\n}";
|
|
59
|
-
exports.QUERY_UPGRADE = "mutation upgrade($entity: TemplateType!, $id: String!, $options: UpgradeOptions) {\n upgrade(entity: $entity, id: $id, options: $options) {\n ... on View {\n id\n }\n }\n}\n";
|
|
60
|
-
exports.ENTITY_NAME = 'VIEW';
|
|
3
|
+
exports.DATA_HUB_SVC_SERVICE_KEY = void 0;
|
|
4
|
+
var data_hub_svc_1 = require("@or-sdk/data-hub-svc");
|
|
5
|
+
Object.defineProperty(exports, "DATA_HUB_SVC_SERVICE_KEY", { enumerable: true, get: function () { return data_hub_svc_1.DATA_HUB_SVC_SERVICE_KEY; } });
|
|
61
6
|
//# 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,qDAAgE;AAAvD,wHAAA,wBAAwB,OAAA"}
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -3,11 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getNewViewTemplate =
|
|
7
|
-
var getListQuery_1 = require("./getListQuery");
|
|
8
|
-
Object.defineProperty(exports, "getListQuery", { enumerable: true, get: function () { return __importDefault(getListQuery_1).default; } });
|
|
9
|
-
var getGetByIdQuery_1 = require("./getGetByIdQuery");
|
|
10
|
-
Object.defineProperty(exports, "getGetByIdQuery", { enumerable: true, get: function () { return __importDefault(getGetByIdQuery_1).default; } });
|
|
6
|
+
exports.getNewViewTemplate = void 0;
|
|
11
7
|
var getNewViewTemplate_1 = require("./getNewViewTemplate");
|
|
12
8
|
Object.defineProperty(exports, "getNewViewTemplate", { enumerable: true, get: function () { return __importDefault(getNewViewTemplate_1).default; } });
|
|
13
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAIA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;AAIA,2DAAqE;AAA5D,yIAAA,OAAO,OAAsB"}
|
|
@@ -1,101 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { makeList } from '@or-sdk/base';
|
|
11
|
+
import { DataHubSvc } from '@or-sdk/data-hub-svc';
|
|
12
|
+
import { getNewViewTemplate } from './utils';
|
|
4
13
|
export class ViewTemplates {
|
|
5
|
-
dataHub;
|
|
6
14
|
constructor(params) {
|
|
7
|
-
const { token, discoveryUrl,
|
|
8
|
-
this.
|
|
15
|
+
const { token, discoveryUrl, accountId, dataHubSvcUrl } = params;
|
|
16
|
+
this.dataHubSvc = new DataHubSvc({
|
|
9
17
|
token,
|
|
10
18
|
discoveryUrl,
|
|
11
|
-
|
|
19
|
+
accountId,
|
|
20
|
+
dataHubSvcUrl,
|
|
12
21
|
});
|
|
13
22
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
forceSandbox: false,
|
|
24
|
-
sourceId: varPrams?.queryParams?.sourceId,
|
|
25
|
-
};
|
|
26
|
-
const operationName = this.dataHub.getOperationName(OperationNames.LIST_TEMPLATES);
|
|
27
|
-
const data = {
|
|
28
|
-
operationName,
|
|
29
|
-
query: getListQuery({
|
|
30
|
-
projection,
|
|
31
|
-
}),
|
|
32
|
-
variables,
|
|
33
|
-
};
|
|
34
|
-
return this.dataHub.getFullList('POST', '/graphql', data);
|
|
23
|
+
listViewTemplates(params = {}, paginationOptions = {}) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const result = yield this.dataHubSvc.makeRequest({
|
|
26
|
+
method: 'GET',
|
|
27
|
+
route: 'view-templates',
|
|
28
|
+
params: Object.assign(Object.assign(Object.assign({}, params), paginationOptions), this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
29
|
+
});
|
|
30
|
+
return makeList(result);
|
|
31
|
+
});
|
|
35
32
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const operationName = 'getTemplate';
|
|
46
|
-
const data = {
|
|
47
|
-
operationName,
|
|
48
|
-
query: getGetByIdQuery({
|
|
49
|
-
projection,
|
|
50
|
-
}),
|
|
51
|
-
variables,
|
|
52
|
-
};
|
|
53
|
-
const result = await this.dataHub.makeRequest({
|
|
54
|
-
method: 'POST',
|
|
55
|
-
route: '/graphql',
|
|
56
|
-
data,
|
|
33
|
+
getViewTemplateById(id) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return this.dataHubSvc.makeRequest({
|
|
36
|
+
method: 'GET',
|
|
37
|
+
route: `view-templates/${id}`,
|
|
38
|
+
params: Object.assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
39
|
+
});
|
|
57
40
|
});
|
|
58
|
-
return result.data[operationName];
|
|
59
41
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
variables,
|
|
73
|
-
};
|
|
74
|
-
const result = await this.dataHub.makeRequest({
|
|
75
|
-
method: 'POST',
|
|
76
|
-
route: '/graphql',
|
|
77
|
-
data,
|
|
42
|
+
download(viewTemplateId, options = {}, sandbox = true) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return this.dataHubSvc.makeRequest({
|
|
45
|
+
method: 'PUT',
|
|
46
|
+
route: 'view-templates',
|
|
47
|
+
data: {
|
|
48
|
+
viewId: viewTemplateId,
|
|
49
|
+
options,
|
|
50
|
+
sandbox,
|
|
51
|
+
},
|
|
52
|
+
params: Object.assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
53
|
+
});
|
|
78
54
|
});
|
|
79
|
-
return result.data[operationName];
|
|
80
55
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
variables,
|
|
92
|
-
};
|
|
93
|
-
const result = await this.dataHub.makeRequest({
|
|
94
|
-
method: 'POST',
|
|
95
|
-
route: '/graphql',
|
|
96
|
-
data,
|
|
56
|
+
upgrade(viewTemplateId, options = {}) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return this.dataHubSvc.makeRequest({
|
|
59
|
+
method: 'PATCH',
|
|
60
|
+
route: `view-templates/${viewTemplateId}`,
|
|
61
|
+
data: {
|
|
62
|
+
options,
|
|
63
|
+
},
|
|
64
|
+
params: Object.assign({}, this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {}),
|
|
65
|
+
});
|
|
97
66
|
});
|
|
98
|
-
return result.data[operationName];
|
|
99
67
|
}
|
|
100
68
|
static getNewViewTemplate() {
|
|
101
69
|
return getNewViewTemplate();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewTemplates.js","sourceRoot":"","sources":["../../src/ViewTemplates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ViewTemplates.js","sourceRoot":"","sources":["../../src/ViewTemplates.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AASlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,OAAO,aAAa;IAGxB,YAAY,MAA2B;QACrC,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC;QAEjE,IAAI,CAAC,UAAU,GAAG,IAAI,UAAU,CAAC;YAC/B,KAAK;YACL,YAAY;YACZ,SAAS;YACT,aAAa;SACd,CAAC,CAAC;IACL,CAAC;IAQY,iBAAiB,CAAC,SAAkC,EAAE,EAAE,oBAAuC,EAAE;;YAC5G,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,U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E,kBAAkB,cAAc,EAAE;gBACzC,IAAI,EAAE;oBACJ,OAAO;iBACR;gBACD,MAAM,oBACA,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAC1F;aACF,CAAC,CAAC;QACL,CAAC;KAAA;IAQM,MAAM,CAAC,kBAAkB;QAC9B,OAAO,kBAAkB,EAAE,CAAC;IAC9B,CAAC;CAEF"}
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,107 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export const DEFAULT_PROJECTION_LIST = [
|
|
3
|
-
'id',
|
|
4
|
-
'template',
|
|
5
|
-
'template.category',
|
|
6
|
-
'template.description',
|
|
7
|
-
'template.help',
|
|
8
|
-
'template.icon',
|
|
9
|
-
'template.iconUrl',
|
|
10
|
-
'template.implicitly',
|
|
11
|
-
'template.label',
|
|
12
|
-
'template.publishedBy',
|
|
13
|
-
'template.tags',
|
|
14
|
-
'template.type',
|
|
15
|
-
'template.version',
|
|
16
|
-
'cardIds',
|
|
17
|
-
];
|
|
18
|
-
export const DEFAULT_PROJECTION_GET_LIST = [
|
|
19
|
-
'id',
|
|
20
|
-
'cardIds',
|
|
21
|
-
'linkId',
|
|
22
|
-
'mirrorCardIds',
|
|
23
|
-
'schemaVersion',
|
|
24
|
-
'dateCreated',
|
|
25
|
-
'dateModified',
|
|
26
|
-
'data',
|
|
27
|
-
'data.data',
|
|
28
|
-
'data.form',
|
|
29
|
-
'data.form.code',
|
|
30
|
-
'data.form.data',
|
|
31
|
-
'data.form.style',
|
|
32
|
-
'data.form.template',
|
|
33
|
-
'data.presentation',
|
|
34
|
-
'data.presentation.code',
|
|
35
|
-
'data.presentation.data',
|
|
36
|
-
'data.presentation.style',
|
|
37
|
-
'data.presentation.template',
|
|
38
|
-
'linkType',
|
|
39
|
-
'reference',
|
|
40
|
-
'template',
|
|
41
|
-
'template.category',
|
|
42
|
-
'template.description',
|
|
43
|
-
'template.help',
|
|
44
|
-
'template.icon',
|
|
45
|
-
'template.iconUrl',
|
|
46
|
-
'template.implicitly',
|
|
47
|
-
'template.label',
|
|
48
|
-
'template.publishedBy',
|
|
49
|
-
'template.tags',
|
|
50
|
-
'template.type',
|
|
51
|
-
'template.version',
|
|
52
|
-
'deletedDate @include(if: false)',
|
|
53
|
-
];
|
|
54
|
-
export const QUERY_DOWNLOAD_TO = `mutation downloadTo($entity: TemplateType!, $data: DownloadInput!) {
|
|
55
|
-
downloadTo(entity: $entity, data: $data) {
|
|
56
|
-
... on View {
|
|
57
|
-
id
|
|
58
|
-
cardIds
|
|
59
|
-
linkId
|
|
60
|
-
mirrorCardIds
|
|
61
|
-
schemaVersion
|
|
62
|
-
dateCreated
|
|
63
|
-
dateModified
|
|
64
|
-
data {
|
|
65
|
-
data
|
|
66
|
-
form {
|
|
67
|
-
code
|
|
68
|
-
data
|
|
69
|
-
style
|
|
70
|
-
template
|
|
71
|
-
}
|
|
72
|
-
presentation {
|
|
73
|
-
code
|
|
74
|
-
data
|
|
75
|
-
style
|
|
76
|
-
template
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
linkType
|
|
80
|
-
reference
|
|
81
|
-
template {
|
|
82
|
-
category
|
|
83
|
-
description
|
|
84
|
-
help
|
|
85
|
-
icon
|
|
86
|
-
iconUrl
|
|
87
|
-
implicitly
|
|
88
|
-
label
|
|
89
|
-
publishedBy
|
|
90
|
-
tags
|
|
91
|
-
type
|
|
92
|
-
version
|
|
93
|
-
}
|
|
94
|
-
deletedDate @include(if: false)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}`;
|
|
98
|
-
export const QUERY_UPGRADE = `mutation upgrade($entity: TemplateType!, $id: String!, $options: UpgradeOptions) {
|
|
99
|
-
upgrade(entity: $entity, id: $id, options: $options) {
|
|
100
|
-
... on View {
|
|
101
|
-
id
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`;
|
|
106
|
-
export const ENTITY_NAME = 'VIEW';
|
|
1
|
+
export { DATA_HUB_SVC_SERVICE_KEY } from '@or-sdk/data-hub-svc';
|
|
107
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|