oneentry 1.0.169 → 1.0.170

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,19 @@
1
1
  # SDK Change Log
2
2
 
3
+ ## v.1.0.170
4
+
5
+ ### What's Changed
6
+
7
+ - **`IAttributeValidators` named four validators of the eighteen the platform accepts.** The interface gave a shape to `requiredValidator`, `stringInspectionValidator`, `emailInspectionValidator` and `defaultValueValidator`, and closed with `[key: string]: unknown`; its JSDoc said only that the set is extensible. A developer reading the types learned that a required flag, a length constraint, an e-mail toggle and a default value exist, and did not learn that a **regular expression**, an **input mask**, a **whitespace trim** and **date bounds** exist — fourteen capabilities absent from the model of the platform, which on one pilot reached three client-facing documents as the sentence "a field has exactly four validators; there are no regular expressions and no phone check". All eighteen names are now declared with the shape the platform stores: `requiredValidator`, `trimValidator`, `stringInspectionValidator`, `urlInspectionValidator`, `emailInspectionValidator`, `checkForNumberValidator`, `roundingNumberValidator`, `booleanValidator`, `comparisonValidator`, `regExpValidator`, `fieldMaskValidator`, `checkForAGivenList`, `defaultValueValidator`, `sizeInPixelsValidator`, `checkingFilesValidator`, `minMaxDateValidator`, `valueValidator`, `checkForLettersValidator` (CMS-983).
8
+
9
+ - **A misspelt validator name is a compile error instead of a `400`.** The index signature `[key: string]: unknown` made the gap silent in the other direction too: `emailValidator` typechecked and the platform refused the write at run time with `schema contains unknown validator name(s)`. The signature is gone, so an unknown name is caught where it is written. Code that still needs a name the SDK does not know can cast at that one place.
10
+
11
+ - **Shapes follow what the platform executes, not what reads well.** `regExpValidator` takes `{ patternValue, invert, flags }` and not `{ regExp }`, `fieldMaskValidator` takes `{ maskValue }`, `checkForAGivenList` carries no `Validator` suffix, and `minMaxDateValidator` stores `minDateTimeValue` / `maxDateTimeValue`. The toggles — `requiredValidator`, `trimValidator`, `urlInspectionValidator`, `emailInspectionValidator` — are typed `object | boolean`, because both forms are in live data: an e-mail check is stored as the boolean `true` on seven fields of the stands checked and as an object on one. Every validator may also carry `customErrorText`, which is now in the type. `valueValidator` is kept with the same shape as `defaultValueValidator`: it is the panel's own name for that control, and the API stores it.
12
+
13
+ - **The attribute JSDoc in `base/utils.ts` named `regexValidator`,** which does not exist. It points at `IAttributeValidators` for the full list instead.
14
+
15
+ Types and documentation only; the wire format did not change.
16
+
3
17
  ## v.1.0.169
4
18
 
5
19
  ### What's Fixed
@@ -189,28 +189,130 @@ interface IAttributeSchemaItem {
189
189
  }
