oneentry 1.0.23 → 1.0.24
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 +57 -0
- package/dist/base/oneEntry.d.ts +3 -1
- package/dist/base/oneEntry.js +12 -0
- package/dist/base/oneEntry.js.map +1 -1
- package/dist/file-uploding/fileUploadingApi.d.ts +52 -0
- package/dist/file-uploding/fileUploadingApi.js +86 -0
- package/dist/file-uploding/fileUploadingApi.js.map +1 -0
- package/dist/file-uploding/fileUploadingInterfaces.d.ts +27 -0
- package/dist/file-uploding/fileUploadingInterfaces.js +3 -0
- package/dist/file-uploding/fileUploadingInterfaces.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/system/systemApi.d.ts +10 -0
- package/dist/system/systemApi.js +35 -0
- package/dist/system/systemApi.js.map +1 -0
- package/dist/system/systemInterfaces.d.ts +5 -0
- package/dist/system/systemInterfaces.js +3 -0
- package/dist/system/systemInterfaces.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -85,6 +85,63 @@ Example return:
|
|
|
85
85
|
]
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
## FileUploading
|
|
89
|
+
|
|
90
|
+
const { FileUploading } = defineOneEntry('your-url');
|
|
91
|
+
|
|
92
|
+
### upload
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
const data = [
|
|
96
|
+
{
|
|
97
|
+
"fieldname": "file",
|
|
98
|
+
"originalname": "myFile.pdf",
|
|
99
|
+
"mimetype": "application/pdf",
|
|
100
|
+
"size": 234,
|
|
101
|
+
"filename": "myFile.pdf",
|
|
102
|
+
"path": "/myFile.pdf"
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
const query = {
|
|
107
|
+
type:"page",
|
|
108
|
+
entity:"editor",
|
|
109
|
+
id:3787,
|
|
110
|
+
width:0,
|
|
111
|
+
height:0,
|
|
112
|
+
compress:true,
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const value = await FileUploading.upload(data, query)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
> This method uploads a file to a cloud file storage
|
|
119
|
+
|
|
120
|
+
Example return:
|
|
121
|
+
```
|
|
122
|
+
{
|
|
123
|
+
"filename": "string",
|
|
124
|
+
"downloadLink": "string",
|
|
125
|
+
"size": 0
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### delete
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
const query = {
|
|
133
|
+
type:"page",
|
|
134
|
+
entity:"editor",
|
|
135
|
+
id:3787
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
const value = await FileUploading.delete("file.png", query)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
> This void method delete a file from the cloud file storage.
|
|
143
|
+
|
|
144
|
+
|
|
88
145
|
## Forms
|
|
89
146
|
|
|
90
147
|
const { Forms } = defineOneEntry('your-url');
|
package/dist/base/oneEntry.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IProductsQuery } from '../products/productsInterfaces';
|
|
2
2
|
import { LangType } from "./utils";
|
|
3
|
+
import { IUploadingQuery } from "../file-uploding/fileUploadingInterfaces";
|
|
3
4
|
export default abstract class OneEntry {
|
|
4
5
|
protected _url: string;
|
|
5
6
|
protected _LANGCODE_KEY: string;
|
|
@@ -7,7 +8,8 @@ export default abstract class OneEntry {
|
|
|
7
8
|
protected _getFullPath(path: string): string;
|
|
8
9
|
protected _fetchGet(path: string): Promise<any>;
|
|
9
10
|
protected _fetchPost(path: string, data: object): Promise<any>;
|
|
10
|
-
protected
|
|
11
|
+
protected _fetchDelete(path: string): Promise<any>;
|
|
12
|
+
protected _queryParamsToString(query: IProductsQuery | IUploadingQuery): string;
|
|
11
13
|
protected _parseLangFromString(str: string, lang: string): string;
|
|
12
14
|
protected _fetchRequests(url: string, lang: LangType): Promise<any>;
|
|
13
15
|
protected _normalizeData(data: any): any;
|
package/dist/base/oneEntry.js
CHANGED
|
@@ -42,6 +42,18 @@ class OneEntry {
|
|
|
42
42
|
return result;
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
_fetchDelete(path) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const response = yield fetch(this._getFullPath(path), {
|
|
48
|
+
method: 'DELETE',
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'application/json'
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
const result = yield response.json();
|
|
54
|
+
return result;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
45
57
|
_queryParamsToString(query) {
|
|
46
58
|
let result = '';
|
|
47
59
|
for (let key in query) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oneEntry.js","sourceRoot":"","sources":["../../src/base/oneEntry.ts"],"names":[],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"oneEntry.js","sourceRoot":"","sources":["../../src/base/oneEntry.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,MAA8B,QAAQ;IAIlC,YAAY,GAAU;QAFZ,kBAAa,GAAU,WAAW,CAAA;QAGxC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAA;IAEnB,CAAC;IAES,YAAY,CAAC,IAAW;QAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IAC7B,CAAC;IAEe,SAAS,CAAC,IAAW;;YACjC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;gBAClD,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACL,cAAc,EAAE,kBAAkB;iBACrC;aACJ,CAAC,CAAA;YAEF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACpC,OAAO,MAAM,CAAA;QACjB,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MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;YAC7C,aAAa,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;SAC/D;QACD,IAAI,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE;YACtC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;YAC3C,aAAa,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;SAC3D;QACD,OAAO,aAAa,CAAA;IACxB,CAAC;CACJ;AA9HD,2BA8HC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import OneEntry from '../base/oneEntry';
|
|
2
|
+
import { IUploadingData, IUploadingQuery, IUploadingReturns, IFileUploading } from "./fileUploadingInterfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Controllers for working with file uploading
|
|
5
|
+
*/
|
|
6
|
+
export default class FileUploadingApi extends OneEntry implements IFileUploading {
|
|
7
|
+
constructor(url: string);
|
|
8
|
+
private _defaultQuery;
|
|
9
|
+
/**
|
|
10
|
+
* Upload file function.
|
|
11
|
+
*
|
|
12
|
+
* @param {IUploadingData} [data] Array of Express.Multer.File objects
|
|
13
|
+
* @example
|
|
14
|
+
* [
|
|
15
|
+
* {
|
|
16
|
+
* "fieldname": "file",
|
|
17
|
+
* "originalname": "myFile.pdf",
|
|
18
|
+
* "mimetype": "application/pdf",
|
|
19
|
+
* "size": 234,
|
|
20
|
+
* "filename": "myFile.pdf",
|
|
21
|
+
* "path": "/myFile.pdf"
|
|
22
|
+
* }
|
|
23
|
+
* ]
|
|
24
|
+
*
|
|
25
|
+
* @param {IUploadingQuery} [userQuery] - Optional set query parameters.
|
|
26
|
+
* @param {string} [data.type] - Type, determines the folder name in the storage. Example : "page"
|
|
27
|
+
* @param {string} [data.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
|
|
28
|
+
* @param {number} [data.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
|
|
29
|
+
* @param {number} [data.width] - Width parameter. Example : 0
|
|
30
|
+
* @param {number} [data.height] - Height parameter. Example : 0
|
|
31
|
+
* @param {number} [data.compress] - Flag of optimization (compression) for images. Example : true
|
|
32
|
+
*
|
|
33
|
+
* @returns Uploads a file to an Amazon S3-compatible cloud file storage
|
|
34
|
+
*/
|
|
35
|
+
upload(data: Array<IUploadingData>, userQuery?: IUploadingQuery): Promise<IUploadingReturns>;
|
|
36
|
+
/**
|
|
37
|
+
* Deletes a file from the cloud file storage.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} [filename] File name. Example "file.png"
|
|
40
|
+
*
|
|
41
|
+
* @param {IUploadingQuery} [userQuery] - Optional set query parameters.
|
|
42
|
+
* @param {string} [data.type] - Type, determines the folder name in the storage. Example : "page"
|
|
43
|
+
* @param {string} [data.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
|
|
44
|
+
* @param {number} [data.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
|
|
45
|
+
* @param {number} [data.width] - Width parameter. Example : 0
|
|
46
|
+
* @param {number} [data.height] - Height parameter. Example : 0
|
|
47
|
+
* @param {number} [data.compress] - Flag of optimization (compression) for images. Example : true
|
|
48
|
+
*
|
|
49
|
+
* @returns Uploads a file to an Amazon S3-compatible cloud file storage
|
|
50
|
+
*/
|
|
51
|
+
delete(filename: string, userQuery?: IUploadingQuery): Promise<any>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const oneEntry_1 = require("../base/oneEntry");
|
|
13
|
+
/**
|
|
14
|
+
* Controllers for working with file uploading
|
|
15
|
+
*/
|
|
16
|
+
class FileUploadingApi extends oneEntry_1.default {
|
|
17
|
+
constructor(url) {
|
|
18
|
+
super(url);
|
|
19
|
+
this._defaultQuery = {
|
|
20
|
+
type: null,
|
|
21
|
+
entity: null,
|
|
22
|
+
id: null,
|
|
23
|
+
width: null,
|
|
24
|
+
height: null,
|
|
25
|
+
compress: null,
|
|
26
|
+
};
|
|
27
|
+
this._url += '/api/content/files';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Upload file function.
|
|
31
|
+
*
|
|
32
|
+
* @param {IUploadingData} [data] Array of Express.Multer.File objects
|
|
33
|
+
* @example
|
|
34
|
+
* [
|
|
35
|
+
* {
|
|
36
|
+
* "fieldname": "file",
|
|
37
|
+
* "originalname": "myFile.pdf",
|
|
38
|
+
* "mimetype": "application/pdf",
|
|
39
|
+
* "size": 234,
|
|
40
|
+
* "filename": "myFile.pdf",
|
|
41
|
+
* "path": "/myFile.pdf"
|
|
42
|
+
* }
|
|
43
|
+
* ]
|
|
44
|
+
*
|
|
45
|
+
* @param {IUploadingQuery} [userQuery] - Optional set query parameters.
|
|
46
|
+
* @param {string} [data.type] - Type, determines the folder name in the storage. Example : "page"
|
|
47
|
+
* @param {string} [data.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
|
|
48
|
+
* @param {number} [data.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
|
|
49
|
+
* @param {number} [data.width] - Width parameter. Example : 0
|
|
50
|
+
* @param {number} [data.height] - Height parameter. Example : 0
|
|
51
|
+
* @param {number} [data.compress] - Flag of optimization (compression) for images. Example : true
|
|
52
|
+
*
|
|
53
|
+
* @returns Uploads a file to an Amazon S3-compatible cloud file storage
|
|
54
|
+
*/
|
|
55
|
+
upload(data, userQuery) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
58
|
+
const result = yield this._fetchPost('?' + this._queryParamsToString(query), data);
|
|
59
|
+
return result;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Deletes a file from the cloud file storage.
|
|
64
|
+
*
|
|
65
|
+
* @param {string} [filename] File name. Example "file.png"
|
|
66
|
+
*
|
|
67
|
+
* @param {IUploadingQuery} [userQuery] - Optional set query parameters.
|
|
68
|
+
* @param {string} [data.type] - Type, determines the folder name in the storage. Example : "page"
|
|
69
|
+
* @param {string} [data.entity] - Entity name from which the file is uploaded, determines the folder name in the storage. Example : "editor"
|
|
70
|
+
* @param {number} [data.id] - Identifier of the object from which the file is uploaded, determines the folder name in the storage. Example : 3787
|
|
71
|
+
* @param {number} [data.width] - Width parameter. Example : 0
|
|
72
|
+
* @param {number} [data.height] - Height parameter. Example : 0
|
|
73
|
+
* @param {number} [data.compress] - Flag of optimization (compression) for images. Example : true
|
|
74
|
+
*
|
|
75
|
+
* @returns Uploads a file to an Amazon S3-compatible cloud file storage
|
|
76
|
+
*/
|
|
77
|
+
delete(filename, userQuery) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
const query = Object.assign(Object.assign({}, this._defaultQuery), userQuery);
|
|
80
|
+
const result = yield this._fetchDelete(`?filename=${filename}&` + this._queryParamsToString(query));
|
|
81
|
+
return result;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.default = FileUploadingApi;
|
|
86
|
+
//# sourceMappingURL=fileUploadingApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUploadingApi.js","sourceRoot":"","sources":["../../src/file-uploding/fileUploadingApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAuC;AAGvC;;GAEG;AACH,MAAqB,gBAAiB,SAAQ,kBAAQ;IAClD,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QAIN,kBAAa,GAAmB;YACpC,IAAI,EAAC,IAAI;YACT,MAAM,EAAC,IAAI;YACX,EAAE,EAAC,IAAI;YACP,KAAK,EAAC,IAAI;YACV,MAAM,EAAC,IAAI;YACX,QAAQ,EAAC,IAAI;SAChB,CAAA;QAVG,IAAI,CAAC,IAAI,IAAI,oBAAoB,CAAA;IACrC,CAAC;IAWD;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACU,MAAM,CAAC,IAA0B,EAAE,SAA0B;;YACtE,MAAM,KAAK,mCAAuB,IAAI,CAAC,aAAa,GAAK,SAAS,CAAC,CAAA;YACnE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAA;YAElF,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAGD;;;;;;;;;;;;;;OAcG;IACU,MAAM,CAAC,QAAe,EAAE,SAA0B;;YAC3D,MAAM,KAAK,mCAAuB,IAAI,CAAC,aAAa,GAAK,SAAS,CAAC,CAAA;YACnE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,QAAQ,GAAG,GAAG,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAA;YAEnG,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CACJ;AAtED,mCAsEC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface IFileUploading {
|
|
2
|
+
upload(data: Array<IUploadingData>, userQuery?: IUploadingQuery): Promise<IUploadingReturns>;
|
|
3
|
+
delete(filename: string, userQuery?: IUploadingQuery): Promise<any>;
|
|
4
|
+
}
|
|
5
|
+
interface IUploadingQuery {
|
|
6
|
+
type?: string | null;
|
|
7
|
+
entity?: string | null;
|
|
8
|
+
id?: number | null;
|
|
9
|
+
width?: number | null;
|
|
10
|
+
height?: string | null;
|
|
11
|
+
compress?: boolean | null;
|
|
12
|
+
[key: string]: string | number | boolean | null;
|
|
13
|
+
}
|
|
14
|
+
interface IUploadingReturns {
|
|
15
|
+
filename: string;
|
|
16
|
+
downloadLink: string;
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
19
|
+
interface IUploadingData {
|
|
20
|
+
fieldname: string;
|
|
21
|
+
originalname: string;
|
|
22
|
+
mimetype: string;
|
|
23
|
+
size: number;
|
|
24
|
+
filename: string;
|
|
25
|
+
path: string;
|
|
26
|
+
}
|
|
27
|
+
export { IUploadingQuery, IUploadingData, IUploadingReturns, IFileUploading };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUploadingInterfaces.js","sourceRoot":"","sources":["../../src/file-uploding/fileUploadingInterfaces.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,11 @@ import LocalesApi from "./locales/localesApi";
|
|
|
9
9
|
import MenusApi from "./menus/menusApi";
|
|
10
10
|
import FormsApi from "./forms/formsApi";
|
|
11
11
|
import FormsDataApi from "./formsData/formsDataApi";
|
|
12
|
+
import FileUploadingApi from "./file-uploding/fileUploadingApi";
|
|
13
|
+
import SystemApi from "./system/systemApi";
|
|
12
14
|
interface IDefineApi {
|
|
13
15
|
Admins: AdminsApi;
|
|
16
|
+
FileUploading: FileUploadingApi;
|
|
14
17
|
Forms: FormsApi;
|
|
15
18
|
FormData: FormsDataApi;
|
|
16
19
|
GeneralTypes: GeneralTypesApi;
|
|
@@ -19,6 +22,7 @@ interface IDefineApi {
|
|
|
19
22
|
Pages: PageApi;
|
|
20
23
|
Products: ProductApi;
|
|
21
24
|
ProductStatuses: ProductStatusesApi;
|
|
25
|
+
System: SystemApi;
|
|
22
26
|
Templates: TemplatesApi;
|
|
23
27
|
TemplatePreviews: TemplatesPreviewApi;
|
|
24
28
|
}
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ const localesApi_1 = require("./locales/localesApi");
|
|
|
12
12
|
const menusApi_1 = require("./menus/menusApi");
|
|
13
13
|
const formsApi_1 = require("./forms/formsApi");
|
|
14
14
|
const formsDataApi_1 = require("./formsData/formsDataApi");
|
|
15
|
+
const fileUploadingApi_1 = require("./file-uploding/fileUploadingApi");
|
|
16
|
+
const systemApi_1 = require("./system/systemApi");
|
|
15
17
|
/**
|
|
16
18
|
* Define API.
|
|
17
19
|
* @param {string} url - URl of your project.
|
|
@@ -19,6 +21,7 @@ const formsDataApi_1 = require("./formsData/formsDataApi");
|
|
|
19
21
|
*/
|
|
20
22
|
function defineOneEntry(url) {
|
|
21
23
|
const Admins = new adminsApi_1.default(url);
|
|
24
|
+
const FileUploading = new fileUploadingApi_1.default(url);
|
|
22
25
|
const Forms = new formsApi_1.default(url);
|
|
23
26
|
const FormData = new formsDataApi_1.default(url);
|
|
24
27
|
const GeneralTypes = new GeneralTypesApi_1.default(url);
|
|
@@ -27,10 +30,12 @@ function defineOneEntry(url) {
|
|
|
27
30
|
const Pages = new pagesApi_1.default(url);
|
|
28
31
|
const Products = new productsApi_1.default(url);
|
|
29
32
|
const ProductStatuses = new productStatusesApi_1.default(url);
|
|
33
|
+
const System = new systemApi_1.default(url);
|
|
30
34
|
const Templates = new templatesApi_1.default(url);
|
|
31
35
|
const TemplatePreviews = new templatesPreviewApi_1.default(url);
|
|
32
36
|
return {
|
|
33
37
|
Admins,
|
|
38
|
+
FileUploading,
|
|
34
39
|
Forms,
|
|
35
40
|
FormData,
|
|
36
41
|
GeneralTypes,
|
|
@@ -39,6 +44,7 @@ function defineOneEntry(url) {
|
|
|
39
44
|
Pages,
|
|
40
45
|
Products,
|
|
41
46
|
ProductStatuses,
|
|
47
|
+
System,
|
|
42
48
|
Templates,
|
|
43
49
|
TemplatePreviews
|
|
44
50
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAA+C;AAC/C,+CAAuC;AACvC,8EAAuE;AACvE,2DAAoD;AACpD,iFAA0E;AAC1E,kDAA0C;AAC1C,qEAA6D;AAC7D,qDAA6C;AAC7C,+CAAwC;AACxC,+CAAwC;AACxC,2DAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAA+C;AAC/C,+CAAuC;AACvC,8EAAuE;AACvE,2DAAoD;AACpD,iFAA0E;AAC1E,kDAA0C;AAC1C,qEAA6D;AAC7D,qDAA6C;AAC7C,+CAAwC;AACxC,+CAAwC;AACxC,2DAAoD;AACpD,uEAAgE;AAChE,kDAA2C;AAkB3C;;;;GAIG;AACH,SAAgB,cAAc,CAAC,GAAU;IACrC,MAAM,MAAM,GAAc,IAAI,mBAAS,CAAC,GAAG,CAAC,CAAA;IAC5C,MAAM,aAAa,GAAqB,IAAI,0BAAgB,CAAC,GAAG,CAAC,CAAA;IACjE,MAAM,KAAK,GAAa,IAAI,kBAAQ,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,QAAQ,GAAiB,IAAI,sBAAY,CAAC,GAAG,CAAC,CAAA;IACpD,MAAM,YAAY,GAAqB,IAAI,yBAAe,CAAC,GAAG,CAAC,CAAA;IAC/D,MAAM,OAAO,GAAe,IAAI,oBAAU,CAAC,GAAG,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAa,IAAI,kBAAQ,CAAC,GAAG,CAAC,CAAA;IACzC,MAAM,KAAK,GAAW,IAAI,kBAAO,CAAC,GAAG,CAAC,CAAA;IACtC,MAAM,QAAQ,GAAc,IAAI,qBAAU,CAAC,GAAG,CAAC,CAAA;IAC/C,MAAM,eAAe,GAAsB,IAAI,4BAAkB,CAAC,GAAG,CAAC,CAAA;IACtE,MAAM,MAAM,GAAc,IAAI,mBAAS,CAAC,GAAG,CAAC,CAAA;IAC5C,MAAM,SAAS,GAAiB,IAAI,sBAAY,CAAC,GAAG,CAAC,CAAA;IACrD,MAAM,gBAAgB,GAAwB,IAAI,6BAAmB,CAAC,GAAG,CAAC,CAAA;IAE1E,OAAO;QACH,MAAM;QACN,aAAa;QACb,KAAK;QACL,QAAQ;QACR,YAAY;QACZ,OAAO;QACP,KAAK;QACL,KAAK;QACL,QAAQ;QACR,eAAe;QACf,MAAM;QACN,SAAS;QACT,gBAAgB;KACnB,CAAA;AACL,CAAC;AA9BD,wCA8BC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import OneEntry from "../base/oneEntry";
|
|
2
|
+
import { ISystem } from "./systemInterfaces";
|
|
3
|
+
/**
|
|
4
|
+
* Controllers for working with system - system
|
|
5
|
+
*/
|
|
6
|
+
export default class SystemApi extends OneEntry implements ISystem {
|
|
7
|
+
constructor(url: string);
|
|
8
|
+
test404(): Promise<any>;
|
|
9
|
+
test500(): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const oneEntry_1 = require("../base/oneEntry");
|
|
13
|
+
/**
|
|
14
|
+
* Controllers for working with system - system
|
|
15
|
+
*/
|
|
16
|
+
class SystemApi extends oneEntry_1.default {
|
|
17
|
+
constructor(url) {
|
|
18
|
+
super(url);
|
|
19
|
+
this._url += '/api/content/system';
|
|
20
|
+
}
|
|
21
|
+
test404() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const result = yield this._fetchGet('/test404');
|
|
24
|
+
return result;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
test500() {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const result = yield this._fetchGet('/test500');
|
|
30
|
+
return result;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.default = SystemApi;
|
|
35
|
+
//# sourceMappingURL=systemApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemApi.js","sourceRoot":"","sources":["../../src/system/systemApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+CAAwC;AAGxC;;GAEG;AACH,MAAqB,SAAU,SAAQ,kBAAQ;IAC3C,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,CAAC,CAAA;QACV,IAAI,CAAC,IAAI,IAAI,qBAAqB,CAAA;IACtC,CAAC;IAEY,OAAO;;YAChB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;YAC/C,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;IAEY,OAAO;;YAChB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;YAC/C,OAAO,MAAM,CAAA;QACjB,CAAC;KAAA;CACJ;AAfD,4BAeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemInterfaces.js","sourceRoot":"","sources":["../../src/system/systemInterfaces.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"/dist"
|
|
9
9
|
],
|
|
10
|
+
|
|
10
11
|
"author": "ONEENTRY PORTAL CO.",
|
|
11
12
|
"license": "ISC",
|
|
12
13
|
"dependencies": {
|
|
13
14
|
"jsdoc": "^4.0.2",
|
|
14
15
|
"typescript": "^5.2.2"
|
|
15
16
|
}
|
|
16
|
-
}
|
|
17
|
+
}
|