@jammysunshine/astrology-shared 1.0.1

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.
@@ -0,0 +1,455 @@
1
+ /**
2
+ * Example input structures for astrology services
3
+ * Standardized JSON schemas with real-world usage examples
4
+ */
5
+
6
+ const { generateRequestId } = require('../schemas');
7
+
8
+ /**
9
+ * WhatsApp Client Input Example
10
+ * For astrology queries via WhatsApp bot
11
+ */
12
+ const WHATSAPP_INPUT_EXAMPLE = {
13
+ requestId: generateRequestId(),
14
+ timestamp: new Date().toISOString(),
15
+
16
+ client: {
17
+ type: 'whatsapp',
18
+ version: '2.21.22.16',
19
+ sessionId: 'wa_123456789',
20
+ deviceId: 'iPhone12,2',
21
+ userAgent: 'WhatsApp/2.21.22.16 i'
22
+ },
23
+
24
+ birthData: {
25
+ date: '15/01/1990', // STRICT DD/MM/YYYY format only
26
+ time: '14:30', // STRICT HH:MM format only (24-hour)
27
+ place: 'Mumbai, India',
28
+ coordinates: {
29
+ latitude: 19.0760,
30
+ longitude: 72.8777
31
+ },
32
+ timezone: 'Asia/Kolkata'
33
+ },
34
+
35
+ parameters: {
36
+ ayanamsa: 'lahiri',
37
+ houseSystem: 'placidus',
38
+ zodiac: 'sidereal',
39
+ includeAspects: true,
40
+ includeHouses: true,
41
+ detailLevel: 'detailed',
42
+ language: 'hi'
43
+ },
44
+
45
+ context: {
46
+ preferences: {
47
+ units: 'metric',
48
+ dateFormat: 'dd/mm/yyyy',
49
+ timeFormat: '24h'
50
+ },
51
+ correlationId: 'wa_conv_123456',
52
+ location: {
53
+ ip: '192.168.1.100',
54
+ country: 'IN',
55
+ timezone: 'Asia/Kolkata'
56
+ }
57
+ }
58
+ };
59
+
60
+ /**
61
+ * iOS App Input Example
62
+ * For astrology queries via iOS mobile app
63
+ */
64
+ const IOS_INPUT_EXAMPLE = {
65
+ requestId: generateRequestId(),
66
+ timestamp: new Date().toISOString(),
67
+
68
+ client: {
69
+ type: 'ios',
70
+ version: '1.2.3',
71
+ sessionId: 'ios_app_987654321',
72
+ deviceId: 'iPhone13,4',
73
+ userAgent: 'AstroApp/1.2.3 (iPhone; iOS 15.4; Scale/3.00)'
74
+ },
75
+
76
+ birthData: {
77
+ date: '22/06/1985',
78
+ time: '09:15',
79
+ place: 'New Delhi, India',
80
+ coordinates: {
81
+ latitude: 28.6139,
82
+ longitude: 77.2090
83
+ },
84
+ timezone: 'Asia/Kolkata',
85
+ daylightSaving: false
86
+ },
87
+
88
+ parameters: {
89
+ ayanamsa: 'raman',
90
+ houseSystem: 'whole_sign',
91
+ zodiac: 'sidereal',
92
+ includeAspects: true,
93
+ includeHouses: true,
94
+ detailLevel: 'comprehensive',
95
+ language: 'en'
96
+ },
97
+
98
+ context: {
99
+ preferences: {
100
+ units: 'metric',
101
+ dateFormat: 'dd/mm/yyyy',
102
+ timeFormat: '24h'
103
+ },
104
+ correlationId: 'ios_session_abc123',
105
+ location: {
106
+ ip: '10.0.0.50',
107
+ country: 'IN',
108
+ timezone: 'Asia/Kolkata'
109
+ }
110
+ }
111
+ };
112
+
113
+ /**
114
+ * Android App Input Example
115
+ * For astrology queries via Android mobile app
116
+ */
117
+ const ANDROID_INPUT_EXAMPLE = {
118
+ requestId: generateRequestId(),
119
+ timestamp: new Date().toISOString(),
120
+
121
+ client: {
122
+ type: 'android',
123
+ version: '2.1.0',
124
+ sessionId: 'android_app_xyz789',
125
+ deviceId: 'SM-G998B',
126
+ userAgent: 'AstroApp/2.1.0 (Android 12; SM-G998B)'
127
+ },
128
+
129
+ birthData: {
130
+ date: '08/03/1992',
131
+ time: '16:45',
132
+ place: 'Bangalore, India',
133
+ coordinates: {
134
+ latitude: 12.9716,
135
+ longitude: 77.5946
136
+ },
137
+ timezone: 'Asia/Kolkata'
138
+ },
139
+
140
+ parameters: {
141
+ ayanamsa: 'krishnamurti',
142
+ houseSystem: 'equal',
143
+ zodiac: 'tropical',
144
+ includeAspects: true,
145
+ includeHouses: true,
146
+ detailLevel: 'basic',
147
+ language: 'en'
148
+ },
149
+
150
+ context: {
151
+ preferences: {
152
+ units: 'metric',
153
+ dateFormat: 'dd/mm/yyyy',
154
+ timeFormat: '12h'
155
+ },
156
+ correlationId: 'android_session_def456',
157
+ location: {
158
+ ip: '172.16.0.25',
159
+ country: 'IN',
160
+ timezone: 'Asia/Kolkata'
161
+ }
162
+ }
163
+ };
164
+
165
+ /**
166
+ * PWA Input Example
167
+ * For astrology queries via Progressive Web App
168
+ */
169
+ const PWA_INPUT_EXAMPLE = {
170
+ requestId: generateRequestId(),
171
+ timestamp: new Date().toISOString(),
172
+
173
+ client: {
174
+ type: 'pwa',
175
+ version: '1.0.5',
176
+ sessionId: 'pwa_session_ghi789',
177
+ deviceId: 'chrome_desktop_91.0.4472.124',
178
+ userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
179
+ },
180
+
181
+ birthData: {
182
+ date: '30/11/1978',
183
+ time: '23:10',
184
+ place: 'Chennai, India',
185
+ coordinates: {
186
+ latitude: 13.0827,
187
+ longitude: 80.2707
188
+ },
189
+ timezone: 'Asia/Kolkata'
190
+ },
191
+
192
+ parameters: {
193
+ ayanamsa: 'fagan_bradley',
194
+ houseSystem: 'koch',
195
+ zodiac: 'sidereal',
196
+ includeAspects: false,
197
+ includeHouses: true,
198
+ detailLevel: 'detailed',
199
+ language: 'ta'
200
+ },
201
+
202
+ context: {
203
+ preferences: {
204
+ units: 'metric',
205
+ dateFormat: 'dd/mm/yyyy',
206
+ timeFormat: '24h'
207
+ },
208
+ correlationId: 'pwa_session_jkl012',
209
+ location: {
210
+ ip: '203.0.113.1',
211
+ country: 'IN',
212
+ timezone: 'Asia/Kolkata'
213
+ }
214
+ }
215
+ };
216
+
217
+ /**
218
+ * Web App Input Example
219
+ * For astrology queries via web application
220
+ */
221
+ const WEB_INPUT_EXAMPLE = {
222
+ requestId: generateRequestId(),
223
+ timestamp: new Date().toISOString(),
224
+
225
+ client: {
226
+ type: 'web',
227
+ version: '3.0.1',
228
+ sessionId: 'web_session_mno345',
229
+ deviceId: 'firefox_desktop_89.0',
230
+ userAgent: 'Mozilla/5.0 (X11; Linux x86_64; rv:89.0) Gecko/20100101 Firefox/89.0'
231
+ },
232
+
233
+ birthData: {
234
+ date: '12/07/1989',
235
+ time: '07:20',
236
+ place: 'Hyderabad, India',
237
+ coordinates: {
238
+ latitude: 17.3850,
239
+ longitude: 78.4867
240
+ },
241
+ timezone: 'Asia/Kolkata'
242
+ },
243
+
244
+ parameters: {
245
+ ayanamsa: 'lahiri',
246
+ houseSystem: 'placidus',
247
+ zodiac: 'sidereal',
248
+ includeAspects: true,
249
+ includeHouses: true,
250
+ detailLevel: 'comprehensive',
251
+ language: 'te'
252
+ },
253
+
254
+ context: {
255
+ preferences: {
256
+ units: 'metric',
257
+ dateFormat: 'dd/mm/yyyy',
258
+ timeFormat: '24h'
259
+ },
260
+ correlationId: 'web_session_pqr678',
261
+ location: {
262
+ ip: '198.51.100.1',
263
+ country: 'IN',
264
+ timezone: 'Asia/Kolkata'
265
+ }
266
+ }
267
+ };
268
+
269
+ /**
270
+ * API Client Input Example
271
+ * For direct API integrations
272
+ */
273
+ const API_INPUT_EXAMPLE = {
274
+ requestId: generateRequestId(),
275
+ timestamp: new Date().toISOString(),
276
+
277
+ client: {
278
+ type: 'api',
279
+ version: '1.0.0',
280
+ sessionId: 'api_key_stu901',
281
+ deviceId: 'server_node_v16',
282
+ userAgent: 'AstrologyAPI/1.0.0 (Node.js 16.14.0)'
283
+ },
284
+
285
+ birthData: {
286
+ date: '05/09/1983',
287
+ time: '12:00',
288
+ place: 'Kolkata, India',
289
+ coordinates: {
290
+ latitude: 22.5726,
291
+ longitude: 88.3639
292
+ },
293
+ timezone: 'Asia/Kolkata'
294
+ },
295
+
296
+ parameters: {
297
+ ayanamsa: 'lahiri',
298
+ houseSystem: 'placidus',
299
+ zodiac: 'sidereal',
300
+ includeAspects: true,
301
+ includeHouses: true,
302
+ detailLevel: 'detailed',
303
+ language: 'en'
304
+ },
305
+
306
+ context: {
307
+ preferences: {
308
+ units: 'metric',
309
+ dateFormat: 'dd/mm/yyyy',
310
+ timeFormat: '24h'
311
+ },
312
+ correlationId: 'api_request_vwx234',
313
+ location: {
314
+ ip: '104.28.1.1',
315
+ country: 'IN',
316
+ timezone: 'Asia/Kolkata'
317
+ }
318
+ }
319
+ };
320
+
321
+ /**
322
+ * Legacy Compatibility Input Example
323
+ * Shows how old format inputs are automatically normalized
324
+ */
325
+ const LEGACY_COMPATIBILITY_EXAMPLE = {
326
+ // Old direct format (still supported)
327
+ birthDate: '15/01/1990',
328
+ birthTime: '14:30',
329
+ birthPlace: 'Mumbai, India',
330
+
331
+ // Optional legacy fields
332
+ clientType: 'whatsapp',
333
+ sessionId: 'wa_123456789',
334
+ language: 'hi',
335
+
336
+ // Gets automatically normalized to:
337
+ // {
338
+ // requestId: "auto-generated-uuid",
339
+ // timestamp: "current-iso-time",
340
+ // client: { type: "whatsapp", version: "1.0.0", sessionId: "wa_123456789" },
341
+ // birthData: { date: "15/01/1990", time: "14:30", place: "Mumbai, India" },
342
+ // parameters: { language: "hi", ...defaults },
343
+ // context: { correlationId: "wa_123456789" }
344
+ // }
345
+ };
346
+
347
+ /**
348
+ * Minimal Input Example
349
+ * Shows the absolute minimum required fields
350
+ */
351
+ const MINIMAL_INPUT_EXAMPLE = {
352
+ requestId: generateRequestId(),
353
+ timestamp: new Date().toISOString(),
354
+
355
+ client: {
356
+ type: 'api',
357
+ version: '1.0.0'
358
+ },
359
+
360
+ birthData: {
361
+ date: '15/01/1990',
362
+ time: '14:30',
363
+ place: 'Mumbai, India'
364
+ }
365
+
366
+ // Everything else uses sensible defaults
367
+ };
368
+
369
+ /**
370
+ * Advanced Input Example
371
+ * Shows all possible customization options
372
+ */
373
+ const ADVANCED_INPUT_EXAMPLE = {
374
+ requestId: generateRequestId(),
375
+ timestamp: new Date().toISOString(),
376
+
377
+ client: {
378
+ type: 'ios',
379
+ version: '2.0.0',
380
+ sessionId: 'ios_advanced_123',
381
+ deviceId: 'iPhone14,2',
382
+ userAgent: 'AdvancedAstroApp/2.0.0'
383
+ },
384
+
385
+ birthData: {
386
+ date: '15/01/1990',
387
+ time: '14:30',
388
+ place: 'Mumbai, India',
389
+ coordinates: {
390
+ latitude: 19.0760,
391
+ longitude: 72.8777
392
+ },
393
+ timezone: 'Asia/Kolkata',
394
+ daylightSaving: false
395
+ },
396
+
397
+ parameters: {
398
+ ayanamsa: 'lahiri',
399
+ houseSystem: 'placidus',
400
+ zodiac: 'sidereal',
401
+ includeAspects: true,
402
+ includeHouses: true,
403
+ detailLevel: 'comprehensive',
404
+ language: 'hi'
405
+ },
406
+
407
+ context: {
408
+ preferences: {
409
+ units: 'metric',
410
+ dateFormat: 'dd/mm/yyyy',
411
+ timeFormat: '24h'
412
+ },
413
+ correlationId: 'advanced_request_456',
414
+ location: {
415
+ ip: '192.168.1.1',
416
+ country: 'IN',
417
+ timezone: 'Asia/Kolkata'
418
+ }
419
+ },
420
+
421
+ // Future extensibility
422
+ extensions: {
423
+ customCalculation: 'vedic_progression',
424
+ experimentalFeatures: ['advanced_aspects', 'harmonic_analysis'],
425
+ userProfile: {
426
+ experience: 'advanced',
427
+ interests: ['spirituality', 'career']
428
+ }
429
+ }
430
+ };
431
+
432
+ module.exports = {
433
+ WHATSAPP_INPUT_EXAMPLE,
434
+ IOS_INPUT_EXAMPLE,
435
+ ANDROID_INPUT_EXAMPLE,
436
+ PWA_INPUT_EXAMPLE,
437
+ WEB_INPUT_EXAMPLE,
438
+ API_INPUT_EXAMPLE,
439
+ LEGACY_COMPATIBILITY_EXAMPLE,
440
+ MINIMAL_INPUT_EXAMPLE,
441
+ ADVANCED_INPUT_EXAMPLE,
442
+
443
+ // Helper to get example by client type
444
+ getExampleByClientType: (clientType) => {
445
+ const examples = {
446
+ whatsapp: WHATSAPP_INPUT_EXAMPLE,
447
+ ios: IOS_INPUT_EXAMPLE,
448
+ android: ANDROID_INPUT_EXAMPLE,
449
+ pwa: PWA_INPUT_EXAMPLE,
450
+ web: WEB_INPUT_EXAMPLE,
451
+ api: API_INPUT_EXAMPLE
452
+ };
453
+ return examples[clientType] || API_INPUT_EXAMPLE;
454
+ }
455
+ };