190
190
  /**
191
191
  * @interface IAttributeValidators
192
- * @property {object} [requiredValidator] - Marks the field as required. Shape: `{ strict: boolean }`. Example: `{ strict: true }`.
193
- * @property {object} [stringInspectionValidator] - Length constraints for string fields. Shape: `{ stringMin: number; stringMax: number; stringLength: number }`.
194
- * @property {boolean} [emailInspectionValidator] - Toggle for email-format validation.
195
- * @property {object} [defaultValueValidator] - Default value configuration with optional custom error text. Shape: `{ customErrorText?: string; fieldDefaultValue?: unknown; fieldDefaultValue2?: unknown }`.
196
- * @description Map of validators applied to an attribute or form field. Set is extensible — additional validator types may be added by the API.
192
+ * @property {object | boolean} [requiredValidator] - Field must be filled in. Shape: `{ strict: boolean }`. Example: `{ strict: true }`.
193
+ * @property {object | boolean} [trimValidator] - Leading and trailing whitespace is stripped from the value. Stored as an empty object when the toggle is on. Example: `{}`.
194
+ * @property {object} [stringInspectionValidator] - Length constraints for string fields. Example: `{ stringLength: 0, stringMin: 2, stringMax: 60 }`.
195
+ * @property {object | boolean} [urlInspectionValidator] - Value must look like a URL. Stored either as `true` or as an object. Example: `true`.
196
+ * @property {object | boolean} [emailInspectionValidator] - Value must look like an e-mail address. Stored either as `true` or as an object. Example: `true`.
197
+ * @property {object} [checkForNumberValidator] - Value must be a number, optionally an integer within bounds. `0` disables a bound. Example: `{ integerOnly: true, minValue: 1, maxValue: 10 }`.
198
+ * @property {object} [roundingNumberValidator] - Rounds the number before storing it. Example: `{ integerOnly: false, numberOfDecimals: 2, direction: 'round' }`.
199
+ * @property {object} [booleanValidator] - Value must equal one of the two declared values. Example: `{ trueValue: 1, falseValue: 0 }`.
200
+ * @property {object} [comparisonValidator] - Compares the value with another attribute or with a constant. Example: `{ compareAttribute: 'notChoosed', compareValue: '10', type: 'number', operator: 'equality' }`.
201
+ * @property {object} [regExpValidator] - Value must match a regular expression; `invert` refuses matches instead. Example: `{ patternValue: '^[0-9]{5}$', invert: false, flags: ['i'] }`.
202
+ * @property {object} [fieldMaskValidator] - Value must match an input mask (`9` digit, `A` upper letter, `a` lower letter, `*` any, `$` one of `()+-`). Example: `{ maskValue: '+9 (999) 999-99-99' }`.
203
+ * @property {object} [checkForAGivenList] - Value must be in the list, or outside it when `notValue` is true. Example: `{ rangeValue: ['red', 'green'], notValue: false }`.
204
+ * @property {object} [defaultValueValidator] - Value substituted when the field is left empty. Example: `{ fieldDefaultValue: 'USD' }`.
205
+ * @property {object} [sizeInPixelsValidator] - Image bounds in pixels; executed by the admin panel. Example: `{ maxX: 1920, maxY: 1080 }`.
206
+ * @property {object} [checkingFilesValidator] - File size bounds and allowed extensions; executed by the admin panel. Example: `{ minValue: 0, maxValue: 5, minUnits: 'kb', maxUnits: 'mb', extensions: ['pdf'] }`.
207
+ * @property {object} [minMaxDateValidator] - Date bounds; executed by the admin panel. Example: `{ minDateTimeValue: '2026-01-01', maxDateTimeValue: '2026-12-31' }`.
208
+ * @property {object} [valueValidator] - The panel's "default value" control; it writes `defaultValueValidator`, and this name is kept because the API accepts and stores it. Example: `{ fieldDefaultValue: 'USD' }`.
209
+ * @property {object} [checkForLettersValidator] - Letters-only check by pattern; executed by the admin panel. Example: `{ patternValue: '^[A-Za-z ]+$' }`.
210
+ * @description Map of validators applied to an attribute or form field, keyed by validator name.
211
+ *
212
+ * These eighteen names are the full set the API accepts in
213
+ * `attributes_sets.schema.<attribute>.validators.<langCode>`; any other name is refused
214
+ * with `400`. The first thirteen are executed by the platform on write, the last five are
215
+ * stored as given and executed by the admin panel.
216
+ *
217
+ * Every validator may also carry `customErrorText` — the message shown instead of the
218
+ * default one when the value is refused.
197
219
  */
198
220
  interface IAttributeValidators {
199
221
  requiredValidator?: {
200
- strict: boolean;
201
- };
222
+ strict?: boolean;
223
+ customErrorText?: string;
224
+ } | boolean;
225
+ trimValidator?: {
226
+ strict?: boolean;
227
+ customErrorText?: string;
228
+ } | boolean;
202
229
  stringInspectionValidator?: {
203
- stringMin: number;
204
- stringMax: number;
205
- stringLength: number;
230
+ stringMin?: number;
231
+ stringMax?: number;
232
+ stringLength?: number;
233
+ customErrorText?: string;
234
+ };
235
+ urlInspectionValidator?: {
236
+ strict?: boolean;
237
+ customErrorText?: string;
238
+ } | boolean;
239
+ emailInspectionValidator?: {
240
+ strict?: boolean;
241
+ customErrorText?: string;
242
+ } | boolean;
243
+ checkForNumberValidator?: {
244
+ integerOnly?: boolean;
245
+ minValue?: number;
246
+ maxValue?: number;
247
+ customErrorText?: string;
248
+ };
249
+ roundingNumberValidator?: {
250
+ integerOnly?: boolean;
251
+ numberOfDecimals?: number;
252
+ direction?: 'round' | 'up' | 'down' | 'truncate';
253
+ customErrorText?: string;
254
+ };
255
+ booleanValidator?: {
256
+ trueValue?: unknown;
257
+ falseValue?: unknown;
258
+ customErrorText?: string;
259
+ };
260
+ comparisonValidator?: {
261
+ compareAttribute?: string;
262
+ compareValue?: string;
263
+ compareValue2?: string;
264
+ type?: string;
265
+ operator?: string;
266
+ customErrorText?: string;
267
+ };
268
+ regExpValidator?: {
269
+ patternValue?: string;
270
+ invert?: boolean;
271
+ flags?: string[];
272
+ customErrorText?: string;
273
+ };
274
+ fieldMaskValidator?: {
275
+ maskValue?: string;
276
+ customErrorText?: string;
277
+ };
278
+ checkForAGivenList?: {
279
+ rangeValue?: unknown[];
280
+ rangeValue2?: unknown[];
281
+ notValue?: boolean;
282
+ customErrorText?: string;
206
283
  };
207
- emailInspectionValidator?: boolean;
208
284
  defaultValueValidator?: {
285
+ fieldDefaultValue?: unknown;
286
+ fieldDefaultValue2?: unknown;
287
+ customErrorText?: string;
288
+ };
289
+ sizeInPixelsValidator?: {
290
+ maxX?: number;
291
+ maxY?: number;
209
292
  customErrorText?: string;
293
+ };
294
+ checkingFilesValidator?: {
295
+ minValue?: number;
296
+ maxValue?: number;
297
+ minUnits?: 'kb' | 'mb';
298
+ maxUnits?: 'kb' | 'mb';
299
+ extensions?: string[];
300
+ customErrorText?: string;
301
+ };
302
+ minMaxDateValidator?: {
303
+ minDateTimeValue?: string;
304
+ maxDateTimeValue?: string;
305
+ customErrorText?: string;
306
+ };
307
+ valueValidator?: {
210
308
  fieldDefaultValue?: unknown;
211
309
  fieldDefaultValue2?: unknown;
310
+ customErrorText?: string;
311
+ };
312
+ checkForLettersValidator?: {
313
+ patternValue?: string;
314
+ customErrorText?: string;
212
315
  };
213
- [key: string]: unknown;
214
316
  }
215
317
  /**
216
318
  * Represents an attribute set entity.
@@ -96,7 +96,7 @@ interface IConfig {
96
96
  * @property {boolean} isVisible - Whether the attribute is exposed in the public API/UI. Example: true.
97
97
  * @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
98
98
  * @property {Record<string, unknown>} [settings] - Type-specific configuration (e.g. min/max for numbers, accepted MIME types for files). Optional.
99
- * @property {Record<string, unknown>} validators - Validation rules applied to the attribute value (e.g. `requiredValidator`, `regexValidator`). Example: { "requiredValidator": { "strict": true } }.
99
+ * @property {Record<string, unknown>} validators - Validation rules applied to the attribute value, keyed by validator name (e.g. `requiredValidator`, `regExpValidator`); the full set of names is listed on `IAttributeValidators`. Example: { "requiredValidator": { "strict": true } }.
100
100
  * @property {Record<string, IAttributes>} [additionalFields] - Nested sub-attributes attached to this attribute, keyed by marker. Optional.
101
101
  * @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
102
102
  * @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
@@ -189,28 +189,130 @@ interface IAttributeSchemaItem {
189
189
  }
190
190
  /**
191
191
  * @interface IAttributeValidators
192
- * @property {object} [requiredValidator] - Marks the field as required. Shape: `{ strict: boolean }`. Example: `{ strict: true }`.
193
- * @property {object} [stringInspectionValidator] - Length constraints for string fields. Shape: `{ stringMin: number; stringMax: number; stringLength: number }`.
194
- * @property {boolean} [emailInspectionValidator] - Toggle for email-format validation.
195
- * @property {object} [defaultValueValidator] - Default value configuration with optional custom error text. Shape: `{ customErrorText?: string; fieldDefaultValue?: unknown; fieldDefaultValue2?: unknown }`.
196
- * @description Map of validators applied to an attribute or form field. Set is extensible — additional validator types may be added by the API.
192
+ * @property {object | boolean} [requiredValidator] - Field must be filled in. Shape: `{ strict: boolean }`. Example: `{ strict: true }`.
193
+ * @property {object | boolean} [trimValidator] - Leading and trailing whitespace is stripped from the value. Stored as an empty object when the toggle is on. Example: `{}`.
194
+ * @property {object} [stringInspectionValidator] - Length constraints for string fields. Example: `{ stringLength: 0, stringMin: 2, stringMax: 60 }`.
195
+ * @property {object | boolean} [urlInspectionValidator] - Value must look like a URL. Stored either as `true` or as an object. Example: `true`.
196
+ * @property {object | boolean} [emailInspectionValidator] - Value must look like an e-mail address. Stored either as `true` or as an object. Example: `true`.
197
+ * @property {object} [checkForNumberValidator] - Value must be a number, optionally an integer within bounds. `0` disables a bound. Example: `{ integerOnly: true, minValue: 1, maxValue: 10 }`.
198
+ * @property {object} [roundingNumberValidator] - Rounds the number before storing it. Example: `{ integerOnly: false, numberOfDecimals: 2, direction: 'round' }`.
199
+ * @property {object} [booleanValidator] - Value must equal one of the two declared values. Example: `{ trueValue: 1, falseValue: 0 }`.
200
+ * @property {object} [comparisonValidator] - Compares the value with another attribute or with a constant. Example: `{ compareAttribute: 'notChoosed', compareValue: '10', type: 'number', operator: 'equality' }`.
201
+ * @property {object} [regExpValidator] - Value must match a regular expression; `invert` refuses matches instead. Example: `{ patternValue: '^[0-9]{5}$', invert: false, flags: ['i'] }`.
202
+ * @property {object} [fieldMaskValidator] - Value must match an input mask (`9` digit, `A` upper letter, `a` lower letter, `*` any, `$` one of `()+-`). Example: `{ maskValue: '+9 (999) 999-99-99' }`.
203
+ * @property {object} [checkForAGivenList] - Value must be in the list, or outside it when `notValue` is true. Example: `{ rangeValue: ['red', 'green'], notValue: false }`.
204
+ * @property {object} [defaultValueValidator] - Value substituted when the field is left empty. Example: `{ fieldDefaultValue: 'USD' }`.
205
+ * @property {object} [sizeInPixelsValidator] - Image bounds in pixels; executed by the admin panel. Example: `{ maxX: 1920, maxY: 1080 }`.
206
+ * @property {object} [checkingFilesValidator] - File size bounds and allowed extensions; executed by the admin panel. Example: `{ minValue: 0, maxValue: 5, minUnits: 'kb', maxUnits: 'mb', extensions: ['pdf'] }`.
207
+ * @property {object} [minMaxDateValidator] - Date bounds; executed by the admin panel. Example: `{ minDateTimeValue: '2026-01-01', maxDateTimeValue: '2026-12-31' }`.
208
+ * @property {object} [valueValidator] - The panel's "default value" control; it writes `defaultValueValidator`, and this name is kept because the API accepts and stores it. Example: `{ fieldDefaultValue: 'USD' }`.
209
+ * @property {object} [checkForLettersValidator] - Letters-only check by pattern; executed by the admin panel. Example: `{ patternValue: '^[A-Za-z ]+$' }`.
210
+ * @description Map of validators applied to an attribute or form field, keyed by validator name.
211
+ *
212
+ * These eighteen names are the full set the API accepts in
213
+ * `attributes_sets.schema.<attribute>.validators.<langCode>`; any other name is refused
214
+ * with `400`. The first thirteen are executed by the platform on write, the last five are
215
+ * stored as given and executed by the admin panel.
216
+ *
217
+ * Every validator may also carry `customErrorText` — the message shown instead of the
218
+ * default one when the value is refused.
197
219
  */
