jourycms-sdk 1.1.22 → 1.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containers/custom-handler/service-container.d.ts +24 -0
- package/dist/containers/custom-handler/service-container.d.ts.map +1 -0
- package/dist/containers/custom-handler/service-container.js +53 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/package.json +1 -1
@@ -0,0 +1,24 @@
|
|
1
|
+
import BaseServiceContainer from '../../base.service-container';
|
2
|
+
/**
|
3
|
+
* @description Typing aliasing
|
4
|
+
*/
|
5
|
+
import SDK = Levelup.CMS.V1.SDK;
|
6
|
+
type TClientName = '';
|
7
|
+
export default class CustomHandlerServiceContainer extends BaseServiceContainer<TClientName> {
|
8
|
+
constructor(sdk: SDK.ISdk);
|
9
|
+
protected generatePrefix(path?: SDK.PathPrefix, params?: {
|
10
|
+
[Param: string]: string | number;
|
11
|
+
}): string;
|
12
|
+
create(data: Levelup.CMS.V1.Utils.Api.Request.Build<{
|
13
|
+
data: Record<string, any>;
|
14
|
+
}>, config?: SDK.TRequestConfig): Promise<SDK.TResponseDatum<Levelup.CMS.V1.Utils.Api.Response.BuildSingleItemResponse<any>>>;
|
15
|
+
update(id: string, data: Levelup.CMS.V1.Utils.Api.Request.Build<{
|
16
|
+
data: Record<string, any>;
|
17
|
+
}>, config?: SDK.TRequestConfig): Promise<SDK.TResponseDatum<Levelup.CMS.V1.Utils.Api.Response.BuildSingleItemResponse<any>>>;
|
18
|
+
delete(id: string, config?: SDK.TRequestConfig): Promise<SDK.TResponseDatum<Levelup.CMS.V1.Utils.Api.Response.DefaultDeleteResponse>>;
|
19
|
+
restore(id: string, config?: SDK.TRequestConfig): Promise<SDK.TResponseDatum<Levelup.CMS.V1.Utils.Api.Response.DefaultDeleteResponse>>;
|
20
|
+
list(query: Levelup.CMS.V1.Utils.Api.Request.BuildSearchablePagedSortableFilterableProjectable<Record<string, any>>, config?: SDK.TRequestConfig): Promise<SDK.TResponseDatum<Levelup.CMS.V1.Utils.Api.Response.BuildListResponse<any>>>;
|
21
|
+
getOne(query: Levelup.CMS.V1.Utils.Api.Request.BuildSearchablePagedSortableFilterableProjectable<Record<string, any>>, config?: SDK.TRequestConfig): Promise<SDK.TResponseDatum<Levelup.CMS.V1.Utils.Api.Response.BuildSingleItemResponse<any>>>;
|
22
|
+
}
|
23
|
+
export {};
|
24
|
+
//# sourceMappingURL=service-container.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../src/containers/custom-handler/service-container.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAEhE;;GAEG;AACH,OAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC;AAChC,KAAK,WAAW,GACd,EAAE,CAAC;AAGL,MAAM,CAAC,OAAO,OAAO,6BAA8B,SAAQ,oBAAoB,CAAC,WAAW,CAAC;gBAE9E,GAAG,EAAE,GAAG,CAAC,IAAI;IAK1B,SAAS,CAAC,cAAc,CACrB,IAAI,GAAE,GAAG,CAAC,UAAgB,EAC1B,MAAM,GAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;KAAO,GAChD,MAAM;IAUH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,uBAAuB,CAAC,GAAG,CAAC,CA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AE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,iDAAiD,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC;CAUvP"}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const base_service_container_1 = __importDefault(require("../../base.service-container"));
|
7
|
+
class CustomHandlerServiceContainer extends base_service_container_1.default {
|
8
|
+
constructor(sdk) {
|
9
|
+
super(sdk, '/api/v1/custom');
|
10
|
+
}
|
11
|
+
generatePrefix(path = "/", params = {}) {
|
12
|
+
let result = `${this.prefix}${path}`;
|
13
|
+
result = Object.keys(params).reduce((acc, key) => acc.replace(`:${key}`, params[key].toString()), result);
|
14
|
+
return result;
|
15
|
+
}
|
16
|
+
// create
|
17
|
+
async create(data, config) {
|
18
|
+
return await this.sdk.httpClient.post(this.generatePrefix(), data, {
|
19
|
+
headers: this.sdk.generateHeadersFromRequestConfig(config)
|
20
|
+
});
|
21
|
+
}
|
22
|
+
// update
|
23
|
+
async update(id, data, config) {
|
24
|
+
return await this.sdk.httpClient.put(this.generatePrefix("/:id", { id }), data, {
|
25
|
+
headers: this.sdk.generateHeadersFromRequestConfig(config)
|
26
|
+
});
|
27
|
+
}
|
28
|
+
// delete
|
29
|
+
async delete(id, config) {
|
30
|
+
return await this.sdk.httpClient.delete(this.generatePrefix("/:id", { id }), {}, {
|
31
|
+
headers: this.sdk.generateHeadersFromRequestConfig(config)
|
32
|
+
});
|
33
|
+
}
|
34
|
+
// restore
|
35
|
+
async restore(id, config) {
|
36
|
+
return await this.sdk.httpClient.delete(this.generatePrefix(`/${id}/restore`), {}, {
|
37
|
+
headers: this.sdk.generateHeadersFromRequestConfig(config)
|
38
|
+
});
|
39
|
+
}
|
40
|
+
// list
|
41
|
+
async list(query, config) {
|
42
|
+
return await this.sdk.httpClient.get(this.generatePrefix(), query, {
|
43
|
+
headers: this.sdk.generateHeadersFromRequestConfig(config)
|
44
|
+
});
|
45
|
+
}
|
46
|
+
// getOne
|
47
|
+
async getOne(query, config) {
|
48
|
+
return await this.sdk.httpClient.get(this.generatePrefix(), query, {
|
49
|
+
headers: this.sdk.generateHeadersFromRequestConfig(config)
|
50
|
+
});
|
51
|
+
}
|
52
|
+
}
|
53
|
+
exports.default = CustomHandlerServiceContainer;
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { AxiosHeaderValue, AxiosResponse } from "axios";
|
2
2
|
import AuthServiceContainer from "./containers/auth/service-container";
|
3
3
|
import ContentServiceContainer from "./containers/content/service-container";
|
4
|
+
import CustomHandlerServiceContainer from "./containers/custom-handler/service-container";
|
4
5
|
import StorageServiceContainer from "./containers/storage/service-container";
|
5
6
|
import ApiResponseError from "./exceptions/api-response.exception";
|
6
7
|
import HttpClient from "./http-client";
|
@@ -13,7 +14,7 @@ export default class JouryCMSSdk implements SDK.ISdk {
|
|
13
14
|
readonly config: SDK.ISdkConfig;
|
14
15
|
private static instances;
|
15
16
|
private _requestCount;
|
16
|
-
protected serviceContainers: Partial<Record<Levelup.CMS.V1.Utils.SystemStructure.TMicroService | "insights", SDK.IServiceContainer>>;
|
17
|
+
protected serviceContainers: Partial<Record<Levelup.CMS.V1.Utils.SystemStructure.TMicroService | "insights" | "custom", SDK.IServiceContainer>>;
|
17
18
|
protected _helpersInstance: JouryCMSSdkHelpers;
|
18
19
|
static getInstance(config: SDK.ISdkConfig, id?: string): JouryCMSSdk;
|
19
20
|
constructor(config: SDK.ISdkConfig);
|
@@ -21,6 +22,7 @@ export default class JouryCMSSdk implements SDK.ISdk {
|
|
21
22
|
get content(): ContentServiceContainer;
|
22
23
|
get storage(): StorageServiceContainer;
|
23
24
|
get system(): SystemServiceContainer;
|
25
|
+
get custom(): CustomHandlerServiceContainer;
|
24
26
|
get helpers(): JouryCMSSdkHelpers;
|
25
27
|
generateHeadersFromRequestConfig(config?: SDK.TRequestConfig): {
|
26
28
|
[key: string]: AxiosHeaderValue;
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,aAAa,EAEd,MAAM,OAAO,CAAC;AAEf,OAAO,oBAAoB,MAAM,qCAAqC,CAAC;AACvE,OAAO,uBAAuB,MAAM,wCAAwC,CAAC;AAC7E,OAAO,uBAAuB,MAAM,wCAAwC,CAAC;AAC7E,OAAO,gBAAgB,MAAM,qCAAqC,CAAC;AACnE,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EACL,OAAO,EACP,8BAA8B,EAC9B,gCAAgC,EACjC,MAAM,YAAY,CAAC;AACpB,OAAO,kBAAkB,MAAM,iBAAiB,CAAC;AAIjD,OAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC;AAChC,OAAO,sBAAsB,MAAM,uCAAuC,CAAC;AAE3E,MAAM,CAAC,OAAO,OAAO,WAAY,YAAW,GAAG,CAAC,IAAI;IAClD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC;IAChC,OAAO,CAAC,MAAM,CAAC,SAAS,CAEjB;IACP,OAAO,CAAC,aAAa,CAAK;IAC1B,SAAS,CAAC,iBAAiB,EAAE,OAAO,CAClC,MAAM,CACJ,OAAO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,MAAkB;gBAKrD,MAAM,EAAE,GAAG,CAAC,UAAU;IAMlC,IAAI,IAAI,IAGgC,oBAAoB,CAC3D;IAED,IAAI,OAAO,IAGgC,uBAAuB,CACjE;IAED,IAAI,OAAO,IAGgC,uBAAuB,CACjE;IAED,IAAI,MAAM,IAGgC,sBAAsB,CAC/D;IAED,IAAI,MAAM,IAGgC,6BAA6B,CACtE;IAED,IAAI,OAAO,uBAGV;IAKD,gCAAgC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG;QAC7D,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;KACjC;IAkBK,cAAc,CAAC,CAAC,SAAS,GAAG,CAAC,SAAS,EAC1C,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,GAC9B,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAkCjC,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM;IAgBnC,kBAAkB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;IAIzD,WAAW,CAAC,CAAC,SAAS,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC;IAuJ7D,kBAAkB;IAIlB,qBAAqB;IAIrB,eAAe;CAGvB;AAED,OAAO,EACL,gBAAgB,EAAE,OAAO,EACzB,8BAA8B,EAC9B,gCAAgC,EACjC,CAAC"}
|
package/dist/index.js
CHANGED
@@ -8,7 +8,8 @@ const axios_1 = require("axios");
|
|
8
8
|
const colors_1 = __importDefault(require("colors"));
|
9
9
|
const service_container_1 = __importDefault(require("./containers/auth/service-container"));
|
10
10
|
const service_container_2 = __importDefault(require("./containers/content/service-container"));
|
11
|
-
const service_container_3 = __importDefault(require("./containers/
|
11
|
+
const service_container_3 = __importDefault(require("./containers/custom-handler/service-container"));
|
12
|
+
const service_container_4 = __importDefault(require("./containers/storage/service-container"));
|
12
13
|
const api_response_exception_1 = __importDefault(require("./exceptions/api-response.exception"));
|
13
14
|
exports.ApiResponseError = api_response_exception_1.default;
|
14
15
|
const http_client_1 = __importDefault(require("./http-client"));
|
@@ -16,7 +17,7 @@ const init_sdk_1 = require("./init-sdk");
|
|
16
17
|
Object.defineProperty(exports, "initSdk", { enumerable: true, get: function () { return init_sdk_1.initSdk; } });
|
17
18
|
const helpers_1 = __importDefault(require("./utils/helpers"));
|
18
19
|
colors_1.default.enable();
|
19
|
-
const
|
20
|
+
const service_container_5 = __importDefault(require("./containers/system/service-container"));
|
20
21
|
class JouryCMSSdk {
|
21
22
|
httpClient;
|
22
23
|
config;
|
@@ -46,14 +47,19 @@ class JouryCMSSdk {
|
|
46
47
|
}
|
47
48
|
get storage() {
|
48
49
|
if (!this.serviceContainers.storage)
|
49
|
-
this.serviceContainers.storage = new
|
50
|
+
this.serviceContainers.storage = new service_container_4.default(this);
|
50
51
|
return this.serviceContainers.storage;
|
51
52
|
}
|
52
53
|
get system() {
|
53
54
|
if (!this.serviceContainers.system)
|
54
|
-
this.serviceContainers.system = new
|
55
|
+
this.serviceContainers.system = new service_container_5.default(this);
|
55
56
|
return this.serviceContainers.system;
|
56
57
|
}
|
58
|
+
get custom() {
|
59
|
+
if (!this.serviceContainers.custom)
|
60
|
+
this.serviceContainers.custom = new service_container_3.default(this);
|
61
|
+
return this.serviceContainers.custom;
|
62
|
+
}
|
57
63
|
get helpers() {
|
58
64
|
if (!this._helpersInstance)
|
59
65
|
this._helpersInstance = new helpers_1.default();
|