@almadar/core 10.50.0 → 10.52.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,7 +1,7 @@
1
- import { O as OrbitalSchema } from '../schema-1bzTH92n.js';
2
- export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessTable } from '../entityAccess-dYpx6Ipw.js';
3
- import { a as EntityPersistence, E as EntityField, F as FieldValue, f as EntityRow } from '../effect-DjMRX8sI.js';
4
- import '../trait-DkMVtmED.js';
1
+ import { O as OrbitalSchema } from '../schema-h6xcymfn.js';
2
+ export { E as EntityAccessPolicies, e as entityAccessPolicies, a as entityAccessTable } from '../entityAccess-3QD5qbqw.js';
3
+ import { a as EntityPersistence, E as EntityField, F as FieldValue, f as EntityRow } from '../effect-CqTo1gAF.js';
4
+ import '../trait-CnbGhs6A.js';
5
5
  import '../expression-Yf7qvvOs.js';
6
6
  import 'zod';
7
7
 
@@ -39,6 +39,13 @@ declare function randomPastDate({ years }?: {
39
39
  declare function randomRecentDate({ days }?: {
40
40
  days?: number;
41
41
  }): Date;
42
+ /** ISO-8601 date string straddling now: `[-days, +days]`. One PRNG draw,
43
+ * same call shape as `randomRecentDate`, so seeded field order is unchanged —
44
+ * only the window shifts from past-only to centered-on-now. Past-only starved
45
+ * any calendar/upcoming view, since every seeded `startsAt` was already over. */
46
+ declare function randomStraddlingDate({ days }?: {
47
+ days?: number;
48
+ }): Date;
42
49
  /** Any date in the last ~100 years. */
43
50
  declare function randomAnytimeDate(): Date;
44
51
  /** A few random words. */
@@ -147,4 +154,4 @@ declare function sampleRow(entity: SampleEntity, ctx: Omit<SampleContext, 'entit
147
154
  /** `count` rows, 1-based, honoring the runtime-singleton gate. */
148
155
  declare function sampleRows(entity: SampleEntity, count: number, strategy: SampleStrategy): EntityRow[];
149
156
 
150
- export { IMAGE_FIELD_NAMES, type SampleContext, type SampleEntity, type SampleStrategy, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
157
+ export { IMAGE_FIELD_NAMES, type SampleContext, type SampleEntity, type SampleStrategy, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomStraddlingDate, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
@@ -49,6 +49,12 @@ function randomRecentDate({ days = 30 } = {}) {
49
49
  const age = Math.floor(nextFloat() * maxAge);
50
50
  return new Date(now - age);
51
51
  }
52
+ function randomStraddlingDate({ days = 15 } = {}) {
53
+ const now = Date.now();
54
+ const span = days * 24 * 60 * 60 * 1e3;
55
+ const offset = Math.floor(nextFloat() * span * 2) - span;
56
+ return new Date(now + offset);
57
+ }
52
58
  function randomAnytimeDate() {
53
59
  const now = Date.now();
54
60
  const maxAge = 100 * 365 * 24 * 60 * 60 * 1e3;
@@ -182,13 +188,29 @@ function ownerFieldsFromSchema(schema) {
182
188
  const identity = identityEntityName(schema);
183
189
  if (identity === void 0) return [];
184
190
  const out = [];
185
- for (const def of inlineEntities(schema)) {
191
+ const defs = inlineEntities(schema);
192
+ const declaredByCollection = /* @__PURE__ */ new Map();
193
+ for (const def of defs) {
186
194
  for (const field of def.fields ?? []) {
187
195
  if (field.name && field.type === "relation" && field.relation.entity === identity) {
188
196
  out.push(`${def.name}.${field.name}`);
197
+ if (def.collection) {
198
+ const cols = declaredByCollection.get(def.collection) ?? [];
199
+ if (!cols.includes(field.name)) cols.push(field.name);
200
+ declaredByCollection.set(def.collection, cols);
201
+ }
189
202
  }
190
203
  }
191
204
  }
205
+ for (const def of defs) {
206
+ const cols = def.collection ? declaredByCollection.get(def.collection) : void 0;
207
+ if (!cols) continue;
208
+ for (const col of cols) {
209
+ const key = `${def.name}.${col}`;
210
+ if (out.includes(key)) continue;
211
+ if ((def.fields ?? []).some((f) => f.name === col)) out.push(key);
212
+ }
213
+ }
192
214
  return out;
193
215
  }
194
216
 
@@ -470,8 +492,10 @@ var ASSET_ASPECTS = ["1:1", "16:9", "5:7", "8:1"];
470
492
  var AssetAspectSchema = z.enum(ASSET_ASPECTS);
471
493
  var ANIMATION_NAMES = ["idle", "walk", "attack", "hit", "death"];
472
494
  var AnimationNameSchema = z.enum(ANIMATION_NAMES);
473
- var SPRITE_DIRECTIONS = ["se", "sw"];
495
+ var SPRITE_DIRECTIONS = ["se", "sw", "ne", "nw"];
474
496
  var SpriteDirectionSchema = z.enum(SPRITE_DIRECTIONS);
497
+ var SHEET_PROJECTIONS = ["iso", "front", "back", "top", "perspective"];
498
+ z.enum(SHEET_PROJECTIONS);
475
499
  var AnimationDefSchema = z.object({
476
500
  row: z.number().int().nonnegative(),
477
501
  frames: z.number().int().positive(),
@@ -487,7 +511,14 @@ z.object({
487
511
  rows: z.number().int().positive(),
488
512
  directions: z.array(SpriteDirectionSchema),
489
513
  sheets: z.record(SpriteDirectionSchema, z.string()),
490
- animations: z.record(AnimationNameSchema, AnimationDefSchema)
514
+ animations: z.record(AnimationNameSchema, AnimationDefSchema),
515
+ projections: z.object({
516
+ iso: z.record(SpriteDirectionSchema, z.string()).optional(),
517
+ front: z.string().optional(),
518
+ back: z.string().optional(),
519
+ top: z.string().optional(),
520
+ perspective: z.string().optional()
521
+ }).optional()
491
522
  });
492
523
  var SubTextureSchema = z.object({
493
524
  x: z.number().nonnegative(),
@@ -551,7 +582,8 @@ z.object({
551
582
  target: ScenePosSchema.optional(),
552
583
  zoom: z.number().optional(),
553
584
  fov: z.number().optional(),
554
- mode: CameraModeSchema.optional()
585
+ mode: CameraModeSchema.optional(),
586
+ azimuth: z.number().optional()
555
587
  });
556
588
  var SExprDataSchema = z.lazy(
557
589
  () => z.union([SExprAtomSchema, z.array(SExprDataSchema)])
@@ -694,7 +726,7 @@ function sampleDate(ctx, dateOnly) {
694
726
  const month = String(ctx.index % 12 + 1).padStart(2, "0");
695
727
  return dateOnly ? `2026-${month}-15` : `2026-${month}-15T00:00:00.000Z`;
696
728
  }
697
- const iso = randomRecentDate({ days: 30 }).toISOString();
729
+ const iso = randomStraddlingDate({ days: 15 }).toISOString();
698
730
  return dateOnly ? iso.split("T")[0] : iso;
699
731
  }
700
732
  function sampleRelation(field) {
@@ -809,6 +841,6 @@ function sampleRows(entity, count, strategy) {
809
841
  return rows;
810
842
  }
811
843
 
812
- export { IMAGE_FIELD_NAMES, entityAccessPolicies, entityAccessTable, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
844
+ export { IMAGE_FIELD_NAMES, entityAccessPolicies, entityAccessTable, identityEntityName, isDeclaredDefaultHonored, ownerFieldsFromSchema, randomAnytimeDate, randomArrayElement, randomBoolean, randomColor, randomEmail, randomFloat, randomInt, randomPassword, randomPastDate, randomPhone, randomRecentDate, randomSentence, randomStraddlingDate, randomUrl, randomUuid, randomWords, sampleFieldValue, sampleImageUrl, sampleRow, sampleRowCount, sampleRows, seedRandom, shuffleArray };
813
845
  //# sourceMappingURL=index.js.map
814
846
  //# sourceMappingURL=index.js.map