198
220
  interface IAttributeValidators {
199
221
  requiredValidator?: {
200
- strict: boolean;
201
- };
222
+ strict?: boolean;
223
+ customErrorText?: string;
224
+ } | boolean;
225
+ trimValidator?: {
226
+ strict?: boolean;
227
+ customErrorText?: string;
228
+ } | boolean;
202
229
  stringInspectionValidator?: {
203
- stringMin: number;
204
- stringMax: number;
205
- stringLength: number;
230
+ stringMin?: number;
231
+ stringMax?: number;
232
+ stringLength?: number;
233
+ customErrorText?: string;
234
+ };
235
+ urlInspectionValidator?: {
236
+ strict?: boolean;
237
+ customErrorText?: string;
238
+ } | boolean;
239
+ emailInspectionValidator?: {
240
+ strict?: boolean;
241
+ customErrorText?: string;
242
+ } | boolean;
243
+ checkForNumberValidator?: {
244
+ integerOnly?: boolean;
245
+ minValue?: number;
246
+ maxValue?: number;
247
+ customErrorText?: string;
248
+ };
249
+ roundingNumberValidator?: {
250
+ integerOnly?: boolean;
251
+ numberOfDecimals?: number;
252
+ direction?: 'round' | 'up' | 'down' | 'truncate';
253
+ customErrorText?: string;
254
+ };
255
+ booleanValidator?: {
256
+ trueValue?: unknown;
257
+ falseValue?: unknown;
258
+ customErrorText?: string;
259
+ };
260
+ comparisonValidator?: {
261
+ compareAttribute?: string;
262
+ compareValue?: string;
263
+ compareValue2?: string;
264
+ type?: string;
265
+ operator?: string;
266
+ customErrorText?: string;
267
+ };
268
+ regExpValidator?: {
269
+ patternValue?: string;
270
+ invert?: boolean;
271
+ flags?: string[];
272
+ customErrorText?: string;
273
+ };
274
+ fieldMaskValidator?: {
275
+ maskValue?: string;
276
+ customErrorText?: string;
277
+ };
278
+ checkForAGivenList?: {
279
+ rangeValue?: unknown[];
280
+ rangeValue2?: unknown[];
281
+ notValue?: boolean;
282
+ customErrorText?: string;
206
283
  };
207
- emailInspectionValidator?: boolean;
208
284
  defaultValueValidator?: {
285
+ fieldDefaultValue?: unknown;
286
+ fieldDefaultValue2?: unknown;
287
+ customErrorText?: string;
288
+ };
289
+ sizeInPixelsValidator?: {
290
+ maxX?: number;
291
+ maxY?: number;
209
292
  customErrorText?: string;
293
+ };
294
+ checkingFilesValidator?: {
295
+ minValue?: number;
296
+ maxValue?: number;
297
+ minUnits?: 'kb' | 'mb';
298
+ maxUnits?: 'kb' | 'mb';
299
+ extensions?: string[];
300
+ customErrorText?: string;
301
+ };
302
+ minMaxDateValidator?: {
303
+ minDateTimeValue?: string;
304
+ maxDateTimeValue?: string;
305
+ customErrorText?: string;
306
+ };
307
+ valueValidator?: {
210
308
  fieldDefaultValue?: unknown;
211
309
  fieldDefaultValue2?: unknown;
310
+ customErrorText?: string;
311
+ };
312
+ checkForLettersValidator?: {
313
+ patternValue?: string;
314
+ customErrorText?: string;
212
315
  };
213
- [key: string]: unknown;
214
316
  }
215
317
  /**
216
318
  * Represents an attribute set entity.
@@ -96,7 +96,7 @@ interface IConfig {
96
96
  * @property {boolean} isVisible - Whether the attribute is exposed in the public API/UI. Example: true.
97
97
  * @property {string} type - Attribute data type (e.g. "string", "integer", "list", "file", "image").
98
98
  * @property {Record<string, unknown>} [settings] - Type-specific configuration (e.g. min/max for numbers, accepted MIME types for files). Optional.
99
- * @property {Record<string, unknown>} validators - Validation rules applied to the attribute value (e.g. `requiredValidator`, `regexValidator`). Example: { "requiredValidator": { "strict": true } }.
99
+ * @property {Record<string, unknown>} validators - Validation rules applied to the attribute value, keyed by validator name (e.g. `requiredValidator`, `regExpValidator`); the full set of names is listed on `IAttributeValidators`. Example: { "requiredValidator": { "strict": true } }.
100
100
  * @property {Record<string, IAttributes>} [additionalFields] - Nested sub-attributes attached to this attribute, keyed by marker. Optional.
101
101
  * @property {boolean} [isIcon] - Block/preview attribute flag — whether the field is treated as an icon. Optional.
102
102
  * @property {boolean} [isProductPreview] - Block/preview attribute flag — whether the field is shown in product preview. Optional.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneentry",
3
- "version": "1.0.169",
3
+ "version": "1.0.170",
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.169"
51
+ "postpublish": "node ../scripts/verify-published.js --named defineOneEntry --expect 1.0.170"
52
52
  },
53
53
  "sideEffects": false,
54
54
  "files": [