dotcms 0.0.17 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -10
- package/dotcms.d.ts.map +1 -0
- package/esm2020/dotcms.mjs +5 -0
- package/esm2020/index.mjs +36 -0
- package/esm2020/lib/api/DotApiAuthorization.mjs +42 -0
- package/esm2020/lib/api/DotApiConfiguration.mjs +27 -0
- package/esm2020/lib/api/DotApiContent.mjs +52 -0
- package/esm2020/lib/api/DotApiContentType.mjs +28 -0
- package/esm2020/lib/api/DotApiElasticSearch.mjs +32 -0
- package/esm2020/lib/api/DotApiEvent.mjs +16 -0
- package/esm2020/lib/api/DotApiForm.mjs +18 -0
- package/esm2020/lib/api/DotApiLanguage.mjs +24 -0
- package/esm2020/lib/api/DotApiNavigation.mjs +29 -0
- package/esm2020/lib/api/DotApiPage.mjs +50 -0
- package/esm2020/lib/api/DotApiSite.mjs +26 -0
- package/esm2020/lib/api/DotApiWidget.mjs +28 -0
- package/esm2020/lib/models/DotCMSAuthorization.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSConfiguration.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSContent.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSElasticSearch.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSError.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSEvent.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSForm.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSHttpClient.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSLanguage.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSNavigation.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSPage.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSPageFormat.model.mjs +2 -0
- package/esm2020/lib/models/DotCMSSite.model.mjs +2 -0
- package/esm2020/lib/models/index.mjs +14 -0
- package/esm2020/lib/utils/DotCMSHttpClient.mjs +10 -0
- package/esm2020/lib/utils/getEsQuery.mjs +35 -0
- package/esm2020/lib/utils/request.mjs +42 -0
- package/{public_api.d.ts → index.d.ts} +1 -0
- package/index.d.ts.map +1 -0
- package/lib/api/DotApiAuthorization.d.ts +1 -0
- package/lib/api/DotApiAuthorization.d.ts.map +1 -0
- package/lib/api/DotApiConfiguration.d.ts +1 -0
- package/lib/api/DotApiConfiguration.d.ts.map +1 -0
- package/lib/api/DotApiContent.d.ts +1 -0
- package/lib/api/DotApiContent.d.ts.map +1 -0
- package/lib/api/DotApiContentType.d.ts +2 -1
- package/lib/api/DotApiContentType.d.ts.map +1 -0
- package/lib/api/DotApiElasticSearch.d.ts +1 -0
- package/lib/api/DotApiElasticSearch.d.ts.map +1 -0
- package/lib/api/DotApiEvent.d.ts +1 -0
- package/lib/api/DotApiEvent.d.ts.map +1 -0
- package/lib/api/DotApiForm.d.ts +2 -1
- package/lib/api/DotApiForm.d.ts.map +1 -0
- package/lib/api/DotApiLanguage.d.ts +4 -3
- package/lib/api/DotApiLanguage.d.ts.map +1 -0
- package/lib/api/DotApiNavigation.d.ts +2 -1
- package/lib/api/DotApiNavigation.d.ts.map +1 -0
- package/lib/api/DotApiPage.d.ts +1 -0
- package/lib/api/DotApiPage.d.ts.map +1 -0
- package/lib/api/DotApiSite.d.ts +1 -0
- package/lib/api/DotApiSite.d.ts.map +1 -0
- package/lib/api/DotApiWidget.d.ts +1 -0
- package/lib/api/DotApiWidget.d.ts.map +1 -0
- package/lib/models/DotCMSAuthorization.model.d.ts +1 -0
- package/lib/models/DotCMSAuthorization.model.d.ts.map +1 -0
- package/lib/models/DotCMSConfiguration.model.d.ts +1 -0
- package/lib/models/DotCMSConfiguration.model.d.ts.map +1 -0
- package/lib/models/DotCMSContent.model.d.ts +1 -0
- package/lib/models/DotCMSContent.model.d.ts.map +1 -0
- package/lib/models/DotCMSElasticSearch.model.d.ts +1 -0
- package/lib/models/DotCMSElasticSearch.model.d.ts.map +1 -0
- package/lib/models/DotCMSError.model.d.ts +1 -0
- package/lib/models/DotCMSError.model.d.ts.map +1 -0
- package/lib/models/DotCMSEvent.model.d.ts +1 -0
- package/lib/models/DotCMSEvent.model.d.ts.map +1 -0
- package/lib/models/DotCMSForm.model.d.ts +1 -0
- package/lib/models/DotCMSForm.model.d.ts.map +1 -0
- package/lib/models/DotCMSHttpClient.model.d.ts +4 -1
- package/lib/models/DotCMSHttpClient.model.d.ts.map +1 -0
- package/lib/models/DotCMSLanguage.model.d.ts +1 -0
- package/lib/models/DotCMSLanguage.model.d.ts.map +1 -0
- package/lib/models/DotCMSNavigation.model.d.ts +1 -0
- package/lib/models/DotCMSNavigation.model.d.ts.map +1 -0
- package/lib/models/DotCMSPage.model.d.ts +1 -0
- package/lib/models/DotCMSPage.model.d.ts.map +1 -0
- package/lib/models/DotCMSPageFormat.model.d.ts +1 -0
- package/lib/models/DotCMSPageFormat.model.d.ts.map +1 -0
- package/lib/models/DotCMSSite.model.d.ts +1 -0
- package/lib/models/DotCMSSite.model.d.ts.map +1 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.d.ts.map +1 -0
- package/lib/utils/DotCMSHttpClient.d.ts +1 -0
- package/lib/utils/DotCMSHttpClient.d.ts.map +1 -0
- package/lib/utils/getEsQuery.d.ts +1 -0
- package/lib/utils/getEsQuery.d.ts.map +1 -0
- package/lib/utils/request.d.ts +2 -1
- package/lib/utils/request.d.ts.map +1 -0
- package/package.json +22 -14
- package/bundles/dotcms.umd.js +0 -1152
- package/bundles/dotcms.umd.js.map +0 -1
- package/bundles/dotcms.umd.min.js +0 -2
- package/bundles/dotcms.umd.min.js.map +0 -1
- package/dotcms.d.ts +0 -4
- package/dotcms.metadata.json +0 -1
- package/esm2015/dotcms.js +0 -10
- package/esm2015/lib/api/DotApiAuthorization.js +0 -55
- package/esm2015/lib/api/DotApiConfiguration.js +0 -43
- package/esm2015/lib/api/DotApiContent.js +0 -96
- package/esm2015/lib/api/DotApiContentType.js +0 -53
- package/esm2015/lib/api/DotApiElasticSearch.js +0 -47
- package/esm2015/lib/api/DotApiEvent.js +0 -26
- package/esm2015/lib/api/DotApiForm.js +0 -37
- package/esm2015/lib/api/DotApiLanguage.js +0 -52
- package/esm2015/lib/api/DotApiNavigation.js +0 -45
- package/esm2015/lib/api/DotApiPage.js +0 -68
- package/esm2015/lib/api/DotApiSite.js +0 -43
- package/esm2015/lib/api/DotApiWidget.js +0 -43
- package/esm2015/lib/models/DotCMSAuthorization.model.js +0 -18
- package/esm2015/lib/models/DotCMSConfiguration.model.js +0 -34
- package/esm2015/lib/models/DotCMSContent.model.js +0 -22
- package/esm2015/lib/models/DotCMSElasticSearch.model.js +0 -80
- package/esm2015/lib/models/DotCMSError.model.js +0 -14
- package/esm2015/lib/models/DotCMSEvent.model.js +0 -14
- package/esm2015/lib/models/DotCMSForm.model.js +0 -28
- package/esm2015/lib/models/DotCMSHttpClient.model.js +0 -18
- package/esm2015/lib/models/DotCMSLanguage.model.js +0 -20
- package/esm2015/lib/models/DotCMSNavigation.model.js +0 -32
- package/esm2015/lib/models/DotCMSPage.model.js +0 -468
- package/esm2015/lib/models/DotCMSPageFormat.model.js +0 -12
- package/esm2015/lib/models/DotCMSSite.model.js +0 -312
- package/esm2015/lib/models/index.js +0 -6
- package/esm2015/lib/utils/DotCMSHttpClient.js +0 -26
- package/esm2015/lib/utils/getEsQuery.js +0 -47
- package/esm2015/lib/utils/request.js +0 -79
- package/esm2015/public_api.js +0 -77
- package/esm5/dotcms.js +0 -10
- package/esm5/lib/api/DotApiAuthorization.js +0 -82
- package/esm5/lib/api/DotApiConfiguration.js +0 -63
- package/esm5/lib/api/DotApiContent.js +0 -152
- package/esm5/lib/api/DotApiContentType.js +0 -75
- package/esm5/lib/api/DotApiElasticSearch.js +0 -72
- package/esm5/lib/api/DotApiEvent.js +0 -42
- package/esm5/lib/api/DotApiForm.js +0 -54
- package/esm5/lib/api/DotApiLanguage.js +0 -80
- package/esm5/lib/api/DotApiNavigation.js +0 -68
- package/esm5/lib/api/DotApiPage.js +0 -108
- package/esm5/lib/api/DotApiSite.js +0 -60
- package/esm5/lib/api/DotApiWidget.js +0 -66
- package/esm5/lib/models/DotCMSAuthorization.model.js +0 -18
- package/esm5/lib/models/DotCMSConfiguration.model.js +0 -34
- package/esm5/lib/models/DotCMSContent.model.js +0 -22
- package/esm5/lib/models/DotCMSElasticSearch.model.js +0 -80
- package/esm5/lib/models/DotCMSError.model.js +0 -14
- package/esm5/lib/models/DotCMSEvent.model.js +0 -14
- package/esm5/lib/models/DotCMSForm.model.js +0 -28
- package/esm5/lib/models/DotCMSHttpClient.model.js +0 -18
- package/esm5/lib/models/DotCMSLanguage.model.js +0 -20
- package/esm5/lib/models/DotCMSNavigation.model.js +0 -32
- package/esm5/lib/models/DotCMSPage.model.js +0 -468
- package/esm5/lib/models/DotCMSPageFormat.model.js +0 -12
- package/esm5/lib/models/DotCMSSite.model.js +0 -312
- package/esm5/lib/models/index.js +0 -6
- package/esm5/lib/utils/DotCMSHttpClient.js +0 -29
- package/esm5/lib/utils/getEsQuery.js +0 -31
- package/esm5/lib/utils/request.js +0 -86
- package/esm5/public_api.js +0 -77
- package/fesm2015/dotcms.js +0 -723
- package/fesm2015/dotcms.js.map +0 -1
- package/fesm5/dotcms.js +0 -972
- package/fesm5/dotcms.js.map +0 -1
package/bundles/dotcms.umd.js
DELETED
|
@@ -1,1152 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('node-fetch')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('dotcms', ['exports', 'node-fetch'], factory) :
|
|
4
|
-
(factory((global.dotcms = {}),global.fetch));
|
|
5
|
-
}(this, (function (exports,fetch) { 'use strict';
|
|
6
|
-
|
|
7
|
-
fetch = fetch && fetch.hasOwnProperty('default') ? fetch['default'] : fetch;
|
|
8
|
-
|
|
9
|
-
/*! *****************************************************************************
|
|
10
|
-
Copyright (c) Microsoft Corporation.
|
|
11
|
-
|
|
12
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
13
|
-
purpose with or without fee is hereby granted.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
16
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
17
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
18
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
19
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
20
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
21
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
22
|
-
***************************************************************************** */
|
|
23
|
-
var __assign = function () {
|
|
24
|
-
__assign = Object.assign || function __assign(t) {
|
|
25
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
26
|
-
s = arguments[i];
|
|
27
|
-
for (var p in s)
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
29
|
-
t[p] = s[p];
|
|
30
|
-
}
|
|
31
|
-
return t;
|
|
32
|
-
};
|
|
33
|
-
return __assign.apply(this, arguments);
|
|
34
|
-
};
|
|
35
|
-
function __rest(s, e) {
|
|
36
|
-
var t = {};
|
|
37
|
-
for (var p in s)
|
|
38
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
39
|
-
t[p] = s[p];
|
|
40
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
41
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
42
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
43
|
-
t[p[i]] = s[p[i]];
|
|
44
|
-
}
|
|
45
|
-
return t;
|
|
46
|
-
}
|
|
47
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
48
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
49
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
50
|
-
function fulfilled(value) { try {
|
|
51
|
-
step(generator.next(value));
|
|
52
|
-
}
|
|
53
|
-
catch (e) {
|
|
54
|
-
reject(e);
|
|
55
|
-
} }
|
|
56
|
-
function rejected(value) { try {
|
|
57
|
-
step(generator["throw"](value));
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
reject(e);
|
|
61
|
-
} }
|
|
62
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
63
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function __generator(thisArg, body) {
|
|
67
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
68
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
69
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
70
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
71
|
-
function step(op) {
|
|
72
|
-
if (f)
|
|
73
|
-
throw new TypeError("Generator is already executing.");
|
|
74
|
-
while (_)
|
|
75
|
-
try {
|
|
76
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
77
|
-
return t;
|
|
78
|
-
if (y = 0, t)
|
|
79
|
-
op = [op[0] & 2, t.value];
|
|
80
|
-
switch (op[0]) {
|
|
81
|
-
case 0:
|
|
82
|
-
case 1:
|
|
83
|
-
t = op;
|
|
84
|
-
break;
|
|
85
|
-
case 4:
|
|
86
|
-
_.label++;
|
|
87
|
-
return { value: op[1], done: false };
|
|
88
|
-
case 5:
|
|
89
|
-
_.label++;
|
|
90
|
-
y = op[1];
|
|
91
|
-
op = [0];
|
|
92
|
-
continue;
|
|
93
|
-
case 7:
|
|
94
|
-
op = _.ops.pop();
|
|
95
|
-
_.trys.pop();
|
|
96
|
-
continue;
|
|
97
|
-
default:
|
|
98
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
99
|
-
_ = 0;
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
103
|
-
_.label = op[1];
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
107
|
-
_.label = t[1];
|
|
108
|
-
t = op;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
if (t && _.label < t[2]) {
|
|
112
|
-
_.label = t[2];
|
|
113
|
-
_.ops.push(op);
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
if (t[2])
|
|
117
|
-
_.ops.pop();
|
|
118
|
-
_.trys.pop();
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
op = body.call(thisArg, _);
|
|
122
|
-
}
|
|
123
|
-
catch (e) {
|
|
124
|
-
op = [6, e];
|
|
125
|
-
y = 0;
|
|
126
|
-
}
|
|
127
|
-
finally {
|
|
128
|
-
f = t = 0;
|
|
129
|
-
}
|
|
130
|
-
if (op[0] & 5)
|
|
131
|
-
throw op[1];
|
|
132
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
function __values(o) {
|
|
136
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
137
|
-
if (m)
|
|
138
|
-
return m.call(o);
|
|
139
|
-
if (o && typeof o.length === "number")
|
|
140
|
-
return {
|
|
141
|
-
next: function () {
|
|
142
|
-
if (o && i >= o.length)
|
|
143
|
-
o = void 0;
|
|
144
|
-
return { value: o && o[i++], done: !o };
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @fileoverview added by tsickle
|
|
152
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
153
|
-
*/
|
|
154
|
-
/**
|
|
155
|
-
* @param {?} data
|
|
156
|
-
* @return {?}
|
|
157
|
-
*/
|
|
158
|
-
function getErrorMessage(data) {
|
|
159
|
-
if (data["errors"]) {
|
|
160
|
-
return data["errors"][0].message;
|
|
161
|
-
}
|
|
162
|
-
if (data["error"]) {
|
|
163
|
-
return data["error"];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* DotCMS Authentication handler to intereact with {\@link https://dotcms.com/docs/latest/rest-api-authentication | Authentication API}
|
|
168
|
-
*
|
|
169
|
-
*/
|
|
170
|
-
var /**
|
|
171
|
-
* DotCMS Authentication handler to intereact with {\@link https://dotcms.com/docs/latest/rest-api-authentication | Authentication API}
|
|
172
|
-
*
|
|
173
|
-
*/ DotApiAuthorization = /** @class */ (function () {
|
|
174
|
-
function DotApiAuthorization() {
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Given user, password and expiration date to get a DotCMS Autorization Token
|
|
178
|
-
*/
|
|
179
|
-
/**
|
|
180
|
-
* Given user, password and expiration date to get a DotCMS Autorization Token
|
|
181
|
-
* @param {?} params
|
|
182
|
-
* @return {?}
|
|
183
|
-
*/
|
|
184
|
-
DotApiAuthorization.prototype.getToken = /**
|
|
185
|
-
* Given user, password and expiration date to get a DotCMS Autorization Token
|
|
186
|
-
* @param {?} params
|
|
187
|
-
* @return {?}
|
|
188
|
-
*/
|
|
189
|
-
function (params) {
|
|
190
|
-
var _this = this;
|
|
191
|
-
var user = params.user, password = params.password, expirationDays = params.expirationDays, host = params.host;
|
|
192
|
-
return fetch((host || '') + "/api/v1/authentication/api-token", {
|
|
193
|
-
method: 'POST',
|
|
194
|
-
headers: {
|
|
195
|
-
'Content-Type': 'application/json'
|
|
196
|
-
},
|
|
197
|
-
body: JSON.stringify({
|
|
198
|
-
user: user,
|
|
199
|
-
password: password,
|
|
200
|
-
expirationDays: expirationDays || 10
|
|
201
|
-
})
|
|
202
|
-
}).then(function (res) {
|
|
203
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
204
|
-
var data;
|
|
205
|
-
return __generator(this, function (_a) {
|
|
206
|
-
switch (_a.label) {
|
|
207
|
-
case 0: return [4 /*yield*/, res.json()];
|
|
208
|
-
case 1:
|
|
209
|
-
data = _a.sent();
|
|
210
|
-
if (res.status === 200) {
|
|
211
|
-
return [2 /*return*/, data.entity.token];
|
|
212
|
-
}
|
|
213
|
-
throw /** @type {?} */ ({
|
|
214
|
-
message: getErrorMessage(data),
|
|
215
|
-
statusCode: res.status
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
return DotApiAuthorization;
|
|
223
|
-
}());
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* @fileoverview added by tsickle
|
|
227
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
228
|
-
*/
|
|
229
|
-
/**
|
|
230
|
-
* Get the information of DotCMS configuration
|
|
231
|
-
*
|
|
232
|
-
*/
|
|
233
|
-
var /**
|
|
234
|
-
* Get the information of DotCMS configuration
|
|
235
|
-
*
|
|
236
|
-
*/ DotApiConfiguration = /** @class */ (function () {
|
|
237
|
-
function DotApiConfiguration(httpClient) {
|
|
238
|
-
this.dotCMSHttpClient = httpClient;
|
|
239
|
-
}
|
|
240
|
-
// TODO: CATCH THIS ERROR
|
|
241
|
-
/**
|
|
242
|
-
* @return {?}
|
|
243
|
-
*/
|
|
244
|
-
DotApiConfiguration.prototype.get = /**
|
|
245
|
-
* @return {?}
|
|
246
|
-
*/
|
|
247
|
-
function () {
|
|
248
|
-
var _this = this;
|
|
249
|
-
return this.dotCMSHttpClient
|
|
250
|
-
.request({
|
|
251
|
-
url: '/api/v1/configuration'
|
|
252
|
-
})
|
|
253
|
-
.then(function (response) {
|
|
254
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
255
|
-
var data, _a;
|
|
256
|
-
return __generator(this, function (_b) {
|
|
257
|
-
switch (_b.label) {
|
|
258
|
-
case 0:
|
|
259
|
-
if (!(response.status === 200))
|
|
260
|
-
return [3 /*break*/, 2];
|
|
261
|
-
return [4 /*yield*/, response.json()];
|
|
262
|
-
case 1:
|
|
263
|
-
data = _b.sent();
|
|
264
|
-
return [2 /*return*/, data.entity];
|
|
265
|
-
case 2:
|
|
266
|
-
_a = {};
|
|
267
|
-
return [4 /*yield*/, response.text()];
|
|
268
|
-
case 3: throw /** @type {?} */ (_a.message = _b.sent(),
|
|
269
|
-
_a.statusCode = response.status,
|
|
270
|
-
_a);
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
});
|
|
275
|
-
};
|
|
276
|
-
return DotApiConfiguration;
|
|
277
|
-
}());
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* @fileoverview added by tsickle
|
|
281
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
282
|
-
*/
|
|
283
|
-
/**
|
|
284
|
-
* @param {?} params
|
|
285
|
-
* @return {?}
|
|
286
|
-
*/
|
|
287
|
-
function getEsQuery(params) {
|
|
288
|
-
var contentType = params.contentType, _a = params.queryParams, languageId = _a.languageId, sortResultsBy = _a.sortResultsBy, sortOrder1 = _a.sortOrder1, offset = _a.offset, pagination = _a.pagination, itemsPerPage = _a.itemsPerPage, numberOfResults = _a.numberOfResults, detailedSearchQuery = _a.detailedSearchQuery;
|
|
289
|
-
/** @type {?} */
|
|
290
|
-
var paginationQuery = ",\n \"from\": OFFSETVALUE,\n \"size\": SIZEPERPAGE";
|
|
291
|
-
/** @type {?} */
|
|
292
|
-
var query = "{\n \"query\": {\n \"bool\": {\n \"must\": {\n \"query_string\" : {\n \"query\" : \"+contentType:CONTENTTYPE +languageId:LANGUAGEIDVALUE " + (detailedSearchQuery ||
|
|
293
|
-
'') + "\"\n }\n }\n }\n },\n \"sort\" : [\n { \"SORTBYVALUE\" : {\"order\" : \"SORTTYPEVALUE\"}}\n ]\n " + (pagination || numberOfResults ? paginationQuery : '') + "\n }";
|
|
294
|
-
/** @type {?} */
|
|
295
|
-
var esParams = {
|
|
296
|
-
CONTENTTYPE: contentType,
|
|
297
|
-
LANGUAGEIDVALUE: languageId || '1',
|
|
298
|
-
SORTBYVALUE: sortResultsBy || 'title_dotraw',
|
|
299
|
-
SORTTYPEVALUE: sortOrder1 || 'asc',
|
|
300
|
-
OFFSETVALUE: offset || '0',
|
|
301
|
-
SIZEPERPAGE: pagination ? itemsPerPage || 20 : numberOfResults || 40
|
|
302
|
-
};
|
|
303
|
-
Object.keys(esParams).forEach(function (key) {
|
|
304
|
-
query = query.replace(key, esParams[key]);
|
|
305
|
-
});
|
|
306
|
-
return query;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* @fileoverview added by tsickle
|
|
311
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
312
|
-
*/
|
|
313
|
-
/**
|
|
314
|
-
* Request content from DotCMS using the {\@link https://dotcms.com/docs/latest/elasticsearch-rest-api | Elastic Search API}
|
|
315
|
-
*
|
|
316
|
-
*/
|
|
317
|
-
var /**
|
|
318
|
-
* Request content from DotCMS using the {\@link https://dotcms.com/docs/latest/elasticsearch-rest-api | Elastic Search API}
|
|
319
|
-
*
|
|
320
|
-
*/ DotApiElasticSearch = /** @class */ (function () {
|
|
321
|
-
function DotApiElasticSearch(httpClient) {
|
|
322
|
-
this.dotCMSHttpClient = httpClient;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Provide the content type and the elastic search query and get the results contentlets and elastic search information
|
|
326
|
-
*
|
|
327
|
-
*/
|
|
328
|
-
/**
|
|
329
|
-
* Provide the content type and the elastic search query and get the results contentlets and elastic search information
|
|
330
|
-
*
|
|
331
|
-
* @param {?} params
|
|
332
|
-
* @return {?}
|
|
333
|
-
*/
|
|
334
|
-
DotApiElasticSearch.prototype.search = /**
|
|
335
|
-
* Provide the content type and the elastic search query and get the results contentlets and elastic search information
|
|
336
|
-
*
|
|
337
|
-
* @param {?} params
|
|
338
|
-
* @return {?}
|
|
339
|
-
*/
|
|
340
|
-
function (params) {
|
|
341
|
-
var _this = this;
|
|
342
|
-
return this.dotCMSHttpClient
|
|
343
|
-
.request({
|
|
344
|
-
url: '/api/es/search',
|
|
345
|
-
method: 'POST',
|
|
346
|
-
body: getEsQuery(params)
|
|
347
|
-
})
|
|
348
|
-
.then(function (response) {
|
|
349
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
350
|
-
var _a;
|
|
351
|
-
return __generator(this, function (_b) {
|
|
352
|
-
switch (_b.label) {
|
|
353
|
-
case 0:
|
|
354
|
-
if (response.status === 200) {
|
|
355
|
-
return [2 /*return*/, response.json()];
|
|
356
|
-
}
|
|
357
|
-
_a = {};
|
|
358
|
-
return [4 /*yield*/, response.text()];
|
|
359
|
-
case 1: throw /** @type {?} */ (_a.message = _b.sent(),
|
|
360
|
-
_a.statusCode = response.status,
|
|
361
|
-
_a);
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
|
-
return DotApiElasticSearch;
|
|
368
|
-
}());
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* @fileoverview added by tsickle
|
|
372
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
373
|
-
*/
|
|
374
|
-
/**
|
|
375
|
-
* Emit custom events for the DotCMS Edit Mode
|
|
376
|
-
*
|
|
377
|
-
*/
|
|
378
|
-
var /**
|
|
379
|
-
* Emit custom events for the DotCMS Edit Mode
|
|
380
|
-
*
|
|
381
|
-
*/ DotApiEvent = /** @class */ (function () {
|
|
382
|
-
function DotApiEvent() {
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* @param {?} params
|
|
386
|
-
* @return {?}
|
|
387
|
-
*/
|
|
388
|
-
DotApiEvent.prototype.emit = /**
|
|
389
|
-
* @param {?} params
|
|
390
|
-
* @return {?}
|
|
391
|
-
*/
|
|
392
|
-
function (params) {
|
|
393
|
-
var name = params.name, data = params.data;
|
|
394
|
-
/** @type {?} */
|
|
395
|
-
var customEvent = window.top.document.createEvent('CustomEvent');
|
|
396
|
-
customEvent.initCustomEvent('ng-event', false, false, {
|
|
397
|
-
name: name,
|
|
398
|
-
data: data
|
|
399
|
-
});
|
|
400
|
-
window.top.document.dispatchEvent(customEvent);
|
|
401
|
-
};
|
|
402
|
-
return DotApiEvent;
|
|
403
|
-
}());
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* @fileoverview added by tsickle
|
|
407
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
408
|
-
*/
|
|
409
|
-
/**
|
|
410
|
-
* Get DotCMS {\@link https://dotcms.com/docs/latest/adding-and-editing-languages | Language code}
|
|
411
|
-
*
|
|
412
|
-
*/
|
|
413
|
-
var /**
|
|
414
|
-
* Get DotCMS {\@link https://dotcms.com/docs/latest/adding-and-editing-languages | Language code}
|
|
415
|
-
*
|
|
416
|
-
*/ DotApiLanguage = /** @class */ (function () {
|
|
417
|
-
function DotApiLanguage(appConfig) {
|
|
418
|
-
this.dotAppConfig = appConfig;
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* @param {?} langCode
|
|
422
|
-
* @return {?}
|
|
423
|
-
*/
|
|
424
|
-
DotApiLanguage.prototype.getId = /**
|
|
425
|
-
* @param {?} langCode
|
|
426
|
-
* @return {?}
|
|
427
|
-
*/
|
|
428
|
-
function (langCode) {
|
|
429
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
430
|
-
var languages, language;
|
|
431
|
-
return __generator(this, function (_a) {
|
|
432
|
-
switch (_a.label) {
|
|
433
|
-
case 0: return [4 /*yield*/, this.getLanguages()];
|
|
434
|
-
case 1:
|
|
435
|
-
languages = _a.sent();
|
|
436
|
-
language = languages.find(function (lang) { return lang.languageCode === langCode; });
|
|
437
|
-
return [2 /*return*/, language ? "" + language.id : null];
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
});
|
|
441
|
-
};
|
|
442
|
-
/**
|
|
443
|
-
* @return {?}
|
|
444
|
-
*/
|
|
445
|
-
DotApiLanguage.prototype.getLanguages = /**
|
|
446
|
-
* @return {?}
|
|
447
|
-
*/
|
|
448
|
-
function () {
|
|
449
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
450
|
-
var _a;
|
|
451
|
-
return __generator(this, function (_b) {
|
|
452
|
-
switch (_b.label) {
|
|
453
|
-
case 0:
|
|
454
|
-
if (this._languagesConf) {
|
|
455
|
-
return [2 /*return*/, this._languagesConf];
|
|
456
|
-
}
|
|
457
|
-
_a = this;
|
|
458
|
-
return [4 /*yield*/, this.dotAppConfig
|
|
459
|
-
.get()
|
|
460
|
-
.then(function (data) { return data.languages; })];
|
|
461
|
-
case 1:
|
|
462
|
-
_a._languagesConf = _b.sent();
|
|
463
|
-
return [2 /*return*/, this._languagesConf];
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
});
|
|
467
|
-
};
|
|
468
|
-
return DotApiLanguage;
|
|
469
|
-
}());
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* @fileoverview added by tsickle
|
|
473
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
474
|
-
*/
|
|
475
|
-
/**
|
|
476
|
-
* Retrieve information about the dotCMS file and folder tree with the {\@link https://dotcms.com/docs/latest/navigation-rest-api | Navigation REST API }
|
|
477
|
-
*
|
|
478
|
-
*/
|
|
479
|
-
var /**
|
|
480
|
-
* Retrieve information about the dotCMS file and folder tree with the {\@link https://dotcms.com/docs/latest/navigation-rest-api | Navigation REST API }
|
|
481
|
-
*
|
|
482
|
-
*/ DotApiNavigation = /** @class */ (function () {
|
|
483
|
-
function DotApiNavigation(httpClient) {
|
|
484
|
-
this.dotCMSHttpClient = httpClient;
|
|
485
|
-
}
|
|
486
|
-
/**
|
|
487
|
-
* @param {?=} deep
|
|
488
|
-
* @param {?=} location
|
|
489
|
-
* @return {?}
|
|
490
|
-
*/
|
|
491
|
-
DotApiNavigation.prototype.get = /**
|
|
492
|
-
* @param {?=} deep
|
|
493
|
-
* @param {?=} location
|
|
494
|
-
* @return {?}
|
|
495
|
-
*/
|
|
496
|
-
function (deep, location) {
|
|
497
|
-
var _this = this;
|
|
498
|
-
if (deep === void 0) {
|
|
499
|
-
deep = '2';
|
|
500
|
-
}
|
|
501
|
-
if (location === void 0) {
|
|
502
|
-
location = '/';
|
|
503
|
-
}
|
|
504
|
-
return this.dotCMSHttpClient
|
|
505
|
-
.request({
|
|
506
|
-
url: "/api/v1/nav/" + location + "?depth=" + deep
|
|
507
|
-
})
|
|
508
|
-
.then(function (res) {
|
|
509
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
510
|
-
var data, _a;
|
|
511
|
-
return __generator(this, function (_b) {
|
|
512
|
-
switch (_b.label) {
|
|
513
|
-
case 0:
|
|
514
|
-
if (!(res.status === 200))
|
|
515
|
-
return [3 /*break*/, 2];
|
|
516
|
-
return [4 /*yield*/, res.json()];
|
|
517
|
-
case 1:
|
|
518
|
-
data = _b.sent();
|
|
519
|
-
return [2 /*return*/, /** @type {?} */ (data.entity)];
|
|
520
|
-
case 2:
|
|
521
|
-
_a = {};
|
|
522
|
-
return [4 /*yield*/, res.text()];
|
|
523
|
-
case 3: throw /** @type {?} */ (_a.message = _b.sent(),
|
|
524
|
-
_a.statusCode = res.status,
|
|
525
|
-
_a);
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
});
|
|
529
|
-
});
|
|
530
|
-
};
|
|
531
|
-
return DotApiNavigation;
|
|
532
|
-
}());
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* @fileoverview added by tsickle
|
|
536
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
537
|
-
*/
|
|
538
|
-
/**
|
|
539
|
-
* Allow easy interaction with {\@link https://dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas | DotCMS Page API}
|
|
540
|
-
*
|
|
541
|
-
*/
|
|
542
|
-
var /**
|
|
543
|
-
* Allow easy interaction with {\@link https://dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas | DotCMS Page API}
|
|
544
|
-
*
|
|
545
|
-
*/ DotApiPage = /** @class */ (function () {
|
|
546
|
-
function DotApiPage(httpClient, appLanguage) {
|
|
547
|
-
this.dotCMSHttpClient = httpClient;
|
|
548
|
-
this.dotAppLanguage = appLanguage;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Given the page url and the language return a {@link DotCMSPageAsset}
|
|
552
|
-
*
|
|
553
|
-
*/
|
|
554
|
-
/**
|
|
555
|
-
* Given the page url and the language return a {\@link DotCMSPageAsset}
|
|
556
|
-
*
|
|
557
|
-
* @param {?} params
|
|
558
|
-
* @param {?=} format
|
|
559
|
-
* @return {?}
|
|
560
|
-
*/
|
|
561
|
-
DotApiPage.prototype.get = /**
|
|
562
|
-
* Given the page url and the language return a {\@link DotCMSPageAsset}
|
|
563
|
-
*
|
|
564
|
-
* @param {?} params
|
|
565
|
-
* @param {?=} format
|
|
566
|
-
* @return {?}
|
|
567
|
-
*/
|
|
568
|
-
function (params, format) {
|
|
569
|
-
if (format === void 0) {
|
|
570
|
-
format = "json" /* JSON */;
|
|
571
|
-
}
|
|
572
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
573
|
-
var _a, _b, _c;
|
|
574
|
-
var _this = this;
|
|
575
|
-
return __generator(this, function (_d) {
|
|
576
|
-
switch (_d.label) {
|
|
577
|
-
case 0:
|
|
578
|
-
if (!params.language)
|
|
579
|
-
return [3 /*break*/, 4];
|
|
580
|
-
_a = [{}, params];
|
|
581
|
-
_b = {};
|
|
582
|
-
if (!isNaN(/** @type {?} */ (params.language)))
|
|
583
|
-
return [3 /*break*/, 2];
|
|
584
|
-
return [4 /*yield*/, this.dotAppLanguage.getId(params.language)];
|
|
585
|
-
case 1:
|
|
586
|
-
_c = _d.sent();
|
|
587
|
-
return [3 /*break*/, 3];
|
|
588
|
-
case 2:
|
|
589
|
-
_c = params.language;
|
|
590
|
-
_d.label = 3;
|
|
591
|
-
case 3:
|
|
592
|
-
params = __assign.apply(void 0, _a.concat([(_b.language = _c, _b)]));
|
|
593
|
-
_d.label = 4;
|
|
594
|
-
case 4:
|
|
595
|
-
params = __assign({}, params, { url: "/api/v1/page/" + format + params.url });
|
|
596
|
-
return [2 /*return*/, this.dotCMSHttpClient.request(params).then(function (res) {
|
|
597
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
598
|
-
var data, response, error;
|
|
599
|
-
return __generator(this, function (_a) {
|
|
600
|
-
switch (_a.label) {
|
|
601
|
-
case 0:
|
|
602
|
-
if (!(res.status === 200))
|
|
603
|
-
return [3 /*break*/, 2];
|
|
604
|
-
return [4 /*yield*/, res.json()];
|
|
605
|
-
case 1:
|
|
606
|
-
data = _a.sent();
|
|
607
|
-
return [2 /*return*/, /** @type {?} */ (data.entity)];
|
|
608
|
-
case 2: return [4 /*yield*/, res.text()];
|
|
609
|
-
case 3:
|
|
610
|
-
response = _a.sent();
|
|
611
|
-
try {
|
|
612
|
-
error = {
|
|
613
|
-
statusCode: res.status,
|
|
614
|
-
message: JSON.parse(response).message
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
catch (_b) {
|
|
618
|
-
error = {
|
|
619
|
-
statusCode: res.status,
|
|
620
|
-
message: response
|
|
621
|
-
};
|
|
622
|
-
}
|
|
623
|
-
throw error;
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
});
|
|
627
|
-
})];
|
|
628
|
-
}
|
|
629
|
-
});
|
|
630
|
-
});
|
|
631
|
-
};
|
|
632
|
-
return DotApiPage;
|
|
633
|
-
}());
|
|
634
|
-
|
|
635
|
-
/**
|
|
636
|
-
* @fileoverview added by tsickle
|
|
637
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
638
|
-
*/
|
|
639
|
-
/**
|
|
640
|
-
* Get information from {\@link https://dotcms.com/docs/latest/multi-site-management | DotCMS Sites}
|
|
641
|
-
*/
|
|
642
|
-
var /**
|
|
643
|
-
* Get information from {\@link https://dotcms.com/docs/latest/multi-site-management | DotCMS Sites}
|
|
644
|
-
*/ DotApiSite = /** @class */ (function () {
|
|
645
|
-
function DotApiSite(httpClient) {
|
|
646
|
-
this.dotCMSHttpClient = httpClient;
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* @return {?}
|
|
650
|
-
*/
|
|
651
|
-
DotApiSite.prototype.getCurrentSite = /**
|
|
652
|
-
* @return {?}
|
|
653
|
-
*/
|
|
654
|
-
function () {
|
|
655
|
-
var _this = this;
|
|
656
|
-
return this.dotCMSHttpClient
|
|
657
|
-
.request({
|
|
658
|
-
url: "/api/v1/site/currentSite"
|
|
659
|
-
})
|
|
660
|
-
.then(function (response) {
|
|
661
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
662
|
-
var data, _a, map, site, _b;
|
|
663
|
-
return __generator(this, function (_c) {
|
|
664
|
-
switch (_c.label) {
|
|
665
|
-
case 0:
|
|
666
|
-
if (!(response.status === 200))
|
|
667
|
-
return [3 /*break*/, 2];
|
|
668
|
-
return [4 /*yield*/, response.json()];
|
|
669
|
-
case 1:
|
|
670
|
-
data = _c.sent();
|
|
671
|
-
_a = data.entity, map = _a.map, site = __rest(_a, ["map"]);
|
|
672
|
-
return [2 /*return*/, /** @type {?} */ (site)];
|
|
673
|
-
case 2:
|
|
674
|
-
_b = {};
|
|
675
|
-
return [4 /*yield*/, response.text()];
|
|
676
|
-
case 3: throw /** @type {?} */ (_b.message = _c.sent(),
|
|
677
|
-
_b.statusCode = response.status,
|
|
678
|
-
_b);
|
|
679
|
-
}
|
|
680
|
-
});
|
|
681
|
-
});
|
|
682
|
-
});
|
|
683
|
-
};
|
|
684
|
-
return DotApiSite;
|
|
685
|
-
}());
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* @fileoverview added by tsickle
|
|
689
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
690
|
-
*/
|
|
691
|
-
/**
|
|
692
|
-
* DotCMS {\@link https://dotcms.com/docs/latest/widgets | widgets handler}
|
|
693
|
-
*/
|
|
694
|
-
var /**
|
|
695
|
-
* DotCMS {\@link https://dotcms.com/docs/latest/widgets | widgets handler}
|
|
696
|
-
*/ DotApiWidget = /** @class */ (function () {
|
|
697
|
-
function DotApiWidget(httpClient) {
|
|
698
|
-
this.dotCMSHttpClient = httpClient;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Get the widght HTML strong with it identifier
|
|
702
|
-
*
|
|
703
|
-
*/
|
|
704
|
-
/**
|
|
705
|
-
* Get the widght HTML strong with it identifier
|
|
706
|
-
*
|
|
707
|
-
* @param {?} widgetId
|
|
708
|
-
* @return {?}
|
|
709
|
-
*/
|
|
710
|
-
DotApiWidget.prototype.getHtml = /**
|
|
711
|
-
* Get the widght HTML strong with it identifier
|
|
712
|
-
*
|
|
713
|
-
* @param {?} widgetId
|
|
714
|
-
* @return {?}
|
|
715
|
-
*/
|
|
716
|
-
function (widgetId) {
|
|
717
|
-
var _this = this;
|
|
718
|
-
return this.dotCMSHttpClient
|
|
719
|
-
.request({
|
|
720
|
-
url: "/api/widget/id/" + widgetId
|
|
721
|
-
})
|
|
722
|
-
.then(function (response) {
|
|
723
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
724
|
-
var _a;
|
|
725
|
-
return __generator(this, function (_b) {
|
|
726
|
-
switch (_b.label) {
|
|
727
|
-
case 0:
|
|
728
|
-
if (response.status === 200) {
|
|
729
|
-
return [2 /*return*/, response.text()];
|
|
730
|
-
}
|
|
731
|
-
_a = {};
|
|
732
|
-
return [4 /*yield*/, response.text()];
|
|
733
|
-
case 1: throw /** @type {?} */ (_a.message = _b.sent(),
|
|
734
|
-
_a.statusCode = response.status,
|
|
735
|
-
_a);
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
});
|
|
739
|
-
});
|
|
740
|
-
};
|
|
741
|
-
return DotApiWidget;
|
|
742
|
-
}());
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* @fileoverview added by tsickle
|
|
746
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
747
|
-
*/
|
|
748
|
-
/**
|
|
749
|
-
* @param {?} language
|
|
750
|
-
* @param {?} hostId
|
|
751
|
-
* @return {?}
|
|
752
|
-
*/
|
|
753
|
-
function getQueryParams(language, hostId) {
|
|
754
|
-
/** @type {?} */
|
|
755
|
-
var result = language || hostId ? '?' : '';
|
|
756
|
-
if (language) {
|
|
757
|
-
result += "language_id=" + language;
|
|
758
|
-
if (hostId) {
|
|
759
|
-
result += '&';
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
if (hostId) {
|
|
763
|
-
result += "host_id=" + hostId;
|
|
764
|
-
}
|
|
765
|
-
return result;
|
|
766
|
-
}
|
|
767
|
-
/**
|
|
768
|
-
* @param {?} params
|
|
769
|
-
* @param {?} config
|
|
770
|
-
* @return {?}
|
|
771
|
-
*/
|
|
772
|
-
function getUrl(params, config) {
|
|
773
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
774
|
-
var host;
|
|
775
|
-
return __generator(this, function (_a) {
|
|
776
|
-
host = config.host || '';
|
|
777
|
-
return [2 /*return*/, "" + host + params.url + getQueryParams(params.language, config.hostId)];
|
|
778
|
-
});
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
/**
|
|
782
|
-
* @param {?} params
|
|
783
|
-
* @return {?}
|
|
784
|
-
*/
|
|
785
|
-
function shouldAppendBody(params) {
|
|
786
|
-
return params.method === 'POST' && !!params.body;
|
|
787
|
-
}
|
|
788
|
-
/**
|
|
789
|
-
* @param {?} params
|
|
790
|
-
* @param {?} config
|
|
791
|
-
* @return {?}
|
|
792
|
-
*/
|
|
793
|
-
function getOpts(params, config) {
|
|
794
|
-
/** @type {?} */
|
|
795
|
-
var opts = {
|
|
796
|
-
method: params.method || 'GET',
|
|
797
|
-
headers: {
|
|
798
|
-
Authorization: "Bearer " + config.token,
|
|
799
|
-
'Content-type': 'application/json'
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
if (shouldAppendBody(params)) {
|
|
803
|
-
opts = __assign({}, opts, { body: params.body });
|
|
804
|
-
}
|
|
805
|
-
return opts;
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
* @param {?} params
|
|
809
|
-
* @param {?} config
|
|
810
|
-
* @return {?}
|
|
811
|
-
*/
|
|
812
|
-
function request(params, config) {
|
|
813
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
814
|
-
var url, opts;
|
|
815
|
-
return __generator(this, function (_a) {
|
|
816
|
-
switch (_a.label) {
|
|
817
|
-
case 0: return [4 /*yield*/, getUrl(params, config)];
|
|
818
|
-
case 1:
|
|
819
|
-
url = _a.sent();
|
|
820
|
-
opts = getOpts(params, config);
|
|
821
|
-
return [2 /*return*/, fetch(url, opts)];
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* @fileoverview added by tsickle
|
|
829
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
830
|
-
*/
|
|
831
|
-
var DotCMSHttpClient = /** @class */ (function () {
|
|
832
|
-
function DotCMSHttpClient(config) {
|
|
833
|
-
this._config = config;
|
|
834
|
-
}
|
|
835
|
-
/**
|
|
836
|
-
* @param {?} params
|
|
837
|
-
* @return {?}
|
|
838
|
-
*/
|
|
839
|
-
DotCMSHttpClient.prototype.request = /**
|
|
840
|
-
* @param {?} params
|
|
841
|
-
* @return {?}
|
|
842
|
-
*/
|
|
843
|
-
function (params) {
|
|
844
|
-
return request(params, this._config);
|
|
845
|
-
};
|
|
846
|
-
return DotCMSHttpClient;
|
|
847
|
-
}());
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* @fileoverview added by tsickle
|
|
851
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
852
|
-
*/
|
|
853
|
-
/**
|
|
854
|
-
* @param {?} params
|
|
855
|
-
* @return {?}
|
|
856
|
-
*/
|
|
857
|
-
function populateQueryUrl(params) {
|
|
858
|
-
var e_1, _a, e_2, _b;
|
|
859
|
-
/** @type {?} */
|
|
860
|
-
var url = '';
|
|
861
|
-
/** @type {?} */
|
|
862
|
-
var attrs = {
|
|
863
|
-
depth: "/depth/" + params.options.depth,
|
|
864
|
-
limit: "/limit/" + params.options.limit,
|
|
865
|
-
offset: "/offset/" + params.options.offset,
|
|
866
|
-
orderBy: "/orderby/" + params.options.orderBy
|
|
867
|
-
};
|
|
868
|
-
if (params.queryParams) {
|
|
869
|
-
try {
|
|
870
|
-
for (var _c = __values(Object.keys(params.queryParams)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
871
|
-
var key = _d.value;
|
|
872
|
-
url += "+" + key + ":" + params.queryParams[key] + "%20";
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
catch (e_1_1) {
|
|
876
|
-
e_1 = { error: e_1_1 };
|
|
877
|
-
}
|
|
878
|
-
finally {
|
|
879
|
-
try {
|
|
880
|
-
if (_d && !_d.done && (_a = _c.return))
|
|
881
|
-
_a.call(_c);
|
|
882
|
-
}
|
|
883
|
-
finally {
|
|
884
|
-
if (e_1)
|
|
885
|
-
throw e_1.error;
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
}
|
|
889
|
-
try {
|
|
890
|
-
for (var _e = __values(Object.keys(params.options)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
891
|
-
var key = _f.value;
|
|
892
|
-
url += attrs[key];
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
catch (e_2_1) {
|
|
896
|
-
e_2 = { error: e_2_1 };
|
|
897
|
-
}
|
|
898
|
-
finally {
|
|
899
|
-
try {
|
|
900
|
-
if (_f && !_f.done && (_b = _e.return))
|
|
901
|
-
_b.call(_e);
|
|
902
|
-
}
|
|
903
|
-
finally {
|
|
904
|
-
if (e_2)
|
|
905
|
-
throw e_2.error;
|
|
906
|
-
}
|
|
907
|
-
}
|
|
908
|
-
return url;
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Query/Save/Publish the information of DotCMS Content
|
|
912
|
-
*
|
|
913
|
-
*/
|
|
914
|
-
var /**
|
|
915
|
-
* Query/Save/Publish the information of DotCMS Content
|
|
916
|
-
*
|
|
917
|
-
*/ DotApiContent = /** @class */ (function () {
|
|
918
|
-
function DotApiContent(httpClient) {
|
|
919
|
-
this.dotCMSHttpClient = httpClient;
|
|
920
|
-
}
|
|
921
|
-
/**
|
|
922
|
-
* @param {?} params
|
|
923
|
-
* @return {?}
|
|
924
|
-
*/
|
|
925
|
-
DotApiContent.prototype.query = /**
|
|
926
|
-
* @param {?} params
|
|
927
|
-
* @return {?}
|
|
928
|
-
*/
|
|
929
|
-
function (params) {
|
|
930
|
-
/** @type {?} */
|
|
931
|
-
var url = "/api/content/query/+contentType:" + params.contentType + "%20" + populateQueryUrl(params);
|
|
932
|
-
return this.doRequest(url, null, 'GET');
|
|
933
|
-
};
|
|
934
|
-
/**
|
|
935
|
-
* @template Content
|
|
936
|
-
* @param {?} params
|
|
937
|
-
* @return {?}
|
|
938
|
-
*/
|
|
939
|
-
DotApiContent.prototype.save = /**
|
|
940
|
-
* @template Content
|
|
941
|
-
* @param {?} params
|
|
942
|
-
* @return {?}
|
|
943
|
-
*/
|
|
944
|
-
function (params) {
|
|
945
|
-
return this.doRequest('/api/content/save/1', params);
|
|
946
|
-
};
|
|
947
|
-
/**
|
|
948
|
-
* @template Content
|
|
949
|
-
* @param {?} params
|
|
950
|
-
* @return {?}
|
|
951
|
-
*/
|
|
952
|
-
DotApiContent.prototype.publish = /**
|
|
953
|
-
* @template Content
|
|
954
|
-
* @param {?} params
|
|
955
|
-
* @return {?}
|
|
956
|
-
*/
|
|
957
|
-
function (params) {
|
|
958
|
-
return this.doRequest('/api/content/publish/1', params);
|
|
959
|
-
};
|
|
960
|
-
/**
|
|
961
|
-
* @template Content
|
|
962
|
-
* @param {?} url
|
|
963
|
-
* @param {?=} params
|
|
964
|
-
* @param {?=} httpMethod
|
|
965
|
-
* @return {?}
|
|
966
|
-
*/
|
|
967
|
-
DotApiContent.prototype.doRequest = /**
|
|
968
|
-
* @template Content
|
|
969
|
-
* @param {?} url
|
|
970
|
-
* @param {?=} params
|
|
971
|
-
* @param {?=} httpMethod
|
|
972
|
-
* @return {?}
|
|
973
|
-
*/
|
|
974
|
-
function (url, params, httpMethod) {
|
|
975
|
-
if (httpMethod === void 0) {
|
|
976
|
-
httpMethod = 'POST';
|
|
977
|
-
}
|
|
978
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
979
|
-
var response, _a;
|
|
980
|
-
return __generator(this, function (_b) {
|
|
981
|
-
switch (_b.label) {
|
|
982
|
-
case 0: return [4 /*yield*/, this.dotCMSHttpClient.request({
|
|
983
|
-
url: url,
|
|
984
|
-
method: httpMethod,
|
|
985
|
-
body: params ? JSON.stringify(params) : ''
|
|
986
|
-
})];
|
|
987
|
-
case 1:
|
|
988
|
-
response = _b.sent();
|
|
989
|
-
if (!(response.status !== 200))
|
|
990
|
-
return [3 /*break*/, 3];
|
|
991
|
-
_a = {};
|
|
992
|
-
return [4 /*yield*/, response.text()];
|
|
993
|
-
case 2: throw /** @type {?} */ (_a.message = _b.sent(),
|
|
994
|
-
_a.statusCode = response.status,
|
|
995
|
-
_a);
|
|
996
|
-
case 3: return [2 /*return*/, response];
|
|
997
|
-
}
|
|
998
|
-
});
|
|
999
|
-
});
|
|
1000
|
-
};
|
|
1001
|
-
return DotApiContent;
|
|
1002
|
-
}());
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* @fileoverview added by tsickle
|
|
1006
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1007
|
-
*/
|
|
1008
|
-
/**
|
|
1009
|
-
* Get the information of DotCMS contentTypes
|
|
1010
|
-
*
|
|
1011
|
-
*/
|
|
1012
|
-
var /**
|
|
1013
|
-
* Get the information of DotCMS contentTypes
|
|
1014
|
-
*
|
|
1015
|
-
*/ DotApiContentType = /** @class */ (function () {
|
|
1016
|
-
function DotApiContentType(httpClient) {
|
|
1017
|
-
this.dotCMSHttpClient = httpClient;
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* @param {?} contentTypeId
|
|
1021
|
-
* @return {?}
|
|
1022
|
-
*/
|
|
1023
|
-
DotApiContentType.prototype.get = /**
|
|
1024
|
-
* @param {?} contentTypeId
|
|
1025
|
-
* @return {?}
|
|
1026
|
-
*/
|
|
1027
|
-
function (contentTypeId) {
|
|
1028
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1029
|
-
var response, _a, data;
|
|
1030
|
-
return __generator(this, function (_b) {
|
|
1031
|
-
switch (_b.label) {
|
|
1032
|
-
case 0: return [4 /*yield*/, this.dotCMSHttpClient.request({
|
|
1033
|
-
url: "/api/v1/contenttype/id/" + contentTypeId
|
|
1034
|
-
})];
|
|
1035
|
-
case 1:
|
|
1036
|
-
response = _b.sent();
|
|
1037
|
-
if (!(response.status !== 200))
|
|
1038
|
-
return [3 /*break*/, 3];
|
|
1039
|
-
_a = {};
|
|
1040
|
-
return [4 /*yield*/, response.text()];
|
|
1041
|
-
case 2: throw /** @type {?} */ (_a.message = _b.sent(),
|
|
1042
|
-
_a.statusCode = response.status,
|
|
1043
|
-
_a);
|
|
1044
|
-
case 3: return [4 /*yield*/, response.json()];
|
|
1045
|
-
case 4:
|
|
1046
|
-
data = _b.sent();
|
|
1047
|
-
return [2 /*return*/, data.entity];
|
|
1048
|
-
}
|
|
1049
|
-
});
|
|
1050
|
-
});
|
|
1051
|
-
};
|
|
1052
|
-
/**
|
|
1053
|
-
* @param {?} contentTypeId
|
|
1054
|
-
* @return {?}
|
|
1055
|
-
*/
|
|
1056
|
-
DotApiContentType.prototype.getLayout = /**
|
|
1057
|
-
* @param {?} contentTypeId
|
|
1058
|
-
* @return {?}
|
|
1059
|
-
*/
|
|
1060
|
-
function (contentTypeId) {
|
|
1061
|
-
return this.get(contentTypeId).then(function (contentType) {
|
|
1062
|
-
return contentType.layout;
|
|
1063
|
-
});
|
|
1064
|
-
};
|
|
1065
|
-
return DotApiContentType;
|
|
1066
|
-
}());
|
|
1067
|
-
|
|
1068
|
-
/**
|
|
1069
|
-
* @fileoverview added by tsickle
|
|
1070
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1071
|
-
*/
|
|
1072
|
-
/**
|
|
1073
|
-
* Creates and provide methods to render a DotCMS Form
|
|
1074
|
-
*
|
|
1075
|
-
*/
|
|
1076
|
-
var /**
|
|
1077
|
-
* Creates and provide methods to render a DotCMS Form
|
|
1078
|
-
*
|
|
1079
|
-
*/ DotApiForm = /** @class */ (function () {
|
|
1080
|
-
function DotApiForm(dotApiContentType, formConfig) {
|
|
1081
|
-
this.dotApiContentType = dotApiContentType;
|
|
1082
|
-
this.formConfig = formConfig;
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* Render form on provided html element
|
|
1086
|
-
* @memberof DotApiForm
|
|
1087
|
-
*/
|
|
1088
|
-
/**
|
|
1089
|
-
* Render form on provided html element
|
|
1090
|
-
* \@memberof DotApiForm
|
|
1091
|
-
* @return {?}
|
|
1092
|
-
*/
|
|
1093
|
-
DotApiForm.prototype.get = /**
|
|
1094
|
-
* Render form on provided html element
|
|
1095
|
-
* \@memberof DotApiForm
|
|
1096
|
-
* @return {?}
|
|
1097
|
-
*/
|
|
1098
|
-
function () {
|
|
1099
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1100
|
-
return __generator(this, function (_a) {
|
|
1101
|
-
return [2 /*return*/, this.dotApiContentType.get(this.formConfig.identifier)];
|
|
1102
|
-
});
|
|
1103
|
-
});
|
|
1104
|
-
};
|
|
1105
|
-
return DotApiForm;
|
|
1106
|
-
}());
|
|
1107
|
-
|
|
1108
|
-
/**
|
|
1109
|
-
* @fileoverview added by tsickle
|
|
1110
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1111
|
-
*/
|
|
1112
|
-
/** @type {?} */
|
|
1113
|
-
var initDotCMS = function (config) {
|
|
1114
|
-
/** @type {?} */
|
|
1115
|
-
var httpClient = new DotCMSHttpClient(config);
|
|
1116
|
-
/** @type {?} */
|
|
1117
|
-
var apiConfig = new DotApiConfiguration(httpClient);
|
|
1118
|
-
/** @type {?} */
|
|
1119
|
-
var apiLanguage = new DotApiLanguage(apiConfig);
|
|
1120
|
-
/** @type {?} */
|
|
1121
|
-
var content = new DotApiContent(httpClient);
|
|
1122
|
-
/** @type {?} */
|
|
1123
|
-
var dotApiContentType = new DotApiContentType(httpClient);
|
|
1124
|
-
return {
|
|
1125
|
-
auth: new DotApiAuthorization(),
|
|
1126
|
-
config: apiConfig,
|
|
1127
|
-
content: content,
|
|
1128
|
-
contentType: new DotApiContentType(httpClient),
|
|
1129
|
-
esSearch: new DotApiElasticSearch(httpClient),
|
|
1130
|
-
event: new DotApiEvent(),
|
|
1131
|
-
form: function (formConfig) { return new DotApiForm(dotApiContentType, formConfig); },
|
|
1132
|
-
language: apiLanguage,
|
|
1133
|
-
nav: new DotApiNavigation(httpClient),
|
|
1134
|
-
page: new DotApiPage(httpClient, apiLanguage),
|
|
1135
|
-
site: new DotApiSite(httpClient),
|
|
1136
|
-
widget: new DotApiWidget(httpClient),
|
|
1137
|
-
httpClient: httpClient
|
|
1138
|
-
};
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
/**
|
|
1142
|
-
* @fileoverview added by tsickle
|
|
1143
|
-
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
|
|
1144
|
-
*/
|
|
1145
|
-
|
|
1146
|
-
exports.initDotCMS = initDotCMS;
|
|
1147
|
-
|
|
1148
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1149
|
-
|
|
1150
|
-
})));
|
|
1151
|
-
|
|
1152
|
-
//# sourceMappingURL=dotcms.umd.js.map
|