dotcms 0.0.19 → 0.0.21
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/package.json +6 -23
- package/{index.d.ts → src/index.d.ts} +0 -1
- package/src/index.js +40 -0
- package/src/index.js.map +1 -0
- package/{lib → src/lib}/api/DotApiAuthorization.d.ts +0 -1
- package/src/lib/api/DotApiAuthorization.js +47 -0
- package/src/lib/api/DotApiAuthorization.js.map +1 -0
- package/{lib → src/lib}/api/DotApiConfiguration.d.ts +0 -1
- package/src/lib/api/DotApiConfiguration.js +32 -0
- package/src/lib/api/DotApiConfiguration.js.map +1 -0
- package/{lib → src/lib}/api/DotApiContent.d.ts +0 -1
- package/src/lib/api/DotApiContent.js +59 -0
- package/src/lib/api/DotApiContent.js.map +1 -0
- package/{lib → src/lib}/api/DotApiContentType.d.ts +1 -2
- package/src/lib/api/DotApiContentType.js +35 -0
- package/src/lib/api/DotApiContentType.js.map +1 -0
- package/{lib → src/lib}/api/DotApiElasticSearch.d.ts +0 -1
- package/src/lib/api/DotApiElasticSearch.js +37 -0
- package/src/lib/api/DotApiElasticSearch.js.map +1 -0
- package/{lib → src/lib}/api/DotApiEvent.d.ts +0 -1
- package/src/lib/api/DotApiEvent.js +20 -0
- package/src/lib/api/DotApiEvent.js.map +1 -0
- package/{lib → src/lib}/api/DotApiForm.d.ts +1 -2
- package/src/lib/api/DotApiForm.js +25 -0
- package/src/lib/api/DotApiForm.js.map +1 -0
- package/{lib → src/lib}/api/DotApiLanguage.d.ts +0 -1
- package/src/lib/api/DotApiLanguage.js +33 -0
- package/src/lib/api/DotApiLanguage.js.map +1 -0
- package/{lib → src/lib}/api/DotApiNavigation.d.ts +0 -1
- package/src/lib/api/DotApiNavigation.js +34 -0
- package/src/lib/api/DotApiNavigation.js.map +1 -0
- package/{lib → src/lib}/api/DotApiPage.d.ts +1 -2
- package/src/lib/api/DotApiPage.js +51 -0
- package/src/lib/api/DotApiPage.js.map +1 -0
- package/{lib → src/lib}/api/DotApiSite.d.ts +0 -1
- package/src/lib/api/DotApiSite.js +31 -0
- package/src/lib/api/DotApiSite.js.map +1 -0
- package/{lib → src/lib}/api/DotApiWidget.d.ts +0 -1
- package/src/lib/api/DotApiWidget.js +33 -0
- package/src/lib/api/DotApiWidget.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSAuthorization.model.d.ts +0 -1
- package/src/lib/models/DotCMSAuthorization.model.js +3 -0
- package/src/lib/models/DotCMSAuthorization.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSConfiguration.model.d.ts +1 -2
- package/src/lib/models/DotCMSConfiguration.model.js +3 -0
- package/src/lib/models/DotCMSConfiguration.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSContent.model.d.ts +0 -1
- package/src/lib/models/DotCMSContent.model.js +3 -0
- package/src/lib/models/DotCMSContent.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSElasticSearch.model.d.ts +0 -1
- package/src/lib/models/DotCMSElasticSearch.model.js +3 -0
- package/src/lib/models/DotCMSElasticSearch.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSError.model.d.ts +0 -1
- package/src/lib/models/DotCMSError.model.js +3 -0
- package/src/lib/models/DotCMSError.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSEvent.model.d.ts +0 -1
- package/src/lib/models/DotCMSEvent.model.js +3 -0
- package/src/lib/models/DotCMSEvent.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSForm.model.d.ts +0 -1
- package/src/lib/models/DotCMSForm.model.js +3 -0
- package/src/lib/models/DotCMSForm.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSHttpClient.model.d.ts +0 -1
- package/src/lib/models/DotCMSHttpClient.model.js +3 -0
- package/src/lib/models/DotCMSHttpClient.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSLanguage.model.d.ts +0 -1
- package/src/lib/models/DotCMSLanguage.model.js +3 -0
- package/src/lib/models/DotCMSLanguage.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSNavigation.model.d.ts +0 -1
- package/src/lib/models/DotCMSNavigation.model.js +3 -0
- package/src/lib/models/DotCMSNavigation.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSPage.model.d.ts +0 -1
- package/src/lib/models/DotCMSPage.model.js +3 -0
- package/src/lib/models/DotCMSPage.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSPageFormat.model.d.ts +0 -1
- package/src/lib/models/DotCMSPageFormat.model.js +3 -0
- package/src/lib/models/DotCMSPageFormat.model.js.map +1 -0
- package/{lib → src/lib}/models/DotCMSSite.model.d.ts +0 -1
- package/src/lib/models/DotCMSSite.model.js +3 -0
- package/src/lib/models/DotCMSSite.model.js.map +1 -0
- package/{lib → src/lib}/models/index.d.ts +0 -1
- package/src/lib/models/index.js +17 -0
- package/src/lib/models/index.js.map +1 -0
- package/{lib → src/lib}/utils/DotCMSHttpClient.d.ts +0 -1
- package/src/lib/utils/DotCMSHttpClient.js +14 -0
- package/src/lib/utils/DotCMSHttpClient.js.map +1 -0
- package/{lib → src/lib}/utils/getEsQuery.d.ts +0 -1
- package/src/lib/utils/getEsQuery.js +39 -0
- package/src/lib/utils/getEsQuery.js.map +1 -0
- package/{lib → src/lib}/utils/request.d.ts +0 -1
- package/src/lib/utils/request.js +48 -0
- package/src/lib/utils/request.js.map +1 -0
- package/dotcms.d.ts.map +0 -1
- package/esm2020/dotcms.mjs +0 -5
- package/esm2020/index.mjs +0 -36
- package/esm2020/lib/api/DotApiAuthorization.mjs +0 -42
- package/esm2020/lib/api/DotApiConfiguration.mjs +0 -27
- package/esm2020/lib/api/DotApiContent.mjs +0 -52
- package/esm2020/lib/api/DotApiContentType.mjs +0 -28
- package/esm2020/lib/api/DotApiElasticSearch.mjs +0 -32
- package/esm2020/lib/api/DotApiEvent.mjs +0 -16
- package/esm2020/lib/api/DotApiForm.mjs +0 -18
- package/esm2020/lib/api/DotApiLanguage.mjs +0 -24
- package/esm2020/lib/api/DotApiNavigation.mjs +0 -29
- package/esm2020/lib/api/DotApiPage.mjs +0 -50
- package/esm2020/lib/api/DotApiSite.mjs +0 -26
- package/esm2020/lib/api/DotApiWidget.mjs +0 -28
- package/esm2020/lib/models/DotCMSAuthorization.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSConfiguration.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSContent.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSElasticSearch.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSError.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSEvent.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSForm.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSHttpClient.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSLanguage.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSNavigation.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSPage.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSPageFormat.model.mjs +0 -2
- package/esm2020/lib/models/DotCMSSite.model.mjs +0 -2
- package/esm2020/lib/models/index.mjs +0 -14
- package/esm2020/lib/utils/DotCMSHttpClient.mjs +0 -10
- package/esm2020/lib/utils/getEsQuery.mjs +0 -35
- package/esm2020/lib/utils/request.mjs +0 -42
- package/index.d.ts.map +0 -1
- package/lib/api/DotApiAuthorization.d.ts.map +0 -1
- package/lib/api/DotApiConfiguration.d.ts.map +0 -1
- package/lib/api/DotApiContent.d.ts.map +0 -1
- package/lib/api/DotApiContentType.d.ts.map +0 -1
- package/lib/api/DotApiElasticSearch.d.ts.map +0 -1
- package/lib/api/DotApiEvent.d.ts.map +0 -1
- package/lib/api/DotApiForm.d.ts.map +0 -1
- package/lib/api/DotApiLanguage.d.ts.map +0 -1
- package/lib/api/DotApiNavigation.d.ts.map +0 -1
- package/lib/api/DotApiPage.d.ts.map +0 -1
- package/lib/api/DotApiSite.d.ts.map +0 -1
- package/lib/api/DotApiWidget.d.ts.map +0 -1
- package/lib/models/DotCMSAuthorization.model.d.ts.map +0 -1
- package/lib/models/DotCMSConfiguration.model.d.ts.map +0 -1
- package/lib/models/DotCMSContent.model.d.ts.map +0 -1
- package/lib/models/DotCMSElasticSearch.model.d.ts.map +0 -1
- package/lib/models/DotCMSError.model.d.ts.map +0 -1
- package/lib/models/DotCMSEvent.model.d.ts.map +0 -1
- package/lib/models/DotCMSForm.model.d.ts.map +0 -1
- package/lib/models/DotCMSHttpClient.model.d.ts.map +0 -1
- package/lib/models/DotCMSLanguage.model.d.ts.map +0 -1
- package/lib/models/DotCMSNavigation.model.d.ts.map +0 -1
- package/lib/models/DotCMSPage.model.d.ts.map +0 -1
- package/lib/models/DotCMSPageFormat.model.d.ts.map +0 -1
- package/lib/models/DotCMSSite.model.d.ts.map +0 -1
- package/lib/models/index.d.ts.map +0 -1
- package/lib/utils/DotCMSHttpClient.d.ts.map +0 -1
- package/lib/utils/getEsQuery.d.ts.map +0 -1
- package/lib/utils/request.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotcms",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"exports": {
|
|
9
|
-
"./package.json": {
|
|
10
|
-
"default": "./package.json"
|
|
11
|
-
},
|
|
12
|
-
".": {
|
|
13
|
-
"types": "./index.d.ts",
|
|
14
|
-
"es2020": "./esm2020/dotcms.mjs",
|
|
15
|
-
"esm2020": "./esm2020/dotcms.mjs",
|
|
16
|
-
"default": "./esm2020/dotcms.mjs"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"sideEffects": false,
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"tslib": "^2.3.0"
|
|
22
|
-
},
|
|
3
|
+
"version": "0.0.21",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"typings": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {},
|
|
23
8
|
"peerDependencies": {
|
|
24
9
|
"cross-fetch": "^3.1.4",
|
|
25
|
-
"
|
|
26
|
-
"@angular/core": "14.2.0",
|
|
27
|
-
"@angular/platform-browser-dynamic": "14.2.0"
|
|
10
|
+
"tslib": "^2.0.0"
|
|
28
11
|
}
|
|
29
12
|
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initDotCMS = void 0;
|
|
4
|
+
const DotApiAuthorization_1 = require("./lib/api/DotApiAuthorization");
|
|
5
|
+
const DotApiConfiguration_1 = require("./lib/api/DotApiConfiguration");
|
|
6
|
+
const DotApiElasticSearch_1 = require("./lib/api/DotApiElasticSearch");
|
|
7
|
+
const DotApiEvent_1 = require("./lib/api/DotApiEvent");
|
|
8
|
+
const DotApiLanguage_1 = require("./lib/api/DotApiLanguage");
|
|
9
|
+
const DotApiNavigation_1 = require("./lib/api/DotApiNavigation");
|
|
10
|
+
const DotApiPage_1 = require("./lib/api/DotApiPage");
|
|
11
|
+
const DotApiSite_1 = require("./lib/api/DotApiSite");
|
|
12
|
+
const DotApiWidget_1 = require("./lib/api/DotApiWidget");
|
|
13
|
+
const DotCMSHttpClient_1 = require("./lib/utils/DotCMSHttpClient");
|
|
14
|
+
const DotApiContent_1 = require("./lib/api/DotApiContent");
|
|
15
|
+
const DotApiContentType_1 = require("./lib/api/DotApiContentType");
|
|
16
|
+
const DotApiForm_1 = require("./lib/api/DotApiForm");
|
|
17
|
+
const initDotCMS = (config) => {
|
|
18
|
+
const httpClient = new DotCMSHttpClient_1.DotCMSHttpClient(config);
|
|
19
|
+
const apiConfig = new DotApiConfiguration_1.DotApiConfiguration(httpClient);
|
|
20
|
+
const apiLanguage = new DotApiLanguage_1.DotApiLanguage(apiConfig);
|
|
21
|
+
const content = new DotApiContent_1.DotApiContent(httpClient);
|
|
22
|
+
const dotApiContentType = new DotApiContentType_1.DotApiContentType(httpClient);
|
|
23
|
+
return {
|
|
24
|
+
auth: new DotApiAuthorization_1.DotApiAuthorization(),
|
|
25
|
+
config: apiConfig,
|
|
26
|
+
content: content,
|
|
27
|
+
contentType: new DotApiContentType_1.DotApiContentType(httpClient),
|
|
28
|
+
esSearch: new DotApiElasticSearch_1.DotApiElasticSearch(httpClient),
|
|
29
|
+
event: new DotApiEvent_1.DotApiEvent(),
|
|
30
|
+
form: (formConfig) => new DotApiForm_1.DotApiForm(dotApiContentType, formConfig),
|
|
31
|
+
language: apiLanguage,
|
|
32
|
+
nav: new DotApiNavigation_1.DotApiNavigation(httpClient),
|
|
33
|
+
page: new DotApiPage_1.DotApiPage(httpClient, apiLanguage),
|
|
34
|
+
site: new DotApiSite_1.DotApiSite(httpClient),
|
|
35
|
+
widget: new DotApiWidget_1.DotApiWidget(httpClient),
|
|
36
|
+
httpClient
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
exports.initDotCMS = initDotCMS;
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/dotcms/src/index.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AACpE,uEAAoE;AACpE,uEAAoE;AACpE,uDAAoD;AACpD,6DAA0D;AAC1D,iEAA8D;AAC9D,qDAAkD;AAClD,qDAAkD;AAClD,yDAAsD;AACtD,mEAAgE;AAEhE,2DAAwD;AACxD,mEAAgE;AAChE,qDAAkD;AAkB3C,MAAM,UAAU,GAAG,CAAC,MAAiC,EAAa,EAAE;IACvE,MAAM,UAAU,GAAG,IAAI,mCAAgB,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,yCAAmB,CAAC,UAAU,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,IAAI,+BAAc,CAAC,SAAS,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,IAAI,6BAAa,CAAC,UAAU,CAAC,CAAC;IAC9C,MAAM,iBAAiB,GAAG,IAAI,qCAAiB,CAAC,UAAU,CAAC,CAAC;IAE5D,OAAO;QACH,IAAI,EAAE,IAAI,yCAAmB,EAAE;QAC/B,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,IAAI,qCAAiB,CAAC,UAAU,CAAC;QAC9C,QAAQ,EAAE,IAAI,yCAAmB,CAAC,UAAU,CAAC;QAC7C,KAAK,EAAE,IAAI,yBAAW,EAAE;QACxB,IAAI,EAAE,CAAC,UAA4B,EAAE,EAAE,CAAC,IAAI,uBAAU,CAAC,iBAAiB,EAAE,UAAU,CAAC;QACrF,QAAQ,EAAE,WAAW;QACrB,GAAG,EAAE,IAAI,mCAAgB,CAAC,UAAU,CAAC;QACrC,IAAI,EAAE,IAAI,uBAAU,CAAC,UAAU,EAAE,WAAW,CAAC;QAC7C,IAAI,EAAE,IAAI,uBAAU,CAAC,UAAU,CAAC;QAChC,MAAM,EAAE,IAAI,2BAAY,CAAC,UAAU,CAAC;QACpC,UAAU;KACb,CAAC;AACN,CAAC,CAAC;AAtBW,QAAA,UAAU,cAsBrB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiAuthorization = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const cross_fetch_1 = require("cross-fetch");
|
|
6
|
+
function getErrorMessage(data) {
|
|
7
|
+
if (data.errors) {
|
|
8
|
+
return data.errors[0].message;
|
|
9
|
+
}
|
|
10
|
+
if (data.error) {
|
|
11
|
+
return data.error;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* DotCMS Authentication handler to intereact with {@link https://dotcms.com/docs/latest/rest-api-authentication | Authentication API}
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
class DotApiAuthorization {
|
|
19
|
+
/**
|
|
20
|
+
* Given user, password and expiration date to get a DotCMS Autorization Token
|
|
21
|
+
*/
|
|
22
|
+
getToken(params) {
|
|
23
|
+
const { user, password, expirationDays, host } = params;
|
|
24
|
+
return (0, cross_fetch_1.default)(`${host || ''}/api/v1/authentication/api-token`, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
headers: {
|
|
27
|
+
'Content-Type': 'application/json'
|
|
28
|
+
},
|
|
29
|
+
body: JSON.stringify({
|
|
30
|
+
user: user,
|
|
31
|
+
password: password,
|
|
32
|
+
expirationDays: expirationDays || 10
|
|
33
|
+
})
|
|
34
|
+
}).then((res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const data = yield res.json();
|
|
36
|
+
if (res.status === 200) {
|
|
37
|
+
return data.entity.token;
|
|
38
|
+
}
|
|
39
|
+
throw {
|
|
40
|
+
message: getErrorMessage(data),
|
|
41
|
+
statusCode: res.status
|
|
42
|
+
};
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.DotApiAuthorization = DotApiAuthorization;
|
|
47
|
+
//# sourceMappingURL=DotApiAuthorization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiAuthorization.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiAuthorization.ts"],"names":[],"mappings":";;;;AACA,6CAA8C;AAE9C,SAAS,eAAe,CAAC,IAA4B;IACjD,IAAI,IAAI,CAAC,MAAM,EAAE;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;KACjC;IAED,IAAI,IAAI,CAAC,KAAK,EAAE;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC;KACrB;AACL,CAAC;AAED;;;GAGG;AACH,MAAa,mBAAmB;IAC5B;;OAEG;IAEH,QAAQ,CAAC,MAAsC;QAC3C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExD,OAAO,IAAA,qBAAK,EAAC,GAAG,IAAI,IAAI,EAAE,kCAAkC,EAAE;YAC1D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,cAAc,EAAE,kBAAkB;aACrC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjB,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,QAAQ;gBAClB,cAAc,EAAE,cAAc,IAAI,EAAE;aACvC,CAAC;SACL,CAAC,CAAC,IAAI,CAAC,CAAO,GAAa,EAAE,EAAE;YAC5B,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAE9B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBACpB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;aAC5B;YAED,MAAmB;gBACf,OAAO,EAAE,eAAe,CAAC,IAAI,CAAC;gBAC9B,UAAU,EAAE,GAAG,CAAC,MAAM;aACzB,CAAC;QACN,CAAC,CAAA,CAAC,CAAC;IACP,CAAC;CACJ;AA/BD,kDA+BC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiConfiguration = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Get the information of DotCMS configuration
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class DotApiConfiguration {
|
|
10
|
+
constructor(httpClient) {
|
|
11
|
+
this.dotCMSHttpClient = httpClient;
|
|
12
|
+
}
|
|
13
|
+
// TODO: CATCH THIS ERROR
|
|
14
|
+
get() {
|
|
15
|
+
return this.dotCMSHttpClient
|
|
16
|
+
.request({
|
|
17
|
+
url: '/api/v1/configuration'
|
|
18
|
+
})
|
|
19
|
+
.then((response) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
if (response.status === 200) {
|
|
21
|
+
const data = yield response.json();
|
|
22
|
+
return data.entity;
|
|
23
|
+
}
|
|
24
|
+
throw {
|
|
25
|
+
message: yield response.text(),
|
|
26
|
+
statusCode: response.status
|
|
27
|
+
};
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.DotApiConfiguration = DotApiConfiguration;
|
|
32
|
+
//# sourceMappingURL=DotApiConfiguration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiConfiguration.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiConfiguration.ts"],"names":[],"mappings":";;;;AAGA;;;GAGG;AACH,MAAa,mBAAmB;IAG5B,YAAY,UAA4B;QACpC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC;IACvC,CAAC;IAED,yBAAyB;IACzB,GAAG;QACC,OAAO,IAAI,CAAC,gBAAgB;aACvB,OAAO,CAAC;YACL,GAAG,EAAE,uBAAuB;SAC/B,CAAC;aACD,IAAI,CAAC,CAAO,QAAkB,EAAE,EAAE;YAC/B,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBACzB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,OAAO,IAAI,CAAC,MAAM,CAAC;aACtB;YAED,MAAmB;gBACf,OAAO,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;gBAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC9B,CAAC;QACN,CAAC,CAAA,CAAC,CAAC;IACX,CAAC;CACJ;AAzBD,kDAyBC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiContent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
function populateQueryUrl(params) {
|
|
6
|
+
let url = '';
|
|
7
|
+
const attrs = {
|
|
8
|
+
depth: `/depth/${params.options.depth}`,
|
|
9
|
+
limit: `/limit/${params.options.limit}`,
|
|
10
|
+
offset: `/offset/${params.options.offset}`,
|
|
11
|
+
orderBy: `/orderby/${params.options.orderBy}`
|
|
12
|
+
};
|
|
13
|
+
if (params.queryParams) {
|
|
14
|
+
for (const key of Object.keys(params.queryParams)) {
|
|
15
|
+
url += `+${key}:${params.queryParams[key]}%20`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
for (const key of Object.keys(params.options)) {
|
|
19
|
+
url += attrs[key];
|
|
20
|
+
}
|
|
21
|
+
return url;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Query/Save/Publish the information of DotCMS Content
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
class DotApiContent {
|
|
28
|
+
constructor(httpClient) {
|
|
29
|
+
this.dotCMSHttpClient = httpClient;
|
|
30
|
+
}
|
|
31
|
+
query(params) {
|
|
32
|
+
const url = `/api/content/query/+contentType:${params.contentType}%20${populateQueryUrl(params)}`;
|
|
33
|
+
return this.doRequest(url, null, 'GET');
|
|
34
|
+
}
|
|
35
|
+
save(params) {
|
|
36
|
+
return this.doRequest('/api/content/save/1', params);
|
|
37
|
+
}
|
|
38
|
+
publish(params) {
|
|
39
|
+
return this.doRequest('/api/content/publish/1', params);
|
|
40
|
+
}
|
|
41
|
+
doRequest(url, params, httpMethod = 'POST') {
|
|
42
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const response = yield this.dotCMSHttpClient.request({
|
|
44
|
+
url,
|
|
45
|
+
method: httpMethod,
|
|
46
|
+
body: params ? JSON.stringify(params) : ''
|
|
47
|
+
});
|
|
48
|
+
if (response.status !== 200) {
|
|
49
|
+
throw {
|
|
50
|
+
message: yield response.text(),
|
|
51
|
+
statusCode: response.status
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return response;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.DotApiContent = DotApiContent;
|
|
59
|
+
//# sourceMappingURL=DotApiContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiContent.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiContent.ts"],"names":[],"mappings":";;;;AAGA,SAAS,gBAAgB,CAAC,MAA0B;IAChD,IAAI,GAAG,GAAG,EAAE,CAAC;IAEb,MAAM,KAAK,GAAG;QACV,KAAK,EAAE,UAAU,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;QACvC,KAAK,EAAE,UAAU,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE;QACvC,MAAM,EAAE,WAAW,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE;QAC1C,OAAO,EAAE,YAAY,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE;KAChD,CAAC;IAEF,IAAI,MAAM,CAAC,WAAW,EAAE;QACpB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;YAC/C,GAAG,IAAI,IAAI,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;SAClD;KACJ;IAED,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QAC3C,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;KACrB;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAa,aAAa;IAGtB,YAAY,UAA4B;QACpC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,MAA0B;QAC5B,MAAM,GAAG,GAAG,mCAAmC,MAAM,CAAC,WAAW,MAAM,gBAAgB,CACnF,MAAM,CACT,EAAE,CAAC;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,CAAgC,MAAe;QAC/C,OAAO,IAAI,CAAC,SAAS,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAgC,MAAe;QAClD,OAAO,IAAI,CAAC,SAAS,CAAC,wBAAwB,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;IAEa,SAAS,CACnB,GAAW,EACX,MAAgB,EAChB,UAAU,GAAG,MAAM;;YAEnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;gBACjD,GAAG;gBACH,MAAM,EAAE,UAAU;gBAClB,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE;aAC7C,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBACzB,MAAmB;oBACf,OAAO,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;oBAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM;iBAC9B,CAAC;aACL;YAED,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;CACJ;AA1CD,sCA0CC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DotCMSHttpClient } from '../utils/DotCMSHttpClient';
|
|
2
|
-
import { DotCMSContentTypeLayoutRow, DotCMSContentType } from '
|
|
2
|
+
import { DotCMSContentTypeLayoutRow, DotCMSContentType } from 'dotcms-models';
|
|
3
3
|
/**
|
|
4
4
|
* Get the information of DotCMS contentTypes
|
|
5
5
|
*
|
|
@@ -10,4 +10,3 @@ export declare class DotApiContentType {
|
|
|
10
10
|
get(contentTypeId: any): Promise<DotCMSContentType>;
|
|
11
11
|
getLayout(contentTypeId: any): Promise<DotCMSContentTypeLayoutRow[]>;
|
|
12
12
|
}
|
|
13
|
-
//# sourceMappingURL=DotApiContentType.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiContentType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Get the information of DotCMS contentTypes
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class DotApiContentType {
|
|
10
|
+
constructor(httpClient) {
|
|
11
|
+
this.dotCMSHttpClient = httpClient;
|
|
12
|
+
}
|
|
13
|
+
get(contentTypeId) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const response = yield this.dotCMSHttpClient.request({
|
|
16
|
+
url: `/api/v1/contenttype/id/${contentTypeId}`
|
|
17
|
+
});
|
|
18
|
+
if (response.status !== 200) {
|
|
19
|
+
throw {
|
|
20
|
+
message: yield response.text(),
|
|
21
|
+
statusCode: response.status
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const data = yield response.json();
|
|
25
|
+
return data.entity;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
getLayout(contentTypeId) {
|
|
29
|
+
return this.get(contentTypeId).then((contentType) => {
|
|
30
|
+
return contentType.layout;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.DotApiContentType = DotApiContentType;
|
|
35
|
+
//# sourceMappingURL=DotApiContentType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiContentType.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiContentType.ts"],"names":[],"mappings":";;;;AAIA;;;GAGG;AACH,MAAa,iBAAiB;IAG1B,YAAY,UAA4B;QACpC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC;IACvC,CAAC;IAEK,GAAG,CAAC,aAAa;;YACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;gBACjD,GAAG,EAAE,0BAA0B,aAAa,EAAE;aACjD,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBACzB,MAAmB;oBACf,OAAO,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;oBAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM;iBAC9B,CAAC;aACL;YAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,MAAM,CAAC;QACvB,CAAC;KAAA;IAED,SAAS,CAAC,aAAa;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,WAA8B,EAAE,EAAE;YACnE,OAAO,WAAW,CAAC,MAAM,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA5BD,8CA4BC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiElasticSearch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const getEsQuery_1 = require("../utils/getEsQuery");
|
|
6
|
+
/**
|
|
7
|
+
* Request content from DotCMS using the {@link https://dotcms.com/docs/latest/elasticsearch-rest-api | Elastic Search API}
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
class DotApiElasticSearch {
|
|
11
|
+
constructor(httpClient) {
|
|
12
|
+
this.dotCMSHttpClient = httpClient;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Provide the content type and the elastic search query and get the results contentlets and elastic search information
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
search(params) {
|
|
19
|
+
return this.dotCMSHttpClient
|
|
20
|
+
.request({
|
|
21
|
+
url: '/api/es/search',
|
|
22
|
+
method: 'POST',
|
|
23
|
+
body: (0, getEsQuery_1.getEsQuery)(params)
|
|
24
|
+
})
|
|
25
|
+
.then((response) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (response.status === 200) {
|
|
27
|
+
return response.json();
|
|
28
|
+
}
|
|
29
|
+
throw {
|
|
30
|
+
message: yield response.text(),
|
|
31
|
+
statusCode: response.status
|
|
32
|
+
};
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.DotApiElasticSearch = DotApiElasticSearch;
|
|
37
|
+
//# sourceMappingURL=DotApiElasticSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiElasticSearch.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiElasticSearch.ts"],"names":[],"mappings":";;;;AAEA,oDAAiD;AAGjD;;;GAGG;AACH,MAAa,mBAAmB;IAG5B,YAAY,UAA4B;QACpC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,MAAiC;QACpC,OAAO,IAAI,CAAC,gBAAgB;aACvB,OAAO,CAAC;YACL,GAAG,EAAE,gBAAgB;YACrB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAA,uBAAU,EAAC,MAAM,CAAC;SAC3B,CAAC;aACD,IAAI,CAAC,CAAO,QAAkB,EAAE,EAAE;YAC/B,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBACzB,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;aAC1B;YAED,MAAmB;gBACf,OAAO,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;gBAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC9B,CAAC;QACN,CAAC,CAAA,CAAC,CAAC;IACX,CAAC;CACJ;AA7BD,kDA6BC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiEvent = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Emit custom events for the DotCMS Edit Mode
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
class DotApiEvent {
|
|
9
|
+
emit(params) {
|
|
10
|
+
const { name, data } = params;
|
|
11
|
+
const customEvent = window.top.document.createEvent('CustomEvent');
|
|
12
|
+
customEvent.initCustomEvent('ng-event', false, false, {
|
|
13
|
+
name: name,
|
|
14
|
+
data: data
|
|
15
|
+
});
|
|
16
|
+
window.top.document.dispatchEvent(customEvent);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.DotApiEvent = DotApiEvent;
|
|
20
|
+
//# sourceMappingURL=DotApiEvent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiEvent.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiEvent.ts"],"names":[],"mappings":";;;AAEA;;;GAGG;AACH,MAAa,WAAW;IACpB,IAAI,CAAC,MAA0B;QAC3B,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QACnE,WAAW,CAAC,eAAe,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE;YAClD,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;SACb,CAAC,CAAC;QACH,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;CACJ;AAVD,kCAUC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DotCMSFormConfig } from '../models';
|
|
2
2
|
import { DotApiContentType } from './DotApiContentType';
|
|
3
|
-
import { DotCMSContentType } from '
|
|
3
|
+
import { DotCMSContentType } from 'dotcms-models';
|
|
4
4
|
/**
|
|
5
5
|
* Creates and provide methods to render a DotCMS Form
|
|
6
6
|
*
|
|
@@ -15,4 +15,3 @@ export declare class DotApiForm {
|
|
|
15
15
|
*/
|
|
16
16
|
get(): Promise<DotCMSContentType>;
|
|
17
17
|
}
|
|
18
|
-
//# sourceMappingURL=DotApiForm.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiForm = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Creates and provide methods to render a DotCMS Form
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class DotApiForm {
|
|
10
|
+
constructor(dotApiContentType, formConfig) {
|
|
11
|
+
this.dotApiContentType = dotApiContentType;
|
|
12
|
+
this.formConfig = formConfig;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Render form on provided html element
|
|
16
|
+
* @memberof DotApiForm
|
|
17
|
+
*/
|
|
18
|
+
get() {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return this.dotApiContentType.get(this.formConfig.identifier);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.DotApiForm = DotApiForm;
|
|
25
|
+
//# sourceMappingURL=DotApiForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiForm.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiForm.ts"],"names":[],"mappings":";;;;AAMA;;;GAGG;AACH,MAAa,UAAU;IACnB,YACY,iBAAoC,EACpC,UAA4B;QAD5B,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,eAAU,GAAV,UAAU,CAAkB;IACrC,CAAC;IAEJ;;;OAGG;IACG,GAAG;;YACL,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAClE,CAAC;KAAA;CACJ;AAbD,gCAaC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiLanguage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Get DotCMS {@link https://dotcms.com/docs/latest/adding-and-editing-languages | Language code}
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class DotApiLanguage {
|
|
10
|
+
constructor(appConfig) {
|
|
11
|
+
this.dotAppConfig = appConfig;
|
|
12
|
+
}
|
|
13
|
+
getId(langCode) {
|
|
14
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
const languages = yield this.getLanguages();
|
|
16
|
+
const language = languages.find((lang) => lang.languageCode === langCode);
|
|
17
|
+
return language ? `${language.id}` : null;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
getLanguages() {
|
|
21
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
if (this._languagesConf) {
|
|
23
|
+
return this._languagesConf;
|
|
24
|
+
}
|
|
25
|
+
this._languagesConf = yield this.dotAppConfig
|
|
26
|
+
.get()
|
|
27
|
+
.then((data) => data.languages);
|
|
28
|
+
return this._languagesConf;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.DotApiLanguage = DotApiLanguage;
|
|
33
|
+
//# sourceMappingURL=DotApiLanguage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiLanguage.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiLanguage.ts"],"names":[],"mappings":";;;;AAGA;;;GAGG;AACH,MAAa,cAAc;IAIvB,YAAY,SAA8B;QACtC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;IAClC,CAAC;IAEK,KAAK,CAAC,QAAgB;;YACxB,MAAM,SAAS,GAAyB,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAElE,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAC3B,CAAC,IAAwB,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,KAAK,QAAQ,CAC/D,CAAC;YACF,OAAO,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9C,CAAC;KAAA;IAEK,YAAY;;YACd,IAAI,IAAI,CAAC,cAAc,EAAE;gBACrB,OAAO,IAAI,CAAC,cAAc,CAAC;aAC9B;YAED,IAAI,CAAC,cAAc,GAAG,MAAM,IAAI,CAAC,YAAY;iBACxC,GAAG,EAAE;iBACL,IAAI,CAAC,CAAC,IAA6B,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAE7D,OAAO,IAAI,CAAC,cAAc,CAAC;QAC/B,CAAC;KAAA;CACJ;AA5BD,wCA4BC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiNavigation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve information about the dotCMS file and folder tree with the {@link https://dotcms.com/docs/latest/navigation-rest-api | Navigation REST API }
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class DotApiNavigation {
|
|
10
|
+
constructor(httpClient) {
|
|
11
|
+
this.dotCMSHttpClient = httpClient;
|
|
12
|
+
}
|
|
13
|
+
get(depth = '2', location = '/') {
|
|
14
|
+
return this.dotCMSHttpClient
|
|
15
|
+
.request({
|
|
16
|
+
url: `/api/v1/nav/${location}`,
|
|
17
|
+
params: {
|
|
18
|
+
depth
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
.then((res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
if (res.status === 200) {
|
|
23
|
+
const data = yield res.json();
|
|
24
|
+
return data.entity;
|
|
25
|
+
}
|
|
26
|
+
throw {
|
|
27
|
+
message: yield res.text(),
|
|
28
|
+
statusCode: res.status
|
|
29
|
+
};
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.DotApiNavigation = DotApiNavigation;
|
|
34
|
+
//# sourceMappingURL=DotApiNavigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiNavigation.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiNavigation.ts"],"names":[],"mappings":";;;;AAGA;;;GAGG;AACH,MAAa,gBAAgB;IAGzB,YAAY,UAA4B;QACpC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC;IACvC,CAAC;IAED,GAAG,CAAC,KAAK,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG;QAC3B,OAAO,IAAI,CAAC,gBAAgB;aACvB,OAAO,CAAC;YACL,GAAG,EAAE,eAAe,QAAQ,EAAE;YAC9B,MAAM,EAAE;gBACJ,KAAK;aACR;SACJ,CAAC;aACD,IAAI,CAAC,CAAO,GAAa,EAAE,EAAE;YAC1B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBACpB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;gBAC9B,OAA6B,IAAI,CAAC,MAAM,CAAC;aAC5C;YAED,MAAmB;gBACf,OAAO,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE;gBACzB,UAAU,EAAE,GAAG,CAAC,MAAM;aACzB,CAAC;QACN,CAAC,CAAA,CAAC,CAAC;IACX,CAAC;CACJ;AA3BD,4CA2BC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DotCMSPageParams } from '
|
|
1
|
+
import { DotCMSPageParams } from '../models/DotCMSPage.model';
|
|
2
2
|
import { DotCMSHttpClient } from '../utils/DotCMSHttpClient';
|
|
3
3
|
import { DotCMSPageAsset, DotCMSPageFormat } from '../models';
|
|
4
4
|
import { DotApiLanguage } from './DotApiLanguage';
|
|
@@ -16,4 +16,3 @@ export declare class DotApiPage {
|
|
|
16
16
|
*/
|
|
17
17
|
get(params: DotCMSPageParams, format?: DotCMSPageFormat): Promise<DotCMSPageAsset>;
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=DotApiPage.d.ts.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiPage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Allow easy interaction with {@link https://dotcms.com/docs/latest/page-rest-api-layout-as-a-service-laas | DotCMS Page API}
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
class DotApiPage {
|
|
10
|
+
constructor(httpClient, appLanguage) {
|
|
11
|
+
this.dotCMSHttpClient = httpClient;
|
|
12
|
+
this.dotAppLanguage = appLanguage;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Given the page url and the language return a {@link DotCMSPageAsset}
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
get(params, format = "json" /* DotCMSPageFormat.JSON */) {
|
|
19
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
if (params.language) {
|
|
21
|
+
params = Object.assign(Object.assign({}, params), { language: isNaN(params.language)
|
|
22
|
+
? yield this.dotAppLanguage.getId(params.language)
|
|
23
|
+
: params.language });
|
|
24
|
+
}
|
|
25
|
+
params = Object.assign(Object.assign({}, params), { url: `/api/v1/page/${format}${params.url}` });
|
|
26
|
+
return this.dotCMSHttpClient.request(params).then((res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (res.status === 200) {
|
|
28
|
+
const data = yield res.json();
|
|
29
|
+
return data.entity;
|
|
30
|
+
}
|
|
31
|
+
const response = yield res.text();
|
|
32
|
+
let error;
|
|
33
|
+
try {
|
|
34
|
+
error = {
|
|
35
|
+
statusCode: res.status,
|
|
36
|
+
message: JSON.parse(response).message
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch (_a) {
|
|
40
|
+
error = {
|
|
41
|
+
statusCode: res.status,
|
|
42
|
+
message: response
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.DotApiPage = DotApiPage;
|
|
51
|
+
//# sourceMappingURL=DotApiPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiPage.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiPage.ts"],"names":[],"mappings":";;;;AAKA;;;GAGG;AACH,MAAa,UAAU;IAInB,YAAY,UAA4B,EAAE,WAA2B;QACjE,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,WAAW,CAAC;IACtC,CAAC;IAED;;;OAGG;IACG,GAAG,CACL,MAAwB,EACxB,2CAAgD;;YAEhD,IAAI,MAAM,CAAC,QAAQ,EAAE;gBACjB,MAAM,mCACC,MAAM,KACT,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,QAAe,CAAC;wBACnC,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;wBAClD,CAAC,CAAC,MAAM,CAAC,QAAQ,GACxB,CAAC;aACL;YAED,MAAM,mCACC,MAAM,KACT,GAAG,EAAE,gBAAgB,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE,GAC7C,CAAC;YAEF,OAAO,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAO,GAAa,EAAE,EAAE;gBACtE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;oBACpB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;oBAC9B,OAAwB,IAAI,CAAC,MAAM,CAAC;iBACvC;gBAED,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;gBAClC,IAAI,KAAkB,CAAC;gBACvB,IAAI;oBACA,KAAK,GAAG;wBACJ,UAAU,EAAE,GAAG,CAAC,MAAM;wBACtB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO;qBACxC,CAAC;iBACL;gBAAC,WAAM;oBACJ,KAAK,GAAG;wBACJ,UAAU,EAAE,GAAG,CAAC,MAAM;wBACtB,OAAO,EAAE,QAAQ;qBACpB,CAAC;iBACL;gBAED,MAAM,KAAK,CAAC;YAChB,CAAC,CAAA,CAAC,CAAC;QACP,CAAC;KAAA;CACJ;AAtDD,gCAsDC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DotApiSite = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* Get information from {@link https://dotcms.com/docs/latest/multi-site-management | DotCMS Sites}
|
|
7
|
+
*/
|
|
8
|
+
class DotApiSite {
|
|
9
|
+
constructor(httpClient) {
|
|
10
|
+
this.dotCMSHttpClient = httpClient;
|
|
11
|
+
}
|
|
12
|
+
getCurrentSite() {
|
|
13
|
+
return this.dotCMSHttpClient
|
|
14
|
+
.request({
|
|
15
|
+
url: `/api/v1/site/currentSite`
|
|
16
|
+
})
|
|
17
|
+
.then((response) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (response.status === 200) {
|
|
19
|
+
const data = yield response.json();
|
|
20
|
+
const _a = data.entity, { map } = _a, site = tslib_1.__rest(_a, ["map"]);
|
|
21
|
+
return site;
|
|
22
|
+
}
|
|
23
|
+
throw {
|
|
24
|
+
message: yield response.text(),
|
|
25
|
+
statusCode: response.status
|
|
26
|
+
};
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.DotApiSite = DotApiSite;
|
|
31
|
+
//# sourceMappingURL=DotApiSite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotApiSite.js","sourceRoot":"","sources":["../../../../../../libs/dotcms/src/lib/api/DotApiSite.ts"],"names":[],"mappings":";;;;AAGA;;GAEG;AACH,MAAa,UAAU;IAGnB,YAAY,UAA4B;QACpC,IAAI,CAAC,gBAAgB,GAAG,UAAU,CAAC;IACvC,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,gBAAgB;aACvB,OAAO,CAAC;YACL,GAAG,EAAE,0BAA0B;SAClC,CAAC;aACD,IAAI,CAAC,CAAO,QAAkB,EAAE,EAAE;YAC/B,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE;gBACzB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,MAAM,KAAmB,IAAI,CAAC,MAAM,EAA9B,EAAE,GAAG,OAAyB,EAApB,IAAI,sBAAd,OAAgB,CAAc,CAAC;gBACrC,OAAmB,IAAI,CAAC;aAC3B;YAED,MAAmB;gBACf,OAAO,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE;gBAC9B,UAAU,EAAE,QAAQ,CAAC,MAAM;aAC9B,CAAC;QACN,CAAC,CAAA,CAAC,CAAC;IACX,CAAC;CACJ;AAzBD,gCAyBC"}
|