Repository navigation
Expand file tree
/
Copy pathrefresh-samples.ts
More file actions
1092 lines (1061 loc) · 31.2 KB
/
Copy pathrefresh-samples.ts
File metadata and controls
1092 lines (1061 loc) · 31.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bun
/**
* Captures one live response per component into apps/docs/sample-data.js via
* @roxyapi/sdk. The SDK is itself spec-derived, so request and response
* shapes track the OpenAPI spec.
*
* ROXY_API_KEY="..." bun run scripts/refresh-samples.ts
*
* Reads the key from env. Never writes it to disk.
*/
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { createRoxy } from '@roxyapi/sdk';
const API_KEY = process.env.ROXY_API_KEY;
if (!API_KEY) {
console.error('Set ROXY_API_KEY before running. Aborting.');
process.exit(1);
}
const roxy = createRoxy(API_KEY);
const API_BASE = 'https://roxyapi.com/api/v2';
/**
* Raw POST against prod for endpoints the pinned @roxyapi/sdk does not yet
* expose (Human Design, Forecast). Mirrors the SDK envelope so {@link run} can
* consume it identically. Drop this in favor of the typed SDK method once the
* SDK version that ships those namespaces clears the install age window.
*/
async function rawPost<T>(
path: string,
body: unknown,
): Promise<{ data?: T; error?: { code?: string; error?: string } }> {
const res = await fetch(`${API_BASE}/${path}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-Key': API_KEY! },
body: JSON.stringify(body),
});
const json = (await res.json()) as Record<string, unknown>;
if (!res.ok) {
return {
error: {
code: String(json.code ?? res.status),
error: String(json.error ?? res.statusText),
},
};
}
return { data: json as T };
}
async function geocode(query: string) {
const { data, error } = await roxy.location.searchCities({
query: { q: query },
});
if (error)
throw new Error(`geocode ${query} failed: ${error.code} ${error.error}`);
const city = data?.cities?.[0];
if (!city) throw new Error(`no city for ${query}`);
return {
latitude: city.latitude,
longitude: city.longitude,
timezone: city.timezone,
};
}
interface Result {
name: string;
data?: unknown;
error?: string;
}
async function run<T>(
name: string,
fn: () => Promise<{ data?: T; error?: { code?: string; error?: string } }>,
): Promise<Result> {
try {
const { data, error } = await fn();
if (error) {
return { name, error: `${error.code ?? '?'}: ${error.error ?? '?'}` };
}
return { name, data };
} catch (e) {
return { name, error: e instanceof Error ? e.message : String(e) };
}
}
async function main() {
console.log('Geocoding canonical cities...');
// Western cities on purpose: the demo is the lead surface, and the lead example
// is always a globally-accessible one. Keep these in sync with PERSON1/PERSON2
// in apps/docs/components-manifest.js, which hardcodes the same coordinates for
// the displayed code snippets.
const newYork = await geocode('New York');
const london = await geocode('London');
const losAngeles = await geocode('Los Angeles');
console.log(
` New York → ${newYork.latitude}, ${newYork.longitude}, ${newYork.timezone}`,
);
console.log(
` London → ${london.latitude}, ${london.longitude}, ${london.timezone}`,
);
console.log(
` Los Angeles → ${losAngeles.latitude}, ${losAngeles.longitude}, ${losAngeles.timezone}`,
);
const PERSON1 = { date: '1990-01-15', time: '14:30:00', ...newYork };
// One fixed almanac day, so the captured sample, the snippet beside it on the
// demo card and the preview image all describe the same day. Chosen because it
// carries BOTH lists: an almanac day can legitimately favour nothing and avoid
// nothing, and one of those renders the block this card is built around as an
// empty space nobody would notice was missing.
const ALMANAC_DAY = '2026-09-08';
const PERSON2 = { date: '1992-06-20', time: '09:15:00', ...london };
// An L-shaped plot on purpose. A rectangle leaves every square of the mandala
// inside the outline, so the out-of-plot fill and the legend entry that names
// it would render on no sample and stay unaudited.
const VASTU_PLOT = {
polygon: [
{ x: 0, y: 0 },
{ x: 60, y: 0 },
{ x: 60, y: 30 },
{ x: 30, y: 30 },
{ x: 30, y: 45 },
{ x: 0, y: 45 },
],
unit: 'feet' as const,
};
/**
* Shared body for all six Vimshottari levels. `significators` is off by default on the API, and it is the switch that also returns the `houseThemes` map, so without it the timeline renders bare house numbers and neither the significator line nor the house wording is ever exercised by the showcase or the audit.
*/
const DASHA_BODY = {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
significators: true,
};
console.log('\nFetching live samples via @roxyapi/sdk...');
const calls: Array<Promise<Result>> = [
run('natal', () =>
roxy.astrology.generateNatalChart({
body: { ...PERSON1, houseSystem: 'placidus' },
}),
),
run('western-planets', () =>
roxy.astrology.generateNatalChart({
body: { ...PERSON1, houseSystem: 'placidus' },
}),
),
run('horoscope', () =>
roxy.astrology.getDailyHoroscope({ path: { sign: 'aries' } }),
),
run('bazi', () =>
roxy.chineseAstrology.generateBaziChart({
body: {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
},
}),
),
run('luck-pillars', () =>
roxy.chineseAstrology.calculateLuckPillars({
body: {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
gender: 'male',
},
}),
),
run('zodiac-sign', () =>
roxy.chineseAstrology.calculateZodiacAnimal({
body: { date: PERSON1.date },
}),
),
run('zodiac-animal', () =>
roxy.chineseAstrology.getZodiacAnimal({ path: { id: 'horse' } }),
),
run('zodiac-daily', () =>
roxy.chineseAstrology.getDailyZodiacReading({ path: { id: 'horse' } }),
),
run('zodiac-compat', () =>
roxy.chineseAstrology.getZodiacCompatibility({
path: { sign1: 'horse', sign2: 'tiger' },
}),
),
run('almanac-day', () =>
roxy.chineseAstrology.getAlmanacDay({ path: { date: ALMANAC_DAY } }),
),
run('almanac-auspicious', () =>
roxy.chineseAstrology.lookupAuspiciousDays({
body: {
activity: 'wedding',
startDate: '2026-09-01',
endDate: '2026-10-31',
},
}),
),
run('kua', () =>
roxy.fengShui.calculateKuaNumber({
body: { date: PERSON1.date, gender: 'female' },
}),
),
run('mansions', () =>
roxy.fengShui.generateEightMansions({
body: { date: PERSON1.date, gender: 'female' },
}),
),
run('mayan-day', () =>
roxy.mesoamericanAstrology.calculateTzolkin({
body: { date: PERSON1.date },
}),
),
run('mayan-chart', () =>
roxy.mesoamericanAstrology.generateMayanChart({
body: { date: PERSON1.date },
}),
),
run('vastu-mandala', () =>
roxy.vastu.generateMandala({
body: { plot: VASTU_PLOT, grid: '81-pada' },
}),
),
run('vastu-entrance', () =>
roxy.vastu.calculateEntrancePada({
body: { plot: VASTU_PLOT, facing: 'East', doorPosition: 0.45 },
}),
),
// Two spellings and a lexicon match on one input, which is what makes the
// candidate-spelling block and the equal-value table render at all.
run('gematria', () =>
roxy.kabbalah.calculateGematria({
body: { text: 'Shalom', latinCiphers: true },
}),
),
run('dosha-constitution', () =>
roxy.ayurveda.calculateAyurvedicConstitution({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('flying-star', () =>
roxy.fengShui.generateFlyingStarChart({
body: { facingDegrees: 175, period: 9 },
}),
),
run('flying-star-annual', () =>
roxy.fengShui.getAnnualFlyingStars({ path: { year: 2026 } }),
),
run('horoscope-weekly', () =>
roxy.astrology.getWeeklyHoroscope({ path: { sign: 'aries' } }),
),
run('horoscope-monthly', () =>
roxy.astrology.getMonthlyHoroscope({ path: { sign: 'aries' } }),
),
// Yearly has no SDK method yet, so it goes through the raw GET.
run('horoscope-yearly', () =>
roxy.astrology.getYearlyHoroscope({ path: { sign: 'aries' } }),
),
run('synastry', () =>
roxy.astrology.calculateSynastry({
body: { person1: PERSON1, person2: PERSON2 },
}),
),
run('compat', () =>
roxy.astrology.calculateCompatibility({
body: { person1: PERSON1, person2: PERSON2 },
}),
),
run('moon', () => roxy.astrology.getCurrentMoonPhase()),
run('kundli', () =>
roxy.vedicAstrology.generateBirthChart({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
// `modernPlanets` and `avasthaInfo` default to FALSE on the API, and the planets
// table renders a row group and three columns that exist only when they are sent.
// A sample that omits them leaves those renderers permanently unaudited, since the
// audit can only see what the fixture contains.
run('vedic-planets', () =>
roxy.vedicAstrology.generateBirthChart({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
modernPlanets: true,
avasthaInfo: true,
},
}),
),
run('panchang', () =>
roxy.vedicAstrology.getDetailedPanchang({
body: {
date: '2026-05-09',
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('dasha', () =>
roxy.vedicAstrology.getMajorDashas({
body: DASHA_BODY,
}),
),
// Current and sub are separate render branches. Without their own samples the
// showcase and the audit never walk them, and sub is where the parent-mahadasha
// context and the level label live.
run('dasha-current', () =>
roxy.vedicAstrology.getCurrentDasha({
body: DASHA_BODY,
}),
),
run('dasha-sub', () =>
roxy.vedicAstrology.getSubDashas({
path: { mahadasha: 'Venus' },
body: DASHA_BODY,
}),
),
// The three deeper levels share the sub layout but carry a different parent
// shape and level label, so a shared sample would never exercise them.
run('dasha-antara', () =>
roxy.vedicAstrology.getPratyantardashas({
path: { mahadasha: 'Venus', antardasha: 'Saturn' },
body: DASHA_BODY,
}),
),
run('dasha-sookshma', () =>
roxy.vedicAstrology.getSookshmaDashas({
path: {
mahadasha: 'Venus',
antardasha: 'Saturn',
pratyantardasha: 'Mercury',
},
body: DASHA_BODY,
}),
),
run('dasha-prana', () =>
roxy.vedicAstrology.getPranaDashas({
path: {
mahadasha: 'Venus',
antardasha: 'Saturn',
pratyantardasha: 'Mercury',
sookshma: 'Ketu',
},
body: DASHA_BODY,
}),
),
run('dosha', () =>
roxy.vedicAstrology.checkManglikDosha({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('guna', () =>
roxy.vedicAstrology.calculateGunMilan({
body: { person1: PERSON1, person2: PERSON2 },
}),
),
run('kp', () =>
roxy.vedicAstrology.getKpPlanets({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('kp-chart', () =>
roxy.vedicAstrology.generateKpChart({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('kp-ruling', () =>
roxy.vedicAstrology.getKpRulingPlanets({
body: {
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
datetime: `${PERSON1.date}T${PERSON1.time}`,
birthDate: PERSON1.date,
birthTime: PERSON1.time,
},
}),
),
run('nakshatra', () =>
roxy.vedicAstrology.getNakshatra({ path: { id: 'ashwini' } }),
),
run('num', () =>
roxy.numerology.calculateLifePath({
body: { year: 1990, month: 1, day: 15 },
}),
),
// Chart mode is a different render branch from the single-number card, so it
// needs its own sample or the audit never walks it.
run('num-chart', () =>
roxy.numerology.generateNumerologyChart({
body: { fullName: 'Ada Lovelace', year: 1990, month: 1, day: 15 },
}),
),
run('tarot', () =>
roxy.tarot.getDailyCard({ body: { seed: 'roxy-ui-demo' } }),
),
// The reference card ships BOTH orientations (the daily draw ships only the
// drawn one), so it exercises the upright/reversed tablist.
run('tarot-reference', () => roxy.tarot.getCard({ path: { id: 'fool' } })),
run('spread-yesno', () =>
roxy.tarot.castYesNo({ body: { question: 'Should I take the offer?' } }),
),
run('spread', () =>
roxy.tarot.castThreeCard({
body: { question: 'What does my next chapter look like?' },
}),
),
run('tarot-catalog', () => roxy.tarot.listCards({ query: { limit: 12 } })),
run('bodygraph', () =>
rawPost('human-design/bodygraph', {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
}),
),
run('hd-type-card', () =>
rawPost('human-design/type', {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
}),
),
// The same card renders the profile response; a second sample so the
// showcase and the audit walk that branch too, not just the type branch.
run('hd-type-card-profile', () =>
rawPost('human-design/profile', {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
}),
),
run('hd-connection', () =>
rawPost('human-design/connection', {
personA: PERSON1,
personB: PERSON2,
}),
),
run('hd-penta', () =>
rawPost('human-design/penta', {
members: [
PERSON1,
PERSON2,
{ date: '1985-11-02', time: '06:45:00', ...losAngeles },
],
}),
),
run('hd-variables', () =>
rawPost('human-design/variables', {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
}),
),
run('aspects-table', () =>
rawPost('astrology/aspects', {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
}),
),
// A fixed transitDate/transitTime, not today's default: the bi-wheel and its
// committed previews have to render the same sky on every recapture, and the
// same pair is hardcoded in the demo card's sdkCall so the snippet
// reproduces the picture beside it.
// A fixed `date`, not today's default, so the card and its committed preview
// render the same day on every recapture.
run('vedic-daily', () =>
rawPost('vedic-astrology/daily', {
birthDate: PERSON1.date,
birthTime: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
date: '2026-02-03',
}),
),
// The same fixed day as the Vedic daily card, so the two Vedic day cards
// on the showcase read one sky and the committed preview is stable.
run('kp-finance-card', () =>
rawPost('vedic-astrology/kp/daily-finance', {
birthDate: PERSON1.date,
birthTime: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
date: '2026-02-03',
}),
),
run('transit-wheel', () =>
roxy.astrology.calculateTransitAspects({
body: {
natalChart: PERSON1,
transitDate: '2026-05-11',
transitTime: '12:00:00',
},
}),
),
run('astrocartography', () =>
rawPost('astrology/astrocartography', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
}),
),
run('local-space', () =>
rawPost('astrology/local-space', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
}),
),
run('relocation', () =>
rawPost('astrology/relocation-chart', {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
birthLatitude: PERSON1.latitude,
birthLongitude: PERSON1.longitude,
relocationLatitude: 40.7128,
relocationLongitude: -74.006,
}),
),
run('asteroids', () =>
rawPost('astrology/asteroids', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
}),
),
run('lilith', () =>
rawPost('astrology/lilith', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
}),
),
run('arabic-lots', () =>
rawPost('astrology/arabic-lots', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
}),
),
// A fixed year and month rather than the month in progress, which is what
// the API returns when both are omitted: the demo, the captured sample and
// the committed preview image all have to describe the same 31 days, and
// this month happens to carry a solar ingress, two Mercury ingresses, a
// mid-month Chiron station and four bodies retrograde throughout, so no
// render branch on the card is left without data. Keep in sync with
// EPHEMERIS_MONTH in apps/docs/components-manifest.js.
run('ephemeris', () =>
roxy.astrology.getMonthlyTropicalEphemeris({
body: { year: 2026, month: 8 },
}),
),
run('ephemeris-vedic', () =>
roxy.vedicAstrology.getMonthlyEphemeris({
body: { year: 2026, month: 8 },
}),
),
run('fixed-stars', () =>
rawPost('astrology/fixed-stars', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
}),
),
run('progressions', () =>
rawPost('astrology/progressions', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
targetDate: '2025-07-15',
}),
),
run('solar-arc', () =>
rawPost('astrology/solar-arc', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
targetDate: '2025-07-15',
}),
),
run('profections', () =>
rawPost('astrology/profections', {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
targetDate: '2025-07-15',
}),
),
run('vedic-aspects', () =>
rawPost('vedic-astrology/aspects', {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
}),
),
run('hora-table', () =>
rawPost('vedic-astrology/panchang/hora', {
date: '2026-06-19',
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
}),
),
run('forecast-digest', () =>
rawPost('forecast/digest', {
birthData: {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
},
startDate: '2026-06-19',
}),
),
run('crystal-card', () =>
roxy.crystals.getCrystal({ path: { id: 'amethyst' } }),
),
run('reference-card', () =>
roxy.astrology.getZodiacSign({ path: { id: 'aries' } }),
),
run('dream-search', () =>
roxy.dreams.searchDreamSymbols({ query: { q: 'water', limit: 12 } }),
),
run('forecast-timeline', () =>
rawPost('forecast/timeline', {
birthData: {
date: PERSON1.date,
time: PERSON1.time,
timezone: PERSON1.timezone,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
},
startDate: '2026-06-01',
endDate: '2026-06-21',
}),
),
run('bio', () =>
roxy.biorhythm.getDailyBiorhythm({ body: { seed: 'roxy-ui-demo' } }),
),
run('bio-forecast', () =>
roxy.biorhythm.getForecast({
body: {
birthDate: '1990-01-15',
startDate: '2026-07-01',
endDate: '2026-07-30',
},
}),
),
run('bio-critical', () =>
roxy.biorhythm.getCriticalDays({
body: {
birthDate: '1990-01-15',
startDate: '2026-07-01',
endDate: '2026-08-30',
},
}),
),
run('hex', () => roxy.iching.getRandomHexagram()),
run('transits', () =>
roxy.astrology.calculateTransits({
body: {
date: '2026-05-11',
time: '12:00:00',
natalChart: PERSON1,
},
}),
),
run('ashtakavarga', () =>
roxy.vedicAstrology.calculateAshtakavarga({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('shadbala', () =>
roxy.vedicAstrology.calculateShadbala({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('divisional', () =>
roxy.vedicAstrology.generateDivisionalChart({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
division: 9,
},
}),
),
run('yoga', () => roxy.vedicAstrology.listYogas()),
// Detect is a different render branch from the catalog: it is the one that
// carries a verdict per yoga, so without its own sample neither the showcase
// nor the audit ever walks the grouped view.
//
// This is the ONE card that does not use PERSON1, and the date is load-bearing
// rather than arbitrary. The card shows three verdict groups, and the third,
// a yoga that matched its own rule and was then outranked by a stronger
// family, only occurs on a chart where an Akriti yoga coincides with an
// Asraya or Sankhya one. PERSON1 is not such a chart, so on PERSON1 the group
// is empty and the whole outranked path renders nowhere. The demo card's own
// snippet passes this same date, so the code shown still produces the output
// shown.
run('yoga-detect', () =>
roxy.vedicAstrology.detectYogas({
body: {
date: '1941-04-26',
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
// The VEDIC transit: birth chart plus a transit instant, which is a different
// request from the western calculateTransits above. transitDate is pinned rather
// than "today" so the committed sample stays stable between recaptures; a moving
// date would rewrite every kaksha on every run and bury real diffs.
run('gochara', () =>
roxy.vedicAstrology.calculateTransit({
body: {
birthDate: PERSON1.date,
birthTime: PERSON1.time,
transitDate: '2026-02-03',
transitTime: '12:00:00',
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('bhava-bala', () =>
roxy.vedicAstrology.calculateBhavaBala({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('bhav-chalit', () =>
roxy.vedicAstrology.calculateBhavChalit({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('heliacal', () =>
roxy.vedicAstrology.getHeliacalVisibility({
body: {
date: PERSON1.date,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
run('upagraha', () =>
roxy.vedicAstrology.getUpagrahaPositions({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
// The scheme is echoed in the response and drives the card label, so the
// sample pins the eight-karaka default rather than leaving it implicit.
run('chara-karakas', () =>
roxy.vedicAstrology.calculateCharaKarakas({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
scheme: 'eight',
},
}),
),
run('arudha', () =>
roxy.vedicAstrology.calculateArudhaPadas({
body: {
date: PERSON1.date,
time: PERSON1.time,
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
// Dipta is the first Deeptadi state, so the reference card shows a record
// from the nine-fold system rather than the five-fold one the chart column
// already spells out.
run('reference-avastha', () =>
roxy.vedicAstrology.getAvastha({ path: { id: 'dipta' } }),
),
run('dream', () => roxy.dreams.getDreamSymbol({ path: { id: 'water' } })),
run('angel-card', () =>
roxy.angelNumbers.getAngelNumber({ path: { number: '111' } }),
),
// `context` must be supplied or the response carries no `contextNote`, and the
// component branch that renders it would never be audited.
run('angel-lookup', () =>
roxy.angelNumbers.analyzeNumberSequence({
query: { number: '1212', context: 'clock' },
}),
),
run('angel-lookup-unknown', () =>
roxy.angelNumbers.analyzeNumberSequence({ query: { number: '7841' } }),
),
run('crystals', () =>
roxy.crystals.getCrystalsByChakra({
path: { chakra: 'Heart' },
query: { limit: 8 },
}),
),
run('choghadiya', () =>
roxy.vedicAstrology.getChoghadiya({
body: {
date: '2026-05-11',
latitude: PERSON1.latitude,
longitude: PERSON1.longitude,
timezone: PERSON1.timezone,
},
}),
),
];
const results = await Promise.all(calls);
for (const r of results) {
if (r.name.startsWith('__')) continue;
const status = r.error ? `err: ${r.error}` : 'ok';
console.log(` ${r.name.padEnd(10)} → ${status}`);
}
const failed = results.filter((r) => r.error);
if (failed.length > 0) {
console.warn(`\n${failed.length} of ${results.length} endpoints failed:`);
for (const f of failed) console.warn(` ${f.name}: ${f.error}`);
}
const samples: Record<string, unknown> = {};
for (const r of results) {
if (r.error || r.name.startsWith('__')) continue;
samples[r.name] = r.data;
}
// The /vedic-astrology/yoga catalog returns 300+ entries. The demo page
// only needs enough to prove the search filter and chip grid render, so
// slice to the first 20. Real-world consumers pass the full response.
const yogaSample = samples.yoga as { yogas?: unknown[] } | undefined;
if (yogaSample?.yogas && yogaSample.yogas.length > 20) {
yogaSample.yogas = yogaSample.yogas.slice(0, 20);
}
console.log('\nMirroring inline image URLs locally...');
for (const key of Object.keys(samples)) {
samples[key] = await mirrorImages(samples[key]);
}
// Static sample, not fetched: shaped to exercise every generic-renderer
// path the audit must guard (float rounding, Yes/No booleans, ISO datetime,
// enum humanizing, links, full-width nested sections, and object arrays
// inside table cells).
samples.data = {
title: 'Compatibility breakdown',
summary:
'A typical RoxyAPI response shaped for the generic fallback renderer.',
score: 87.4638,
isRetrograde: false,
computedAt: '2026-07-15T07:20:22',
aspectType: 'SEMI_SQUARE',
docsUrl: 'https://roxyapi.com/docs',
ranges: ['low', 'medium', 'high'],
breakdown: [
{ name: 'Communication', score: 88.912834501, exact: true },
{ name: 'Trust', score: 84, exact: false },
{ name: 'Shared values', score: 92.05, exact: true },
],
chart: {
houseSystem: 'placidus',
planets: [
{ name: 'Sun', longitude: 113.01012227704928, sign: 'Cancer' },
{ name: 'Moon', longitude: 127.87157410804679, sign: 'Leo' },
],
},
days: [
{
date: '2026-07-01',
positions: [
{ planet: 'Sun', sign: 'Gemini', degreeInSign: 15.4638 },
{ planet: 'Moon', sign: 'Capricorn', degreeInSign: 1.9954 },
],
},
],
};
const out = `/**
* Sample data for every component, captured from live RoxyAPI responses by
* scripts/refresh-samples.ts via @roxyapi/sdk. Used by the preview server,
* Playwright e2e, and screenshots. Do not hand-edit; rerun the script to
* refresh.
*/
const samples = ${jsObjectLiteral(samples)};
for (const id of Object.keys(samples)) {