@almadar/core 10.93.1 → 10.95.0

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,10 +1,10 @@
1
- import { f as OrbitalEntity, a as EntityPersistence, E as EntityField, F as FieldValue, g as EntityRow } from '../effect-BnSE0gKt.js';
2
- import { a as OrbitalDefinition, O as OrbitalSchema } from '../schema-DFmFFcLs.js';
1
+ import { O as OrbitalEntity, a as EntityPersistence, E as EntityField, F as FieldValue, g as EntityRow } from '../effect-Bw8T4qh5.js';
2
+ import { a as OrbitalDefinition, O as OrbitalSchema } from '../schema-DPpES4qj.js';
3
3
  import { S as SExpr } from '../expression-WfTp2arD.js';
4
- export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessPoliciesByStoreKey, b as entityAccessTable } from '../entityAccess-DtWseAgf.js';
4
+ export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessPoliciesByStoreKey, b as entityAccessTable } from '../entityAccess-DfoXs9mc.js';
5
5
  import 'zod';
6
6
  import '../json-D8gmyK3l.js';
7
- import '../trait-DSMzclmJ.js';
7
+ import '../trait-DXXRrRMP.js';
8
8
 
9
9
  /**
10
10
  * Lightweight seeded pseudo-random generator for mock data.
@@ -167,18 +167,19 @@ function randomPhone() {
167
167
  }
168
168
 
169
169
  // src/access/entityAccess.ts
170
- function inlineEntities(schema) {
170
+ function orbitalInlineEntities(orbital) {
171
171
  const out = [];
172
- for (const orbital of schema.orbitals ?? []) {
173
- const refs = [orbital.entity, ...orbital.auxiliaryEntities ?? []];
174
- for (const ref of refs) {
175
- if (typeof ref === "object" && ref !== null && "fields" in ref) {
176
- out.push(ref);
177
- }
172
+ const refs = [orbital.entity, ...orbital.auxiliaryEntities ?? []];
173
+ for (const ref of refs) {
174
+ if (typeof ref === "object" && ref !== null && "fields" in ref) {
175
+ out.push(ref);
178
176
  }
179
177
  }
180
178
  return out;
181
179
  }
180
+ function inlineEntities(schema) {
181
+ return (schema.orbitals ?? []).flatMap(orbitalInlineEntities);
182
+ }
182
183
  function isDeclared(p) {
183
184
  return p.read !== void 0 || p.create !== void 0 || p.update !== void 0 || p.delete !== void 0;
184
185
  }
@@ -227,16 +228,7 @@ function entityAccessPoliciesByStoreKey(schema) {
227
228
 
228
229
  // src/mock/identityOwners.ts
229
230
  function inlineEntities2(schema) {
230
- const out = [];
231
- for (const orbital of schema.orbitals ?? []) {
232
- const refs = [orbital.entity, ...orbital.auxiliaryEntities ?? []];
233
- for (const ref of refs) {
234
- if (typeof ref === "object" && ref !== null && "fields" in ref) {
235
- out.push(ref);
236
- }
237
- }
238
- }
239
- return out;
231
+ return (schema.orbitals ?? []).flatMap(orbitalInlineEntities);
240
232
  }
241
233
  function identityEntitiesTaggedOf(orbitals) {
242
234
  const out = [];
@@ -574,6 +566,7 @@ var EntityFieldSchema = z.lazy(() => {
574
566
  intrinsic: z.boolean().optional(),
575
567
  description: z.string().optional(),
576
568
  synonyms: z.string().optional(),
569
+ mock: z.string().optional(),
577
570
  mergedFrom: z.string().optional()
578
571
  };
579
572
  function scalarVariant(t) {
@@ -945,6 +938,13 @@ function isDeclaredDefaultHonored(field) {
945
938
  function sampleRowCount(entity, requested) {
946
939
  return entity.persistence === "runtime" ? 1 : requested;
947
940
  }
941
+ function mockFieldValue(declared, index) {
942
+ const candidates = declared.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
943
+ if (candidates.length > 1) {
944
+ return candidates[(index - 1) % candidates.length];
945
+ }
946
+ return `${declared.trim()}-${index}`;
947
+ }
948
948
  function sampleText(field, ctx) {
949
949
  const fieldName = field.name ?? "field";
950
950
  if (IMAGE_FIELD_NAMES.has(fieldName.toLowerCase())) {
@@ -1020,6 +1020,10 @@ function sampleFieldValue(field, ctx) {
1020
1020
  const ordinal = isRuntime ? 1 : ctx.index;
1021
1021
  return values[(ordinal - 1) % values.length];
1022
1022
  }
1023
+ if (field.mock !== void 0) {
1024
+ const ordinal = isRuntime ? 1 : ctx.index;
1025
+ return mockFieldValue(field.mock, ordinal);
1026
+ }
1023
1027
  switch (field.type) {
1024
1028
  case "string":
1025
1029
  return sampleText(field, ctx);