@builder-builder/builder 0.0.16 → 0.0.18

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.
@@ -1,21 +1,12 @@
1
1
  import { BuilderException } from '../exception.js';
2
2
  import { BuilderValidateErrors } from './errors.js';
3
- const VALIDATED = Symbol('builder.validated');
3
+ const VALIDATED_ENTITIES = new WeakSet();
4
4
  export function validate(value) {
5
- // Descriptor flags chosen for Svelte 5 `$state` proxy compatibility — `$state`
6
- // rejects any property that isn't writable, configurable, and enumerable.
7
- // Symbol keys are skipped by `JSON.stringify` regardless of enumerability,
8
- // so the brand never leaks through a serialise round-trip.
9
- Object.defineProperty(value, VALIDATED, {
10
- value: true,
11
- writable: true,
12
- enumerable: true,
13
- configurable: true
14
- });
5
+ VALIDATED_ENTITIES.add(value);
15
6
  return value;
16
7
  }
17
8
  export function assertValidated(value) {
18
- if (typeof value !== 'object' || value === null || !(VALIDATED in value)) {
9
+ if (typeof value !== 'object' || value === null || !VALIDATED_ENTITIES.has(value)) {
19
10
  const errors = new BuilderValidateErrors();
20
11
  errors.unvalidated(value);
21
12
  throw new BuilderException(errors.errors);
@@ -1,5 +1,5 @@
1
1
  import { check } from '../check.js';
2
- import { BuilderModelSerialisedSchema, BuilderUIInputMetadataSchema, BuilderUISerialisedSchema, serialise, uis } from '../entities/index.js';
2
+ import { BuilderModelSerialisedSchema, BuilderUIInputMetadataSchema, BuilderUISerialisedSchema, modelsMerge, serialise, uis } from '../entities/index.js';
3
3
  import { validate } from './brand.js';
4
4
  import { BuilderValidateErrors } from './errors.js';
5
5
  import { checkExpectations } from './expectations.js';
@@ -119,11 +119,10 @@ export function checkUIExpectations(mergedModel, ui, errors) {
119
119
  return;
120
120
  }
121
121
  const innerModels = collectionConfigs(collection).flatMap(({ model: configModel }) => check.is(BuilderModelSerialisedSchema, configModel) ? [configModel] : []);
122
- if (innerModels.length === 0) {
123
- return;
124
- }
125
- const [firstInnerModel] = innerModels;
126
- errors.scope('items', () => walkItems(firstInnerModel, pages.items));
122
+ innerModels.forEach((innerModel) => {
123
+ const mergedInnerModel = modelsMerge(innerModel);
124
+ errors.scope('items', () => walkItems(mergedInnerModel, pages.items));
125
+ });
127
126
  }
128
127
  function walkInput(model, input) {
129
128
  const path = input.path;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder-builder/builder",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {