oneentry 1.0.154 → 1.0.156
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 +21 -0
- package/changelog.md +86 -1
- package/dist/attribute-sets/attributeSetsInterfaces.d.ts +0 -9
- package/dist/attribute-sets/attributeSetsSchemas.d.ts +0 -4
- package/dist/attribute-sets/attributeSetsSchemas.js +0 -2
- package/dist/base/stateModule.d.ts +1 -0
- package/dist/base/stateModule.js +3 -0
- package/dist/base/syncModules.d.ts +34 -109
- package/dist/base/syncModules.js +43 -276
- package/dist/base/timeIntervals.d.ts +95 -0
- package/dist/base/timeIntervals.js +321 -0
- package/dist/base/utils.d.ts +65 -5
- package/dist/base/validation.js +0 -1
- package/dist/blocks/blocksApi.js +11 -1
- package/dist/forms/formsInterfaces.d.ts +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -0
- package/dist/pages/pagesApi.js +11 -0
- package/dist/templates-preview/templatesPreviewInterfaces.d.ts +1 -3
- package/dist/templates-preview/templatesPreviewSchemas.d.ts +0 -2
- package/dist/templates-preview/templatesPreviewSchemas.js +0 -1
- package/package.json +1 -1
- package/dist/base/result.d.ts +0 -39
- package/dist/base/result.js +0 -154
package/dist/base/result.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/* eslint-disable jsdoc/reject-any-type */
|
|
4
|
-
/* eslint-disable no-restricted-syntax */
|
|
5
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
6
|
-
/**
|
|
7
|
-
* Result class for handling response data.
|
|
8
|
-
* @description Result class for handling response data.
|
|
9
|
-
*/
|
|
10
|
-
class Result {
|
|
11
|
-
/**
|
|
12
|
-
* Constructor that initializes the class with a given data.
|
|
13
|
-
* @param {Response | string} data - Response or string data.
|
|
14
|
-
* @description Constructor that initializes the class with a given data, which can be of type Response or string.
|
|
15
|
-
*/
|
|
16
|
-
constructor(data) {
|
|
17
|
-
this.body = data;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Asynchronously converts the body to a blob and returns the current instance.
|
|
21
|
-
* @returns {Promise<Result>} Current instance.
|
|
22
|
-
* @description Asynchronously converts the body to a blob and returns the current instance.
|
|
23
|
-
*/
|
|
24
|
-
async blob() {
|
|
25
|
-
// Convert the body to a blob using the blob() method.
|
|
26
|
-
this.body = await this.body.blob();
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Asynchronously parses the body as JSON and returns the current instance.
|
|
31
|
-
* @returns {Promise<Result>} Current instance.
|
|
32
|
-
* @description Asynchronously parses the body as JSON and returns the current instance.
|
|
33
|
-
*/
|
|
34
|
-
async json() {
|
|
35
|
-
// Check if the body is a string, then parse it as JSON, otherwise call the json() method.
|
|
36
|
-
this.body =
|
|
37
|
-
(await typeof this.body) === 'string'
|
|
38
|
-
? JSON.parse(this.body)
|
|
39
|
-
: this.body.json();
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Recursively removes language-specific data from the provided data or the body.
|
|
44
|
-
* @param {string} langCode - Language code.
|
|
45
|
-
* @param {any} [data] - Data to process.
|
|
46
|
-
* @returns {any} Processed data.
|
|
47
|
-
* @description Recursively removes language-specific data from the provided data or the body.
|
|
48
|
-
*/
|
|
49
|
-
makeDataWithoutLang(langCode, data) {
|
|
50
|
-
if (data) {
|
|
51
|
-
// If data is an array, recursively process each item.
|
|
52
|
-
if (Array.isArray(data)) {
|
|
53
|
-
return data.map((item) => this.makeDataWithoutLang(langCode, item));
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
// Iterate through each key in the data object.
|
|
57
|
-
for (const key in data) {
|
|
58
|
-
// If the value is an object containing the specified language code, replace it with the language-specific value.
|
|
59
|
-
if (typeof data[key] === 'object' &&
|
|
60
|
-
data[key] &&
|
|
61
|
-
langCode in data[key]) {
|
|
62
|
-
data[key] = data[key][langCode];
|
|
63
|
-
}
|
|
64
|
-
else if (typeof data[key] === 'object' && data[key] != null) {
|
|
65
|
-
// If the value is an object, recursively process it.
|
|
66
|
-
data[key] = this.makeDataWithoutLang(langCode, data[key]);
|
|
67
|
-
}
|
|
68
|
-
else if (Array.isArray(data[key])) {
|
|
69
|
-
// If the value is an array, recursively process each item.
|
|
70
|
-
data[key] = data.map((item) => this.makeDataWithoutLang(langCode, item));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
// Return the processed data.
|
|
74
|
-
return data;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
// Process the body if no specific data is provided.
|
|
79
|
-
if (Array.isArray(this.body)) {
|
|
80
|
-
this.body = this.body.map((item) => this.makeDataWithoutLang(langCode, item));
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
// Iterate through each key in the body object.
|
|
84
|
-
for (const key in this.body) {
|
|
85
|
-
// Similar processing as above but applied to the body.
|
|
86
|
-
if (typeof this.body[key] === 'object' &&
|
|
87
|
-
this.body[key] &&
|
|
88
|
-
langCode in this.body[key]) {
|
|
89
|
-
this.body[key] = this.body[key][langCode];
|
|
90
|
-
}
|
|
91
|
-
else if (typeof this.body[key] === 'object' &&
|
|
92
|
-
this.body[key] != null) {
|
|
93
|
-
this.body[key] = this.makeDataWithoutLang(langCode, this.body[key]);
|
|
94
|
-
}
|
|
95
|
-
else if (Array.isArray(this.body[key])) {
|
|
96
|
-
this.body[key] = this.body[key].map((item) => this.makeDataWithoutLang(langCode, item));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Recursively simplifies arrays in the provided data or the body by removing single-element arrays.
|
|
105
|
-
* @param {any} data - The data to simplify.
|
|
106
|
-
* @returns {any} The simplified data.
|
|
107
|
-
*/
|
|
108
|
-
makeDataWithoutArray(data) {
|
|
109
|
-
if (data) {
|
|
110
|
-
// If data is an array, recursively process each item.
|
|
111
|
-
if (Array.isArray(data)) {
|
|
112
|
-
return data.map((item) => this.makeDataWithoutArray(item));
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
// Iterate through each key in the data object.
|
|
116
|
-
for (const key in data) {
|
|
117
|
-
// If the value is a single-element array, replace it with the element itself.
|
|
118
|
-
if (Array.isArray(data[key]) && data[key].length === 1) {
|
|
119
|
-
data[key] = data[key][0];
|
|
120
|
-
}
|
|
121
|
-
else if (typeof data[key] === 'object' &&
|
|
122
|
-
data[key] &&
|
|
123
|
-
!Array.isArray(data[key])) {
|
|
124
|
-
// If the value is an object, recursively process it.
|
|
125
|
-
data[key] = this.makeDataWithoutArray(data[key]);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return data;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
else {
|
|
132
|
-
// Process the body if no specific data is provided.
|
|
133
|
-
if (Array.isArray(this.body)) {
|
|
134
|
-
return this.body.map((item) => this.makeDataWithoutArray(item));
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
// Iterate through each key in the body object.
|
|
138
|
-
for (const key in this.body) {
|
|
139
|
-
// Similar processing as above but applied to the body.
|
|
140
|
-
if (Array.isArray(this.body[key]) && this.body[key].length === 1) {
|
|
141
|
-
this.body[key] = this.body[key][0];
|
|
142
|
-
}
|
|
143
|
-
else if (typeof this.body[key] === 'object' &&
|
|
144
|
-
this.body[key] &&
|
|
145
|
-
!Array.isArray(this.body[key])) {
|
|
146
|
-
this.body[key] = this.makeDataWithoutArray(this.body[key]);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return this;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
exports.default = Result;
|