oneentry 1.0.163 → 1.0.164
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/changelog.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# SDK Change Log
|
|
2
2
|
|
|
3
|
+
## v.1.0.164
|
|
4
|
+
|
|
5
|
+
### What's Fixed
|
|
6
|
+
|
|
7
|
+
- **Validation no longer cries wolf over an image attribute with no file.** The API sends an unset file attribute as `value: ""`, and `isEmptyValue` recognised only `null`, `undefined` and `{}` as empty — so the empty string went on to be checked against the file schema and every product response with such an attribute logged `Attribute of type "image" carries an unexpected file shape: expected object, received string`. Nothing was broken (`validateResponseSafe` only reports), but a validator that fires on healthy data is worse than none: real reports drown in it. The empty string now counts as empty, with a test alongside the `null` / `{}` cases in `src/base/tests/attributes.spec.ts`.
|
|
8
|
+
|
|
9
|
+
- **Forms > `IFormAttribute` now declares `multiselect`.** The API has always returned it on `list` attributes (`multiselect: true` means several options from `listTitles` may be picked, `false` — one), and the SDK passed it through untouched, but the interface never mentioned it. Because `IFormAttribute` carries an index signature `[key: string]: unknown`, `attribute.multiselect` compiled and came back as `unknown`: no autocomplete, no check, and `attr.multiselect ? 'checkbox' : 'radio'` either failed to build under `strict` or had to be written through a cast. Whoever had not read the platform ticket simply never learned the flag existed and left a single-choice control on a "check all that apply" question. The field is now `multiselect?: boolean`, documented exactly as on `IAttributeSchemaItem.multiselect` in attribute-sets. Types only — the data was already there.
|
|
10
|
+
|
|
3
11
|
## v.1.0.163
|
|
4
12
|
|
|
5
13
|
### What's Fixed
|
package/dist/base/validation.js
CHANGED
|
@@ -59,14 +59,17 @@ exports.AttributeFileSchema = zod_1.z.looseObject({
|
|
|
59
59
|
*/
|
|
60
60
|
const FILE_ATTRIBUTE_TYPES = ['image', 'file', 'groupOfImages'];
|
|
61
61
|
/**
|
|
62
|
-
* Reports whether a value is the empty
|
|
63
|
-
* attribute with no value set
|
|
62
|
+
* Reports whether a value is one of the empty forms the API sends for an
|
|
63
|
+
* attribute with no value set: `null`, the empty localization map, or the
|
|
64
|
+
* empty string a file attribute carries when no file is attached.
|
|
64
65
|
* @param {unknown} value - The value to test.
|
|
65
66
|
* @returns {boolean} True when the value carries nothing.
|
|
66
67
|
*/
|
|
67
68
|
function isEmptyValue(value) {
|
|
68
69
|
if (value === null || value === undefined)
|
|
69
70
|
return true;
|
|
71
|
+
if (value === '')
|
|
72
|
+
return true;
|
|
70
73
|
return (typeof value === 'object' &&
|
|
71
74
|
!Array.isArray(value) &&
|
|
72
75
|
Object.keys(value).length === 0);
|
|
@@ -119,6 +119,7 @@ interface IFormLocalizeInfo extends Omit<ILocalizeInfo, 'title'> {
|
|
|
119
119
|
* @property {IAttributeLocalizeInfo} localizeInfos - Localized labels for the field. For `timeInterval` attributes, also carries the `intervals` schedule payload.
|
|
120
120
|
* @property {unknown} initialValue - Default value applied when the field is not filled.
|
|
121
121
|
* @property {IListTitle[]} listTitles - Predefined options for `list`/`radioButton` fields; empty array for other types.
|
|
122
|
+
* @property {boolean} [multiselect] - For `list` fields — whether several options from `listTitles` may be selected. Optional. Example: false.
|
|
122
123
|
* @property {IAttributeValidators} validators - Validation rules; empty object when no validators are configured.
|
|
123
124
|
* @property {Record<string, unknown>} settings - Field-specific configuration; empty object by default.
|
|
124
125
|
* @property {Record<string, IFormAttributeAdditionalField>} additionalFields - Nested sub-fields keyed by marker; empty object when none.
|
|
@@ -139,6 +140,7 @@ interface IFormAttribute {
|
|
|
139
140
|
localizeInfos: IAttributeLocalizeInfo;
|
|
140
141
|
initialValue: unknown;
|
|
141
142
|
listTitles: IListTitle[];
|
|
143
|
+
multiselect?: boolean;
|
|
142
144
|
validators: IAttributeValidators;
|
|
143
145
|
settings: Record<string, unknown>;
|
|
144
146
|
additionalFields: Record<string, IFormAttributeAdditionalField>;
|
package/esm/base/validation.js
CHANGED
|
@@ -53,14 +53,17 @@ export const AttributeFileSchema = z.looseObject({
|
|
|
53
53
|
*/
|
|
54
54
|
const FILE_ATTRIBUTE_TYPES = ['image', 'file', 'groupOfImages'];
|
|
55
55
|
/**
|
|
56
|
-
* Reports whether a value is the empty
|
|
57
|
-
* attribute with no value set
|
|
56
|
+
* Reports whether a value is one of the empty forms the API sends for an
|
|
57
|
+
* attribute with no value set: `null`, the empty localization map, or the
|
|
58
|
+
* empty string a file attribute carries when no file is attached.
|
|
58
59
|
* @param {unknown} value - The value to test.
|
|
59
60
|
* @returns {boolean} True when the value carries nothing.
|
|
60
61
|
*/
|
|
61
62
|
function isEmptyValue(value) {
|
|
62
63
|
if (value === null || value === undefined)
|
|
63
64
|
return true;
|
|
65
|
+
if (value === '')
|
|
66
|
+
return true;
|
|
64
67
|
return (typeof value === 'object' &&
|
|
65
68
|
!Array.isArray(value) &&
|
|
66
69
|
Object.keys(value).length === 0);
|
|
@@ -119,6 +119,7 @@ interface IFormLocalizeInfo extends Omit<ILocalizeInfo, 'title'> {
|
|
|
119
119
|
* @property {IAttributeLocalizeInfo} localizeInfos - Localized labels for the field. For `timeInterval` attributes, also carries the `intervals` schedule payload.
|
|
120
120
|
* @property {unknown} initialValue - Default value applied when the field is not filled.
|
|
121
121
|
* @property {IListTitle[]} listTitles - Predefined options for `list`/`radioButton` fields; empty array for other types.
|
|
122
|
+
* @property {boolean} [multiselect] - For `list` fields — whether several options from `listTitles` may be selected. Optional. Example: false.
|
|
122
123
|
* @property {IAttributeValidators} validators - Validation rules; empty object when no validators are configured.
|
|
123
124
|
* @property {Record<string, unknown>} settings - Field-specific configuration; empty object by default.
|
|
124
125
|
* @property {Record<string, IFormAttributeAdditionalField>} additionalFields - Nested sub-fields keyed by marker; empty object when none.
|
|
@@ -139,6 +140,7 @@ interface IFormAttribute {
|
|
|
139
140
|
localizeInfos: IAttributeLocalizeInfo;
|
|
140
141
|
initialValue: unknown;
|
|
141
142
|
listTitles: IListTitle[];
|
|
143
|
+
multiselect?: boolean;
|
|
142
144
|
validators: IAttributeValidators;
|
|
143
145
|
settings: Record<string, unknown>;
|
|
144
146
|
additionalFields: Record<string, IFormAttributeAdditionalField>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneentry",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.164",
|
|
4
4
|
"description": "OneEntry NPM package",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"prepublishOnly": "node ../scripts/smoke-pack.js --files-only",
|
|
51
|
-
"postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.
|
|
51
|
+
"postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.164"
|
|
52
52
|
},
|
|
53
53
|
"sideEffects": false,
|
|
54
54
|
"files": [
|