adaptic-backend 1.0.79 → 1.0.80

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.
Files changed (57) hide show
  1. package/Account.cjs +938 -0
  2. package/Action.cjs +3226 -0
  3. package/Alert.cjs +3544 -0
  4. package/AlpacaAccount.cjs +2615 -0
  5. package/Asset.cjs +3308 -0
  6. package/Authenticator.cjs +938 -0
  7. package/Customer.cjs +938 -0
  8. package/NewsArticle.cjs +801 -0
  9. package/NewsArticleAssetSentiment.cjs +831 -0
  10. package/Order.cjs +4344 -0
  11. package/Position.cjs +3672 -0
  12. package/Session.cjs +938 -0
  13. package/Trade.cjs +4352 -0
  14. package/User.cjs +2847 -0
  15. package/package.json +1 -1
  16. package/server/Account.d.ts.map +1 -1
  17. package/server/Account.js.map +1 -1
  18. package/server/Account.mjs +938 -0
  19. package/server/Action.d.ts.map +1 -1
  20. package/server/Action.js.map +1 -1
  21. package/server/Action.mjs +3226 -0
  22. package/server/Alert.d.ts.map +1 -1
  23. package/server/Alert.js.map +1 -1
  24. package/server/Alert.mjs +3544 -0
  25. package/server/AlpacaAccount.d.ts.map +1 -1
  26. package/server/AlpacaAccount.js.map +1 -1
  27. package/server/AlpacaAccount.mjs +2615 -0
  28. package/server/Asset.d.ts.map +1 -1
  29. package/server/Asset.js.map +1 -1
  30. package/server/Asset.mjs +3308 -0
  31. package/server/Authenticator.d.ts.map +1 -1
  32. package/server/Authenticator.js.map +1 -1
  33. package/server/Authenticator.mjs +938 -0
  34. package/server/Customer.d.ts.map +1 -1
  35. package/server/Customer.js.map +1 -1
  36. package/server/Customer.mjs +938 -0
  37. package/server/NewsArticle.d.ts.map +1 -1
  38. package/server/NewsArticle.js.map +1 -1
  39. package/server/NewsArticle.mjs +801 -0
  40. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  41. package/server/NewsArticleAssetSentiment.js.map +1 -1
  42. package/server/NewsArticleAssetSentiment.mjs +831 -0
  43. package/server/Order.d.ts.map +1 -1
  44. package/server/Order.js.map +1 -1
  45. package/server/Order.mjs +4344 -0
  46. package/server/Position.d.ts.map +1 -1
  47. package/server/Position.js.map +1 -1
  48. package/server/Position.mjs +3672 -0
  49. package/server/Session.d.ts.map +1 -1
  50. package/server/Session.js.map +1 -1
  51. package/server/Session.mjs +938 -0
  52. package/server/Trade.d.ts.map +1 -1
  53. package/server/Trade.js.map +1 -1
  54. package/server/Trade.mjs +4352 -0
  55. package/server/User.d.ts.map +1 -1
  56. package/server/User.js.map +1 -1
  57. package/server/User.mjs +2847 -0
package/Asset.cjs CHANGED
@@ -360,6 +360,107 @@ exports.Asset = {
360
360
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
361
361
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
362
362
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
363
+ user: item.alpacaAccount.user ?
364
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
365
+ ? { connect: {
366
+ id: item.alpacaAccount.user.id
367
+ }
368
+ }
369
+ : { connectOrCreate: {
370
+ where: {
371
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
372
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
373
+ name: item.alpacaAccount.user.name !== undefined ? {
374
+ equals: item.alpacaAccount.user.name
375
+ } : undefined,
376
+ },
377
+ create: {
378
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
379
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
380
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
381
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
382
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
383
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
384
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
385
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
386
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
387
+ },
388
+ }
389
+ } : undefined,
390
+ orders: item.alpacaAccount.orders ?
391
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
392
+ connect: item.alpacaAccount.orders.map((item) => ({
393
+ id: item.id
394
+ }))
395
+ }
396
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
397
+ where: {
398
+ id: item.id !== undefined ? item.id : undefined,
399
+ },
400
+ create: {
401
+ qty: item.qty !== undefined ? item.qty : undefined,
402
+ notional: item.notional !== undefined ? item.notional : undefined,
403
+ side: item.side !== undefined ? item.side : undefined,
404
+ type: item.type !== undefined ? item.type : undefined,
405
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
406
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
407
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
408
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
409
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
410
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
411
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
412
+ status: item.status !== undefined ? item.status : undefined,
413
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
414
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
415
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
416
+ fee: item.fee !== undefined ? item.fee : undefined,
417
+ },
418
+ }))
419
+ } : undefined,
420
+ positions: item.alpacaAccount.positions ?
421
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
422
+ connect: item.alpacaAccount.positions.map((item) => ({
423
+ id: item.id
424
+ }))
425
+ }
426
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
427
+ where: {
428
+ id: item.id !== undefined ? item.id : undefined,
429
+ },
430
+ create: {
431
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
432
+ qty: item.qty !== undefined ? item.qty : undefined,
433
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
434
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
435
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
436
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
437
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
438
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
439
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
440
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
441
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
442
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
443
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
444
+ },
445
+ }))
446
+ } : undefined,
447
+ alerts: item.alpacaAccount.alerts ?
448
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
449
+ connect: item.alpacaAccount.alerts.map((item) => ({
450
+ id: item.id
451
+ }))
452
+ }
453
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
454
+ where: {
455
+ id: item.id !== undefined ? item.id : undefined,
456
+ },
457
+ create: {
458
+ message: item.message !== undefined ? item.message : undefined,
459
+ type: item.type !== undefined ? item.type : undefined,
460
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
461
+ },
462
+ }))
463
+ } : undefined,
363
464
  },
364
465
  }
365
466
  } : undefined,
@@ -379,6 +480,36 @@ exports.Asset = {
379
480
  note: item.note !== undefined ? item.note : undefined,
380
481
  status: item.status !== undefined ? item.status : undefined,
381
482
  fee: item.fee !== undefined ? item.fee : undefined,
483
+ order: item.order ?
484
+ typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
485
+ ? { connect: {
486
+ id: item.order.id
487
+ }
488
+ }
489
+ : { connectOrCreate: {
490
+ where: {
491
+ id: item.order.id !== undefined ? item.order.id : undefined,
492
+ },
493
+ create: {
494
+ qty: item.order.qty !== undefined ? item.order.qty : undefined,
495
+ notional: item.order.notional !== undefined ? item.order.notional : undefined,
496
+ side: item.order.side !== undefined ? item.order.side : undefined,
497
+ type: item.order.type !== undefined ? item.order.type : undefined,
498
+ timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
499
+ limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
500
+ stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
501
+ trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
502
+ trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
503
+ extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
504
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
505
+ status: item.order.status !== undefined ? item.order.status : undefined,
506
+ submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
507
+ filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
508
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
509
+ fee: item.order.fee !== undefined ? item.order.fee : undefined,
510
+ },
511
+ }
512
+ } : undefined,
382
513
  },
383
514
  }))
384
515
  } : undefined,
@@ -428,6 +559,101 @@ exports.Asset = {
428
559
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
429
560
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
430
561
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
562
+ user: item.alpacaAccount.user ?
563
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
564
+ ? { connect: {
565
+ id: item.alpacaAccount.user.id
566
+ }
567
+ }
568
+ : { connectOrCreate: {
569
+ where: {
570
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
571
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
572
+ name: item.alpacaAccount.user.name !== undefined ? {
573
+ equals: item.alpacaAccount.user.name
574
+ } : undefined,
575
+ },
576
+ create: {
577
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
578
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
579
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
580
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
581
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
582
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
583
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
584
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
585
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
586
+ },
587
+ }
588
+ } : undefined,
589
+ trades: item.alpacaAccount.trades ?
590
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
591
+ connect: item.alpacaAccount.trades.map((item) => ({
592
+ id: item.id
593
+ }))
594
+ }
595
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
596
+ where: {
597
+ id: item.id !== undefined ? item.id : undefined,
598
+ },
599
+ create: {
600
+ qty: item.qty !== undefined ? item.qty : undefined,
601
+ price: item.price !== undefined ? item.price : undefined,
602
+ total: item.total !== undefined ? item.total : undefined,
603
+ signal: item.signal !== undefined ? item.signal : undefined,
604
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
605
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
606
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
607
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
608
+ status: item.status !== undefined ? item.status : undefined,
609
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
610
+ },
611
+ }))
612
+ } : undefined,
613
+ positions: item.alpacaAccount.positions ?
614
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
615
+ connect: item.alpacaAccount.positions.map((item) => ({
616
+ id: item.id
617
+ }))
618
+ }
619
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
620
+ where: {
621
+ id: item.id !== undefined ? item.id : undefined,
622
+ },
623
+ create: {
624
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
625
+ qty: item.qty !== undefined ? item.qty : undefined,
626
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
627
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
628
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
629
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
630
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
631
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
632
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
633
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
634
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
635
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
636
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
637
+ },
638
+ }))
639
+ } : undefined,
640
+ alerts: item.alpacaAccount.alerts ?
641
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
642
+ connect: item.alpacaAccount.alerts.map((item) => ({
643
+ id: item.id
644
+ }))
645
+ }
646
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
647
+ where: {
648
+ id: item.id !== undefined ? item.id : undefined,
649
+ },
650
+ create: {
651
+ message: item.message !== undefined ? item.message : undefined,
652
+ type: item.type !== undefined ? item.type : undefined,
653
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
654
+ },
655
+ }))
656
+ } : undefined,
431
657
  },
432
658
  }
433
659
  } : undefined,
@@ -447,6 +673,30 @@ exports.Asset = {
447
673
  note: item.action.note !== undefined ? item.action.note : undefined,
448
674
  status: item.action.status !== undefined ? item.action.status : undefined,
449
675
  fee: item.action.fee !== undefined ? item.action.fee : undefined,
676
+ trade: item.action.trade ?
677
+ typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
678
+ ? { connect: {
679
+ id: item.action.trade.id
680
+ }
681
+ }
682
+ : { connectOrCreate: {
683
+ where: {
684
+ id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
685
+ },
686
+ create: {
687
+ qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
688
+ price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
689
+ total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
690
+ signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
691
+ strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
692
+ analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
693
+ confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
694
+ timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
695
+ status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
696
+ optionContractType: item.action.trade.optionContractType !== undefined ? item.action.trade.optionContractType : undefined,
697
+ },
698
+ }
699
+ } : undefined,
450
700
  },
451
701
  }
452
702
  } : undefined,
@@ -493,6 +743,104 @@ exports.Asset = {
493
743
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
494
744
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
495
745
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
746
+ user: item.alpacaAccount.user ?
747
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
748
+ ? { connect: {
749
+ id: item.alpacaAccount.user.id
750
+ }
751
+ }
752
+ : { connectOrCreate: {
753
+ where: {
754
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
755
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
756
+ name: item.alpacaAccount.user.name !== undefined ? {
757
+ equals: item.alpacaAccount.user.name
758
+ } : undefined,
759
+ },
760
+ create: {
761
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
762
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
763
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
764
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
765
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
766
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
767
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
768
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
769
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
770
+ },
771
+ }
772
+ } : undefined,
773
+ trades: item.alpacaAccount.trades ?
774
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
775
+ connect: item.alpacaAccount.trades.map((item) => ({
776
+ id: item.id
777
+ }))
778
+ }
779
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
780
+ where: {
781
+ id: item.id !== undefined ? item.id : undefined,
782
+ },
783
+ create: {
784
+ qty: item.qty !== undefined ? item.qty : undefined,
785
+ price: item.price !== undefined ? item.price : undefined,
786
+ total: item.total !== undefined ? item.total : undefined,
787
+ signal: item.signal !== undefined ? item.signal : undefined,
788
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
789
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
790
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
791
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
792
+ status: item.status !== undefined ? item.status : undefined,
793
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
794
+ },
795
+ }))
796
+ } : undefined,
797
+ orders: item.alpacaAccount.orders ?
798
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
799
+ connect: item.alpacaAccount.orders.map((item) => ({
800
+ id: item.id
801
+ }))
802
+ }
803
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
804
+ where: {
805
+ id: item.id !== undefined ? item.id : undefined,
806
+ },
807
+ create: {
808
+ qty: item.qty !== undefined ? item.qty : undefined,
809
+ notional: item.notional !== undefined ? item.notional : undefined,
810
+ side: item.side !== undefined ? item.side : undefined,
811
+ type: item.type !== undefined ? item.type : undefined,
812
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
813
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
814
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
815
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
816
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
817
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
818
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
819
+ status: item.status !== undefined ? item.status : undefined,
820
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
821
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
822
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
823
+ fee: item.fee !== undefined ? item.fee : undefined,
824
+ },
825
+ }))
826
+ } : undefined,
827
+ alerts: item.alpacaAccount.alerts ?
828
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
829
+ connect: item.alpacaAccount.alerts.map((item) => ({
830
+ id: item.id
831
+ }))
832
+ }
833
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
834
+ where: {
835
+ id: item.id !== undefined ? item.id : undefined,
836
+ },
837
+ create: {
838
+ message: item.message !== undefined ? item.message : undefined,
839
+ type: item.type !== undefined ? item.type : undefined,
840
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
841
+ },
842
+ }))
843
+ } : undefined,
496
844
  },
497
845
  }
498
846
  } : undefined,
@@ -1160,6 +1508,234 @@ exports.Asset = {
1160
1508
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1161
1509
  set: item.alpacaAccount.marketOpen
1162
1510
  } : undefined,
1511
+ user: item.alpacaAccount.user ? {
1512
+ upsert: {
1513
+ where: {
1514
+ id: item.alpacaAccount.user.id !== undefined ? {
1515
+ equals: item.alpacaAccount.user.id
1516
+ } : undefined,
1517
+ name: item.alpacaAccount.user.name !== undefined ? {
1518
+ equals: item.alpacaAccount.user.name
1519
+ } : undefined,
1520
+ email: item.alpacaAccount.user.email !== undefined ? {
1521
+ equals: item.alpacaAccount.user.email
1522
+ } : undefined,
1523
+ },
1524
+ update: {
1525
+ id: item.alpacaAccount.user.id !== undefined ? {
1526
+ set: item.alpacaAccount.user.id
1527
+ } : undefined,
1528
+ name: item.alpacaAccount.user.name !== undefined ? {
1529
+ set: item.alpacaAccount.user.name
1530
+ } : undefined,
1531
+ email: item.alpacaAccount.user.email !== undefined ? {
1532
+ set: item.alpacaAccount.user.email
1533
+ } : undefined,
1534
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
1535
+ set: item.alpacaAccount.user.emailVerified
1536
+ } : undefined,
1537
+ image: item.alpacaAccount.user.image !== undefined ? {
1538
+ set: item.alpacaAccount.user.image
1539
+ } : undefined,
1540
+ role: item.alpacaAccount.user.role !== undefined ? {
1541
+ set: item.alpacaAccount.user.role
1542
+ } : undefined,
1543
+ bio: item.alpacaAccount.user.bio !== undefined ? {
1544
+ set: item.alpacaAccount.user.bio
1545
+ } : undefined,
1546
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
1547
+ set: item.alpacaAccount.user.jobTitle
1548
+ } : undefined,
1549
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
1550
+ set: item.alpacaAccount.user.currentAccount
1551
+ } : undefined,
1552
+ plan: item.alpacaAccount.user.plan !== undefined ? {
1553
+ set: item.alpacaAccount.user.plan
1554
+ } : undefined,
1555
+ },
1556
+ create: {
1557
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
1558
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
1559
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
1560
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
1561
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
1562
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
1563
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
1564
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
1565
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
1566
+ },
1567
+ }
1568
+ } : undefined,
1569
+ orders: item.alpacaAccount.orders ? {
1570
+ upsert: item.alpacaAccount.orders.map((item) => ({
1571
+ where: {
1572
+ id: item.id !== undefined ? item.id : undefined,
1573
+ },
1574
+ update: {
1575
+ id: item.id !== undefined ? {
1576
+ set: item.id
1577
+ } : undefined,
1578
+ qty: item.qty !== undefined ? {
1579
+ set: item.qty
1580
+ } : undefined,
1581
+ notional: item.notional !== undefined ? {
1582
+ set: item.notional
1583
+ } : undefined,
1584
+ side: item.side !== undefined ? {
1585
+ set: item.side
1586
+ } : undefined,
1587
+ type: item.type !== undefined ? {
1588
+ set: item.type
1589
+ } : undefined,
1590
+ timeInForce: item.timeInForce !== undefined ? {
1591
+ set: item.timeInForce
1592
+ } : undefined,
1593
+ limitPrice: item.limitPrice !== undefined ? {
1594
+ set: item.limitPrice
1595
+ } : undefined,
1596
+ stopPrice: item.stopPrice !== undefined ? {
1597
+ set: item.stopPrice
1598
+ } : undefined,
1599
+ trailPrice: item.trailPrice !== undefined ? {
1600
+ set: item.trailPrice
1601
+ } : undefined,
1602
+ trailPercent: item.trailPercent !== undefined ? {
1603
+ set: item.trailPercent
1604
+ } : undefined,
1605
+ extendedHours: item.extendedHours !== undefined ? {
1606
+ set: item.extendedHours
1607
+ } : undefined,
1608
+ clientOrderId: item.clientOrderId !== undefined ? {
1609
+ set: item.clientOrderId
1610
+ } : undefined,
1611
+ status: item.status !== undefined ? {
1612
+ set: item.status
1613
+ } : undefined,
1614
+ submittedAt: item.submittedAt !== undefined ? {
1615
+ set: item.submittedAt
1616
+ } : undefined,
1617
+ filledAt: item.filledAt !== undefined ? {
1618
+ set: item.filledAt
1619
+ } : undefined,
1620
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
1621
+ set: item.filledAvgPrice
1622
+ } : undefined,
1623
+ fee: item.fee !== undefined ? {
1624
+ set: item.fee
1625
+ } : undefined,
1626
+ },
1627
+ create: {
1628
+ qty: item.qty !== undefined ? item.qty : undefined,
1629
+ notional: item.notional !== undefined ? item.notional : undefined,
1630
+ side: item.side !== undefined ? item.side : undefined,
1631
+ type: item.type !== undefined ? item.type : undefined,
1632
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1633
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1634
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1635
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1636
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1637
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1638
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1639
+ status: item.status !== undefined ? item.status : undefined,
1640
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1641
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1642
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1643
+ fee: item.fee !== undefined ? item.fee : undefined,
1644
+ },
1645
+ }))
1646
+ } : undefined,
1647
+ positions: item.alpacaAccount.positions ? {
1648
+ upsert: item.alpacaAccount.positions.map((item) => ({
1649
+ where: {
1650
+ id: item.id !== undefined ? item.id : undefined,
1651
+ },
1652
+ update: {
1653
+ id: item.id !== undefined ? {
1654
+ set: item.id
1655
+ } : undefined,
1656
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
1657
+ set: item.averageEntryPrice
1658
+ } : undefined,
1659
+ qty: item.qty !== undefined ? {
1660
+ set: item.qty
1661
+ } : undefined,
1662
+ qtyAvailable: item.qtyAvailable !== undefined ? {
1663
+ set: item.qtyAvailable
1664
+ } : undefined,
1665
+ marketValue: item.marketValue !== undefined ? {
1666
+ set: item.marketValue
1667
+ } : undefined,
1668
+ costBasis: item.costBasis !== undefined ? {
1669
+ set: item.costBasis
1670
+ } : undefined,
1671
+ unrealizedPL: item.unrealizedPL !== undefined ? {
1672
+ set: item.unrealizedPL
1673
+ } : undefined,
1674
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
1675
+ set: item.unrealizedPLPC
1676
+ } : undefined,
1677
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
1678
+ set: item.unrealisedIntradayPL
1679
+ } : undefined,
1680
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
1681
+ set: item.unrealisedIntradayPLPC
1682
+ } : undefined,
1683
+ currentPrice: item.currentPrice !== undefined ? {
1684
+ set: item.currentPrice
1685
+ } : undefined,
1686
+ lastTradePrice: item.lastTradePrice !== undefined ? {
1687
+ set: item.lastTradePrice
1688
+ } : undefined,
1689
+ changeToday: item.changeToday !== undefined ? {
1690
+ set: item.changeToday
1691
+ } : undefined,
1692
+ assetMarginable: item.assetMarginable !== undefined ? {
1693
+ set: item.assetMarginable
1694
+ } : undefined,
1695
+ },
1696
+ create: {
1697
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1698
+ qty: item.qty !== undefined ? item.qty : undefined,
1699
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1700
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1701
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1702
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1703
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1704
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1705
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1706
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1707
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1708
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1709
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1710
+ },
1711
+ }))
1712
+ } : undefined,
1713
+ alerts: item.alpacaAccount.alerts ? {
1714
+ upsert: item.alpacaAccount.alerts.map((item) => ({
1715
+ where: {
1716
+ id: item.id !== undefined ? item.id : undefined,
1717
+ },
1718
+ update: {
1719
+ id: item.id !== undefined ? {
1720
+ set: item.id
1721
+ } : undefined,
1722
+ message: item.message !== undefined ? {
1723
+ set: item.message
1724
+ } : undefined,
1725
+ type: item.type !== undefined ? {
1726
+ set: item.type
1727
+ } : undefined,
1728
+ isRead: item.isRead !== undefined ? {
1729
+ set: item.isRead
1730
+ } : undefined,
1731
+ },
1732
+ create: {
1733
+ message: item.message !== undefined ? item.message : undefined,
1734
+ type: item.type !== undefined ? item.type : undefined,
1735
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
1736
+ },
1737
+ }))
1738
+ } : undefined,
1163
1739
  },
1164
1740
  create: {
1165
1741
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1167,6 +1743,107 @@ exports.Asset = {
1167
1743
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1168
1744
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1169
1745
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1746
+ user: item.alpacaAccount.user ?
1747
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
1748
+ ? { connect: {
1749
+ id: item.alpacaAccount.user.id
1750
+ }
1751
+ }
1752
+ : { connectOrCreate: {
1753
+ where: {
1754
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
1755
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
1756
+ name: item.alpacaAccount.user.name !== undefined ? {
1757
+ equals: item.alpacaAccount.user.name
1758
+ } : undefined,
1759
+ },
1760
+ create: {
1761
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
1762
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
1763
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
1764
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
1765
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
1766
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
1767
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
1768
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
1769
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
1770
+ },
1771
+ }
1772
+ } : undefined,
1773
+ orders: item.alpacaAccount.orders ?
1774
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1775
+ connect: item.alpacaAccount.orders.map((item) => ({
1776
+ id: item.id
1777
+ }))
1778
+ }
1779
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
1780
+ where: {
1781
+ id: item.id !== undefined ? item.id : undefined,
1782
+ },
1783
+ create: {
1784
+ qty: item.qty !== undefined ? item.qty : undefined,
1785
+ notional: item.notional !== undefined ? item.notional : undefined,
1786
+ side: item.side !== undefined ? item.side : undefined,
1787
+ type: item.type !== undefined ? item.type : undefined,
1788
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1789
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1790
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1791
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1792
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1793
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1794
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1795
+ status: item.status !== undefined ? item.status : undefined,
1796
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1797
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1798
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1799
+ fee: item.fee !== undefined ? item.fee : undefined,
1800
+ },
1801
+ }))
1802
+ } : undefined,
1803
+ positions: item.alpacaAccount.positions ?
1804
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1805
+ connect: item.alpacaAccount.positions.map((item) => ({
1806
+ id: item.id
1807
+ }))
1808
+ }
1809
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
1810
+ where: {
1811
+ id: item.id !== undefined ? item.id : undefined,
1812
+ },
1813
+ create: {
1814
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1815
+ qty: item.qty !== undefined ? item.qty : undefined,
1816
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1817
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1818
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1819
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1820
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1821
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1822
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1823
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1824
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1825
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1826
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1827
+ },
1828
+ }))
1829
+ } : undefined,
1830
+ alerts: item.alpacaAccount.alerts ?
1831
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1832
+ connect: item.alpacaAccount.alerts.map((item) => ({
1833
+ id: item.id
1834
+ }))
1835
+ }
1836
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
1837
+ where: {
1838
+ id: item.id !== undefined ? item.id : undefined,
1839
+ },
1840
+ create: {
1841
+ message: item.message !== undefined ? item.message : undefined,
1842
+ type: item.type !== undefined ? item.type : undefined,
1843
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
1844
+ },
1845
+ }))
1846
+ } : undefined,
1170
1847
  },
1171
1848
  }
1172
1849
  } : undefined,
@@ -1194,6 +1871,86 @@ exports.Asset = {
1194
1871
  fee: item.fee !== undefined ? {
1195
1872
  set: item.fee
1196
1873
  } : undefined,
1874
+ order: item.order ? {
1875
+ upsert: {
1876
+ where: {
1877
+ id: item.order.id !== undefined ? {
1878
+ equals: item.order.id
1879
+ } : undefined,
1880
+ },
1881
+ update: {
1882
+ id: item.order.id !== undefined ? {
1883
+ set: item.order.id
1884
+ } : undefined,
1885
+ qty: item.order.qty !== undefined ? {
1886
+ set: item.order.qty
1887
+ } : undefined,
1888
+ notional: item.order.notional !== undefined ? {
1889
+ set: item.order.notional
1890
+ } : undefined,
1891
+ side: item.order.side !== undefined ? {
1892
+ set: item.order.side
1893
+ } : undefined,
1894
+ type: item.order.type !== undefined ? {
1895
+ set: item.order.type
1896
+ } : undefined,
1897
+ timeInForce: item.order.timeInForce !== undefined ? {
1898
+ set: item.order.timeInForce
1899
+ } : undefined,
1900
+ limitPrice: item.order.limitPrice !== undefined ? {
1901
+ set: item.order.limitPrice
1902
+ } : undefined,
1903
+ stopPrice: item.order.stopPrice !== undefined ? {
1904
+ set: item.order.stopPrice
1905
+ } : undefined,
1906
+ trailPrice: item.order.trailPrice !== undefined ? {
1907
+ set: item.order.trailPrice
1908
+ } : undefined,
1909
+ trailPercent: item.order.trailPercent !== undefined ? {
1910
+ set: item.order.trailPercent
1911
+ } : undefined,
1912
+ extendedHours: item.order.extendedHours !== undefined ? {
1913
+ set: item.order.extendedHours
1914
+ } : undefined,
1915
+ clientOrderId: item.order.clientOrderId !== undefined ? {
1916
+ set: item.order.clientOrderId
1917
+ } : undefined,
1918
+ status: item.order.status !== undefined ? {
1919
+ set: item.order.status
1920
+ } : undefined,
1921
+ submittedAt: item.order.submittedAt !== undefined ? {
1922
+ set: item.order.submittedAt
1923
+ } : undefined,
1924
+ filledAt: item.order.filledAt !== undefined ? {
1925
+ set: item.order.filledAt
1926
+ } : undefined,
1927
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? {
1928
+ set: item.order.filledAvgPrice
1929
+ } : undefined,
1930
+ fee: item.order.fee !== undefined ? {
1931
+ set: item.order.fee
1932
+ } : undefined,
1933
+ },
1934
+ create: {
1935
+ qty: item.order.qty !== undefined ? item.order.qty : undefined,
1936
+ notional: item.order.notional !== undefined ? item.order.notional : undefined,
1937
+ side: item.order.side !== undefined ? item.order.side : undefined,
1938
+ type: item.order.type !== undefined ? item.order.type : undefined,
1939
+ timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
1940
+ limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
1941
+ stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
1942
+ trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
1943
+ trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
1944
+ extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
1945
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
1946
+ status: item.order.status !== undefined ? item.order.status : undefined,
1947
+ submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
1948
+ filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
1949
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
1950
+ fee: item.order.fee !== undefined ? item.order.fee : undefined,
1951
+ },
1952
+ }
1953
+ } : undefined,
1197
1954
  },
1198
1955
  create: {
1199
1956
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -1201,6 +1958,36 @@ exports.Asset = {
1201
1958
  note: item.note !== undefined ? item.note : undefined,
1202
1959
  status: item.status !== undefined ? item.status : undefined,
1203
1960
  fee: item.fee !== undefined ? item.fee : undefined,
1961
+ order: item.order ?
1962
+ typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
1963
+ ? { connect: {
1964
+ id: item.order.id
1965
+ }
1966
+ }
1967
+ : { connectOrCreate: {
1968
+ where: {
1969
+ id: item.order.id !== undefined ? item.order.id : undefined,
1970
+ },
1971
+ create: {
1972
+ qty: item.order.qty !== undefined ? item.order.qty : undefined,
1973
+ notional: item.order.notional !== undefined ? item.order.notional : undefined,
1974
+ side: item.order.side !== undefined ? item.order.side : undefined,
1975
+ type: item.order.type !== undefined ? item.order.type : undefined,
1976
+ timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
1977
+ limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
1978
+ stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
1979
+ trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
1980
+ trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
1981
+ extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
1982
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
1983
+ status: item.order.status !== undefined ? item.order.status : undefined,
1984
+ submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
1985
+ filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
1986
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
1987
+ fee: item.order.fee !== undefined ? item.order.fee : undefined,
1988
+ },
1989
+ }
1990
+ } : undefined,
1204
1991
  },
1205
1992
  }))
1206
1993
  } : undefined,
@@ -1232,6 +2019,107 @@ exports.Asset = {
1232
2019
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1233
2020
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1234
2021
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2022
+ user: item.alpacaAccount.user ?
2023
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
2024
+ ? { connect: {
2025
+ id: item.alpacaAccount.user.id
2026
+ }
2027
+ }
2028
+ : { connectOrCreate: {
2029
+ where: {
2030
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
2031
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2032
+ name: item.alpacaAccount.user.name !== undefined ? {
2033
+ equals: item.alpacaAccount.user.name
2034
+ } : undefined,
2035
+ },
2036
+ create: {
2037
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
2038
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2039
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
2040
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
2041
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
2042
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
2043
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
2044
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
2045
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
2046
+ },
2047
+ }
2048
+ } : undefined,
2049
+ orders: item.alpacaAccount.orders ?
2050
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2051
+ connect: item.alpacaAccount.orders.map((item) => ({
2052
+ id: item.id
2053
+ }))
2054
+ }
2055
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
2056
+ where: {
2057
+ id: item.id !== undefined ? item.id : undefined,
2058
+ },
2059
+ create: {
2060
+ qty: item.qty !== undefined ? item.qty : undefined,
2061
+ notional: item.notional !== undefined ? item.notional : undefined,
2062
+ side: item.side !== undefined ? item.side : undefined,
2063
+ type: item.type !== undefined ? item.type : undefined,
2064
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
2065
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
2066
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
2067
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
2068
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
2069
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
2070
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2071
+ status: item.status !== undefined ? item.status : undefined,
2072
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
2073
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2074
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2075
+ fee: item.fee !== undefined ? item.fee : undefined,
2076
+ },
2077
+ }))
2078
+ } : undefined,
2079
+ positions: item.alpacaAccount.positions ?
2080
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2081
+ connect: item.alpacaAccount.positions.map((item) => ({
2082
+ id: item.id
2083
+ }))
2084
+ }
2085
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
2086
+ where: {
2087
+ id: item.id !== undefined ? item.id : undefined,
2088
+ },
2089
+ create: {
2090
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2091
+ qty: item.qty !== undefined ? item.qty : undefined,
2092
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2093
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2094
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2095
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2096
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2097
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2098
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2099
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2100
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2101
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2102
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2103
+ },
2104
+ }))
2105
+ } : undefined,
2106
+ alerts: item.alpacaAccount.alerts ?
2107
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2108
+ connect: item.alpacaAccount.alerts.map((item) => ({
2109
+ id: item.id
2110
+ }))
2111
+ }
2112
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
2113
+ where: {
2114
+ id: item.id !== undefined ? item.id : undefined,
2115
+ },
2116
+ create: {
2117
+ message: item.message !== undefined ? item.message : undefined,
2118
+ type: item.type !== undefined ? item.type : undefined,
2119
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
2120
+ },
2121
+ }))
2122
+ } : undefined,
1235
2123
  },
1236
2124
  }
1237
2125
  } : undefined,
@@ -1251,6 +2139,36 @@ exports.Asset = {
1251
2139
  note: item.note !== undefined ? item.note : undefined,
1252
2140
  status: item.status !== undefined ? item.status : undefined,
1253
2141
  fee: item.fee !== undefined ? item.fee : undefined,
2142
+ order: item.order ?
2143
+ typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
2144
+ ? { connect: {
2145
+ id: item.order.id
2146
+ }
2147
+ }
2148
+ : { connectOrCreate: {
2149
+ where: {
2150
+ id: item.order.id !== undefined ? item.order.id : undefined,
2151
+ },
2152
+ create: {
2153
+ qty: item.order.qty !== undefined ? item.order.qty : undefined,
2154
+ notional: item.order.notional !== undefined ? item.order.notional : undefined,
2155
+ side: item.order.side !== undefined ? item.order.side : undefined,
2156
+ type: item.order.type !== undefined ? item.order.type : undefined,
2157
+ timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
2158
+ limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
2159
+ stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
2160
+ trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
2161
+ trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
2162
+ extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
2163
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
2164
+ status: item.order.status !== undefined ? item.order.status : undefined,
2165
+ submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
2166
+ filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
2167
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
2168
+ fee: item.order.fee !== undefined ? item.order.fee : undefined,
2169
+ },
2170
+ }
2171
+ } : undefined,
1254
2172
  },
1255
2173
  }))
1256
2174
  } : undefined,
@@ -1340,6 +2258,210 @@ exports.Asset = {
1340
2258
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1341
2259
  set: item.alpacaAccount.marketOpen
1342
2260
  } : undefined,
2261
+ user: item.alpacaAccount.user ? {
2262
+ upsert: {
2263
+ where: {
2264
+ id: item.alpacaAccount.user.id !== undefined ? {
2265
+ equals: item.alpacaAccount.user.id
2266
+ } : undefined,
2267
+ name: item.alpacaAccount.user.name !== undefined ? {
2268
+ equals: item.alpacaAccount.user.name
2269
+ } : undefined,
2270
+ email: item.alpacaAccount.user.email !== undefined ? {
2271
+ equals: item.alpacaAccount.user.email
2272
+ } : undefined,
2273
+ },
2274
+ update: {
2275
+ id: item.alpacaAccount.user.id !== undefined ? {
2276
+ set: item.alpacaAccount.user.id
2277
+ } : undefined,
2278
+ name: item.alpacaAccount.user.name !== undefined ? {
2279
+ set: item.alpacaAccount.user.name
2280
+ } : undefined,
2281
+ email: item.alpacaAccount.user.email !== undefined ? {
2282
+ set: item.alpacaAccount.user.email
2283
+ } : undefined,
2284
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
2285
+ set: item.alpacaAccount.user.emailVerified
2286
+ } : undefined,
2287
+ image: item.alpacaAccount.user.image !== undefined ? {
2288
+ set: item.alpacaAccount.user.image
2289
+ } : undefined,
2290
+ role: item.alpacaAccount.user.role !== undefined ? {
2291
+ set: item.alpacaAccount.user.role
2292
+ } : undefined,
2293
+ bio: item.alpacaAccount.user.bio !== undefined ? {
2294
+ set: item.alpacaAccount.user.bio
2295
+ } : undefined,
2296
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
2297
+ set: item.alpacaAccount.user.jobTitle
2298
+ } : undefined,
2299
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
2300
+ set: item.alpacaAccount.user.currentAccount
2301
+ } : undefined,
2302
+ plan: item.alpacaAccount.user.plan !== undefined ? {
2303
+ set: item.alpacaAccount.user.plan
2304
+ } : undefined,
2305
+ },
2306
+ create: {
2307
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
2308
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2309
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
2310
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
2311
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
2312
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
2313
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
2314
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
2315
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
2316
+ },
2317
+ }
2318
+ } : undefined,
2319
+ trades: item.alpacaAccount.trades ? {
2320
+ upsert: item.alpacaAccount.trades.map((item) => ({
2321
+ where: {
2322
+ id: item.id !== undefined ? item.id : undefined,
2323
+ },
2324
+ update: {
2325
+ id: item.id !== undefined ? {
2326
+ set: item.id
2327
+ } : undefined,
2328
+ qty: item.qty !== undefined ? {
2329
+ set: item.qty
2330
+ } : undefined,
2331
+ price: item.price !== undefined ? {
2332
+ set: item.price
2333
+ } : undefined,
2334
+ total: item.total !== undefined ? {
2335
+ set: item.total
2336
+ } : undefined,
2337
+ signal: item.signal !== undefined ? {
2338
+ set: item.signal
2339
+ } : undefined,
2340
+ strategy: item.strategy !== undefined ? {
2341
+ set: item.strategy
2342
+ } : undefined,
2343
+ analysis: item.analysis !== undefined ? {
2344
+ set: item.analysis
2345
+ } : undefined,
2346
+ confidence: item.confidence !== undefined ? {
2347
+ set: item.confidence
2348
+ } : undefined,
2349
+ timestamp: item.timestamp !== undefined ? {
2350
+ set: item.timestamp
2351
+ } : undefined,
2352
+ status: item.status !== undefined ? {
2353
+ set: item.status
2354
+ } : undefined,
2355
+ optionContractType: item.optionContractType !== undefined ? {
2356
+ set: item.optionContractType
2357
+ } : undefined,
2358
+ },
2359
+ create: {
2360
+ qty: item.qty !== undefined ? item.qty : undefined,
2361
+ price: item.price !== undefined ? item.price : undefined,
2362
+ total: item.total !== undefined ? item.total : undefined,
2363
+ signal: item.signal !== undefined ? item.signal : undefined,
2364
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
2365
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
2366
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
2367
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2368
+ status: item.status !== undefined ? item.status : undefined,
2369
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2370
+ },
2371
+ }))
2372
+ } : undefined,
2373
+ positions: item.alpacaAccount.positions ? {
2374
+ upsert: item.alpacaAccount.positions.map((item) => ({
2375
+ where: {
2376
+ id: item.id !== undefined ? item.id : undefined,
2377
+ },
2378
+ update: {
2379
+ id: item.id !== undefined ? {
2380
+ set: item.id
2381
+ } : undefined,
2382
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
2383
+ set: item.averageEntryPrice
2384
+ } : undefined,
2385
+ qty: item.qty !== undefined ? {
2386
+ set: item.qty
2387
+ } : undefined,
2388
+ qtyAvailable: item.qtyAvailable !== undefined ? {
2389
+ set: item.qtyAvailable
2390
+ } : undefined,
2391
+ marketValue: item.marketValue !== undefined ? {
2392
+ set: item.marketValue
2393
+ } : undefined,
2394
+ costBasis: item.costBasis !== undefined ? {
2395
+ set: item.costBasis
2396
+ } : undefined,
2397
+ unrealizedPL: item.unrealizedPL !== undefined ? {
2398
+ set: item.unrealizedPL
2399
+ } : undefined,
2400
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
2401
+ set: item.unrealizedPLPC
2402
+ } : undefined,
2403
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
2404
+ set: item.unrealisedIntradayPL
2405
+ } : undefined,
2406
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
2407
+ set: item.unrealisedIntradayPLPC
2408
+ } : undefined,
2409
+ currentPrice: item.currentPrice !== undefined ? {
2410
+ set: item.currentPrice
2411
+ } : undefined,
2412
+ lastTradePrice: item.lastTradePrice !== undefined ? {
2413
+ set: item.lastTradePrice
2414
+ } : undefined,
2415
+ changeToday: item.changeToday !== undefined ? {
2416
+ set: item.changeToday
2417
+ } : undefined,
2418
+ assetMarginable: item.assetMarginable !== undefined ? {
2419
+ set: item.assetMarginable
2420
+ } : undefined,
2421
+ },
2422
+ create: {
2423
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2424
+ qty: item.qty !== undefined ? item.qty : undefined,
2425
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2426
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2427
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2428
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2429
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2430
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2431
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2432
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2433
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2434
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2435
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2436
+ },
2437
+ }))
2438
+ } : undefined,
2439
+ alerts: item.alpacaAccount.alerts ? {
2440
+ upsert: item.alpacaAccount.alerts.map((item) => ({
2441
+ where: {
2442
+ id: item.id !== undefined ? item.id : undefined,
2443
+ },
2444
+ update: {
2445
+ id: item.id !== undefined ? {
2446
+ set: item.id
2447
+ } : undefined,
2448
+ message: item.message !== undefined ? {
2449
+ set: item.message
2450
+ } : undefined,
2451
+ type: item.type !== undefined ? {
2452
+ set: item.type
2453
+ } : undefined,
2454
+ isRead: item.isRead !== undefined ? {
2455
+ set: item.isRead
2456
+ } : undefined,
2457
+ },
2458
+ create: {
2459
+ message: item.message !== undefined ? item.message : undefined,
2460
+ type: item.type !== undefined ? item.type : undefined,
2461
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
2462
+ },
2463
+ }))
2464
+ } : undefined,
1343
2465
  },
1344
2466
  create: {
1345
2467
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1347,6 +2469,101 @@ exports.Asset = {
1347
2469
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1348
2470
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1349
2471
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2472
+ user: item.alpacaAccount.user ?
2473
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
2474
+ ? { connect: {
2475
+ id: item.alpacaAccount.user.id
2476
+ }
2477
+ }
2478
+ : { connectOrCreate: {
2479
+ where: {
2480
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
2481
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2482
+ name: item.alpacaAccount.user.name !== undefined ? {
2483
+ equals: item.alpacaAccount.user.name
2484
+ } : undefined,
2485
+ },
2486
+ create: {
2487
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
2488
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2489
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
2490
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
2491
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
2492
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
2493
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
2494
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
2495
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
2496
+ },
2497
+ }
2498
+ } : undefined,
2499
+ trades: item.alpacaAccount.trades ?
2500
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2501
+ connect: item.alpacaAccount.trades.map((item) => ({
2502
+ id: item.id
2503
+ }))
2504
+ }
2505
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
2506
+ where: {
2507
+ id: item.id !== undefined ? item.id : undefined,
2508
+ },
2509
+ create: {
2510
+ qty: item.qty !== undefined ? item.qty : undefined,
2511
+ price: item.price !== undefined ? item.price : undefined,
2512
+ total: item.total !== undefined ? item.total : undefined,
2513
+ signal: item.signal !== undefined ? item.signal : undefined,
2514
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
2515
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
2516
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
2517
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2518
+ status: item.status !== undefined ? item.status : undefined,
2519
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2520
+ },
2521
+ }))
2522
+ } : undefined,
2523
+ positions: item.alpacaAccount.positions ?
2524
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2525
+ connect: item.alpacaAccount.positions.map((item) => ({
2526
+ id: item.id
2527
+ }))
2528
+ }
2529
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
2530
+ where: {
2531
+ id: item.id !== undefined ? item.id : undefined,
2532
+ },
2533
+ create: {
2534
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2535
+ qty: item.qty !== undefined ? item.qty : undefined,
2536
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2537
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2538
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2539
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2540
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2541
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2542
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2543
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2544
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2545
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2546
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2547
+ },
2548
+ }))
2549
+ } : undefined,
2550
+ alerts: item.alpacaAccount.alerts ?
2551
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2552
+ connect: item.alpacaAccount.alerts.map((item) => ({
2553
+ id: item.id
2554
+ }))
2555
+ }
2556
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
2557
+ where: {
2558
+ id: item.id !== undefined ? item.id : undefined,
2559
+ },
2560
+ create: {
2561
+ message: item.message !== undefined ? item.message : undefined,
2562
+ type: item.type !== undefined ? item.type : undefined,
2563
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
2564
+ },
2565
+ }))
2566
+ } : undefined,
1350
2567
  },
1351
2568
  }
1352
2569
  } : undefined,
@@ -1376,6 +2593,62 @@ exports.Asset = {
1376
2593
  fee: item.action.fee !== undefined ? {
1377
2594
  set: item.action.fee
1378
2595
  } : undefined,
2596
+ trade: item.action.trade ? {
2597
+ upsert: {
2598
+ where: {
2599
+ id: item.action.trade.id !== undefined ? {
2600
+ equals: item.action.trade.id
2601
+ } : undefined,
2602
+ },
2603
+ update: {
2604
+ id: item.action.trade.id !== undefined ? {
2605
+ set: item.action.trade.id
2606
+ } : undefined,
2607
+ qty: item.action.trade.qty !== undefined ? {
2608
+ set: item.action.trade.qty
2609
+ } : undefined,
2610
+ price: item.action.trade.price !== undefined ? {
2611
+ set: item.action.trade.price
2612
+ } : undefined,
2613
+ total: item.action.trade.total !== undefined ? {
2614
+ set: item.action.trade.total
2615
+ } : undefined,
2616
+ signal: item.action.trade.signal !== undefined ? {
2617
+ set: item.action.trade.signal
2618
+ } : undefined,
2619
+ strategy: item.action.trade.strategy !== undefined ? {
2620
+ set: item.action.trade.strategy
2621
+ } : undefined,
2622
+ analysis: item.action.trade.analysis !== undefined ? {
2623
+ set: item.action.trade.analysis
2624
+ } : undefined,
2625
+ confidence: item.action.trade.confidence !== undefined ? {
2626
+ set: item.action.trade.confidence
2627
+ } : undefined,
2628
+ timestamp: item.action.trade.timestamp !== undefined ? {
2629
+ set: item.action.trade.timestamp
2630
+ } : undefined,
2631
+ status: item.action.trade.status !== undefined ? {
2632
+ set: item.action.trade.status
2633
+ } : undefined,
2634
+ optionContractType: item.action.trade.optionContractType !== undefined ? {
2635
+ set: item.action.trade.optionContractType
2636
+ } : undefined,
2637
+ },
2638
+ create: {
2639
+ qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
2640
+ price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
2641
+ total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
2642
+ signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
2643
+ strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
2644
+ analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
2645
+ confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
2646
+ timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
2647
+ status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
2648
+ optionContractType: item.action.trade.optionContractType !== undefined ? item.action.trade.optionContractType : undefined,
2649
+ },
2650
+ }
2651
+ } : undefined,
1379
2652
  },
1380
2653
  create: {
1381
2654
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -1383,6 +2656,30 @@ exports.Asset = {
1383
2656
  note: item.action.note !== undefined ? item.action.note : undefined,
1384
2657
  status: item.action.status !== undefined ? item.action.status : undefined,
1385
2658
  fee: item.action.fee !== undefined ? item.action.fee : undefined,
2659
+ trade: item.action.trade ?
2660
+ typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
2661
+ ? { connect: {
2662
+ id: item.action.trade.id
2663
+ }
2664
+ }
2665
+ : { connectOrCreate: {
2666
+ where: {
2667
+ id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
2668
+ },
2669
+ create: {
2670
+ qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
2671
+ price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
2672
+ total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
2673
+ signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
2674
+ strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
2675
+ analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
2676
+ confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
2677
+ timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
2678
+ status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
2679
+ optionContractType: item.action.trade.optionContractType !== undefined ? item.action.trade.optionContractType : undefined,
2680
+ },
2681
+ }
2682
+ } : undefined,
1386
2683
  },
1387
2684
  }
1388
2685
  } : undefined,
@@ -1420,6 +2717,101 @@ exports.Asset = {
1420
2717
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1421
2718
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1422
2719
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2720
+ user: item.alpacaAccount.user ?
2721
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
2722
+ ? { connect: {
2723
+ id: item.alpacaAccount.user.id
2724
+ }
2725
+ }
2726
+ : { connectOrCreate: {
2727
+ where: {
2728
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
2729
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2730
+ name: item.alpacaAccount.user.name !== undefined ? {
2731
+ equals: item.alpacaAccount.user.name
2732
+ } : undefined,
2733
+ },
2734
+ create: {
2735
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
2736
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2737
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
2738
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
2739
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
2740
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
2741
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
2742
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
2743
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
2744
+ },
2745
+ }
2746
+ } : undefined,
2747
+ trades: item.alpacaAccount.trades ?
2748
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2749
+ connect: item.alpacaAccount.trades.map((item) => ({
2750
+ id: item.id
2751
+ }))
2752
+ }
2753
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
2754
+ where: {
2755
+ id: item.id !== undefined ? item.id : undefined,
2756
+ },
2757
+ create: {
2758
+ qty: item.qty !== undefined ? item.qty : undefined,
2759
+ price: item.price !== undefined ? item.price : undefined,
2760
+ total: item.total !== undefined ? item.total : undefined,
2761
+ signal: item.signal !== undefined ? item.signal : undefined,
2762
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
2763
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
2764
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
2765
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2766
+ status: item.status !== undefined ? item.status : undefined,
2767
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2768
+ },
2769
+ }))
2770
+ } : undefined,
2771
+ positions: item.alpacaAccount.positions ?
2772
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2773
+ connect: item.alpacaAccount.positions.map((item) => ({
2774
+ id: item.id
2775
+ }))
2776
+ }
2777
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
2778
+ where: {
2779
+ id: item.id !== undefined ? item.id : undefined,
2780
+ },
2781
+ create: {
2782
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2783
+ qty: item.qty !== undefined ? item.qty : undefined,
2784
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2785
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2786
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2787
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2788
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2789
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2790
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2791
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2792
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2793
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2794
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2795
+ },
2796
+ }))
2797
+ } : undefined,
2798
+ alerts: item.alpacaAccount.alerts ?
2799
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2800
+ connect: item.alpacaAccount.alerts.map((item) => ({
2801
+ id: item.id
2802
+ }))
2803
+ }
2804
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
2805
+ where: {
2806
+ id: item.id !== undefined ? item.id : undefined,
2807
+ },
2808
+ create: {
2809
+ message: item.message !== undefined ? item.message : undefined,
2810
+ type: item.type !== undefined ? item.type : undefined,
2811
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
2812
+ },
2813
+ }))
2814
+ } : undefined,
1423
2815
  },
1424
2816
  }
1425
2817
  } : undefined,
@@ -1439,6 +2831,30 @@ exports.Asset = {
1439
2831
  note: item.action.note !== undefined ? item.action.note : undefined,
1440
2832
  status: item.action.status !== undefined ? item.action.status : undefined,
1441
2833
  fee: item.action.fee !== undefined ? item.action.fee : undefined,
2834
+ trade: item.action.trade ?
2835
+ typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
2836
+ ? { connect: {
2837
+ id: item.action.trade.id
2838
+ }
2839
+ }
2840
+ : { connectOrCreate: {
2841
+ where: {
2842
+ id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
2843
+ },
2844
+ create: {
2845
+ qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
2846
+ price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
2847
+ total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
2848
+ signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
2849
+ strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
2850
+ analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
2851
+ confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
2852
+ timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
2853
+ status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
2854
+ optionContractType: item.action.trade.optionContractType !== undefined ? item.action.trade.optionContractType : undefined,
2855
+ },
2856
+ }
2857
+ } : undefined,
1442
2858
  },
1443
2859
  }
1444
2860
  } : undefined,
@@ -1519,6 +2935,222 @@ exports.Asset = {
1519
2935
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1520
2936
  set: item.alpacaAccount.marketOpen
1521
2937
  } : undefined,
2938
+ user: item.alpacaAccount.user ? {
2939
+ upsert: {
2940
+ where: {
2941
+ id: item.alpacaAccount.user.id !== undefined ? {
2942
+ equals: item.alpacaAccount.user.id
2943
+ } : undefined,
2944
+ name: item.alpacaAccount.user.name !== undefined ? {
2945
+ equals: item.alpacaAccount.user.name
2946
+ } : undefined,
2947
+ email: item.alpacaAccount.user.email !== undefined ? {
2948
+ equals: item.alpacaAccount.user.email
2949
+ } : undefined,
2950
+ },
2951
+ update: {
2952
+ id: item.alpacaAccount.user.id !== undefined ? {
2953
+ set: item.alpacaAccount.user.id
2954
+ } : undefined,
2955
+ name: item.alpacaAccount.user.name !== undefined ? {
2956
+ set: item.alpacaAccount.user.name
2957
+ } : undefined,
2958
+ email: item.alpacaAccount.user.email !== undefined ? {
2959
+ set: item.alpacaAccount.user.email
2960
+ } : undefined,
2961
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
2962
+ set: item.alpacaAccount.user.emailVerified
2963
+ } : undefined,
2964
+ image: item.alpacaAccount.user.image !== undefined ? {
2965
+ set: item.alpacaAccount.user.image
2966
+ } : undefined,
2967
+ role: item.alpacaAccount.user.role !== undefined ? {
2968
+ set: item.alpacaAccount.user.role
2969
+ } : undefined,
2970
+ bio: item.alpacaAccount.user.bio !== undefined ? {
2971
+ set: item.alpacaAccount.user.bio
2972
+ } : undefined,
2973
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
2974
+ set: item.alpacaAccount.user.jobTitle
2975
+ } : undefined,
2976
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
2977
+ set: item.alpacaAccount.user.currentAccount
2978
+ } : undefined,
2979
+ plan: item.alpacaAccount.user.plan !== undefined ? {
2980
+ set: item.alpacaAccount.user.plan
2981
+ } : undefined,
2982
+ },
2983
+ create: {
2984
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
2985
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
2986
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
2987
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
2988
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
2989
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
2990
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
2991
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
2992
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
2993
+ },
2994
+ }
2995
+ } : undefined,
2996
+ trades: item.alpacaAccount.trades ? {
2997
+ upsert: item.alpacaAccount.trades.map((item) => ({
2998
+ where: {
2999
+ id: item.id !== undefined ? item.id : undefined,
3000
+ },
3001
+ update: {
3002
+ id: item.id !== undefined ? {
3003
+ set: item.id
3004
+ } : undefined,
3005
+ qty: item.qty !== undefined ? {
3006
+ set: item.qty
3007
+ } : undefined,
3008
+ price: item.price !== undefined ? {
3009
+ set: item.price
3010
+ } : undefined,
3011
+ total: item.total !== undefined ? {
3012
+ set: item.total
3013
+ } : undefined,
3014
+ signal: item.signal !== undefined ? {
3015
+ set: item.signal
3016
+ } : undefined,
3017
+ strategy: item.strategy !== undefined ? {
3018
+ set: item.strategy
3019
+ } : undefined,
3020
+ analysis: item.analysis !== undefined ? {
3021
+ set: item.analysis
3022
+ } : undefined,
3023
+ confidence: item.confidence !== undefined ? {
3024
+ set: item.confidence
3025
+ } : undefined,
3026
+ timestamp: item.timestamp !== undefined ? {
3027
+ set: item.timestamp
3028
+ } : undefined,
3029
+ status: item.status !== undefined ? {
3030
+ set: item.status
3031
+ } : undefined,
3032
+ optionContractType: item.optionContractType !== undefined ? {
3033
+ set: item.optionContractType
3034
+ } : undefined,
3035
+ },
3036
+ create: {
3037
+ qty: item.qty !== undefined ? item.qty : undefined,
3038
+ price: item.price !== undefined ? item.price : undefined,
3039
+ total: item.total !== undefined ? item.total : undefined,
3040
+ signal: item.signal !== undefined ? item.signal : undefined,
3041
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
3042
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
3043
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
3044
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3045
+ status: item.status !== undefined ? item.status : undefined,
3046
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3047
+ },
3048
+ }))
3049
+ } : undefined,
3050
+ orders: item.alpacaAccount.orders ? {
3051
+ upsert: item.alpacaAccount.orders.map((item) => ({
3052
+ where: {
3053
+ id: item.id !== undefined ? item.id : undefined,
3054
+ },
3055
+ update: {
3056
+ id: item.id !== undefined ? {
3057
+ set: item.id
3058
+ } : undefined,
3059
+ qty: item.qty !== undefined ? {
3060
+ set: item.qty
3061
+ } : undefined,
3062
+ notional: item.notional !== undefined ? {
3063
+ set: item.notional
3064
+ } : undefined,
3065
+ side: item.side !== undefined ? {
3066
+ set: item.side
3067
+ } : undefined,
3068
+ type: item.type !== undefined ? {
3069
+ set: item.type
3070
+ } : undefined,
3071
+ timeInForce: item.timeInForce !== undefined ? {
3072
+ set: item.timeInForce
3073
+ } : undefined,
3074
+ limitPrice: item.limitPrice !== undefined ? {
3075
+ set: item.limitPrice
3076
+ } : undefined,
3077
+ stopPrice: item.stopPrice !== undefined ? {
3078
+ set: item.stopPrice
3079
+ } : undefined,
3080
+ trailPrice: item.trailPrice !== undefined ? {
3081
+ set: item.trailPrice
3082
+ } : undefined,
3083
+ trailPercent: item.trailPercent !== undefined ? {
3084
+ set: item.trailPercent
3085
+ } : undefined,
3086
+ extendedHours: item.extendedHours !== undefined ? {
3087
+ set: item.extendedHours
3088
+ } : undefined,
3089
+ clientOrderId: item.clientOrderId !== undefined ? {
3090
+ set: item.clientOrderId
3091
+ } : undefined,
3092
+ status: item.status !== undefined ? {
3093
+ set: item.status
3094
+ } : undefined,
3095
+ submittedAt: item.submittedAt !== undefined ? {
3096
+ set: item.submittedAt
3097
+ } : undefined,
3098
+ filledAt: item.filledAt !== undefined ? {
3099
+ set: item.filledAt
3100
+ } : undefined,
3101
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
3102
+ set: item.filledAvgPrice
3103
+ } : undefined,
3104
+ fee: item.fee !== undefined ? {
3105
+ set: item.fee
3106
+ } : undefined,
3107
+ },
3108
+ create: {
3109
+ qty: item.qty !== undefined ? item.qty : undefined,
3110
+ notional: item.notional !== undefined ? item.notional : undefined,
3111
+ side: item.side !== undefined ? item.side : undefined,
3112
+ type: item.type !== undefined ? item.type : undefined,
3113
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
3114
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
3115
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
3116
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
3117
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
3118
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
3119
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3120
+ status: item.status !== undefined ? item.status : undefined,
3121
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
3122
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3123
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3124
+ fee: item.fee !== undefined ? item.fee : undefined,
3125
+ },
3126
+ }))
3127
+ } : undefined,
3128
+ alerts: item.alpacaAccount.alerts ? {
3129
+ upsert: item.alpacaAccount.alerts.map((item) => ({
3130
+ where: {
3131
+ id: item.id !== undefined ? item.id : undefined,
3132
+ },
3133
+ update: {
3134
+ id: item.id !== undefined ? {
3135
+ set: item.id
3136
+ } : undefined,
3137
+ message: item.message !== undefined ? {
3138
+ set: item.message
3139
+ } : undefined,
3140
+ type: item.type !== undefined ? {
3141
+ set: item.type
3142
+ } : undefined,
3143
+ isRead: item.isRead !== undefined ? {
3144
+ set: item.isRead
3145
+ } : undefined,
3146
+ },
3147
+ create: {
3148
+ message: item.message !== undefined ? item.message : undefined,
3149
+ type: item.type !== undefined ? item.type : undefined,
3150
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
3151
+ },
3152
+ }))
3153
+ } : undefined,
1522
3154
  },
1523
3155
  create: {
1524
3156
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1526,6 +3158,104 @@ exports.Asset = {
1526
3158
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1527
3159
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1528
3160
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
3161
+ user: item.alpacaAccount.user ?
3162
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
3163
+ ? { connect: {
3164
+ id: item.alpacaAccount.user.id
3165
+ }
3166
+ }
3167
+ : { connectOrCreate: {
3168
+ where: {
3169
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
3170
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
3171
+ name: item.alpacaAccount.user.name !== undefined ? {
3172
+ equals: item.alpacaAccount.user.name
3173
+ } : undefined,
3174
+ },
3175
+ create: {
3176
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
3177
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
3178
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
3179
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
3180
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
3181
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
3182
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
3183
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
3184
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
3185
+ },
3186
+ }
3187
+ } : undefined,
3188
+ trades: item.alpacaAccount.trades ?
3189
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3190
+ connect: item.alpacaAccount.trades.map((item) => ({
3191
+ id: item.id
3192
+ }))
3193
+ }
3194
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
3195
+ where: {
3196
+ id: item.id !== undefined ? item.id : undefined,
3197
+ },
3198
+ create: {
3199
+ qty: item.qty !== undefined ? item.qty : undefined,
3200
+ price: item.price !== undefined ? item.price : undefined,
3201
+ total: item.total !== undefined ? item.total : undefined,
3202
+ signal: item.signal !== undefined ? item.signal : undefined,
3203
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
3204
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
3205
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
3206
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3207
+ status: item.status !== undefined ? item.status : undefined,
3208
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3209
+ },
3210
+ }))
3211
+ } : undefined,
3212
+ orders: item.alpacaAccount.orders ?
3213
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3214
+ connect: item.alpacaAccount.orders.map((item) => ({
3215
+ id: item.id
3216
+ }))
3217
+ }
3218
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
3219
+ where: {
3220
+ id: item.id !== undefined ? item.id : undefined,
3221
+ },
3222
+ create: {
3223
+ qty: item.qty !== undefined ? item.qty : undefined,
3224
+ notional: item.notional !== undefined ? item.notional : undefined,
3225
+ side: item.side !== undefined ? item.side : undefined,
3226
+ type: item.type !== undefined ? item.type : undefined,
3227
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
3228
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
3229
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
3230
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
3231
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
3232
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
3233
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3234
+ status: item.status !== undefined ? item.status : undefined,
3235
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
3236
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3237
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3238
+ fee: item.fee !== undefined ? item.fee : undefined,
3239
+ },
3240
+ }))
3241
+ } : undefined,
3242
+ alerts: item.alpacaAccount.alerts ?
3243
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3244
+ connect: item.alpacaAccount.alerts.map((item) => ({
3245
+ id: item.id
3246
+ }))
3247
+ }
3248
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
3249
+ where: {
3250
+ id: item.id !== undefined ? item.id : undefined,
3251
+ },
3252
+ create: {
3253
+ message: item.message !== undefined ? item.message : undefined,
3254
+ type: item.type !== undefined ? item.type : undefined,
3255
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
3256
+ },
3257
+ }))
3258
+ } : undefined,
1529
3259
  },
1530
3260
  }
1531
3261
  } : undefined,
@@ -1560,6 +3290,104 @@ exports.Asset = {
1560
3290
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1561
3291
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1562
3292
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
3293
+ user: item.alpacaAccount.user ?
3294
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
3295
+ ? { connect: {
3296
+ id: item.alpacaAccount.user.id
3297
+ }
3298
+ }
3299
+ : { connectOrCreate: {
3300
+ where: {
3301
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
3302
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
3303
+ name: item.alpacaAccount.user.name !== undefined ? {
3304
+ equals: item.alpacaAccount.user.name
3305
+ } : undefined,
3306
+ },
3307
+ create: {
3308
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
3309
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
3310
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
3311
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
3312
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
3313
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
3314
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
3315
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
3316
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
3317
+ },
3318
+ }
3319
+ } : undefined,
3320
+ trades: item.alpacaAccount.trades ?
3321
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3322
+ connect: item.alpacaAccount.trades.map((item) => ({
3323
+ id: item.id
3324
+ }))
3325
+ }
3326
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
3327
+ where: {
3328
+ id: item.id !== undefined ? item.id : undefined,
3329
+ },
3330
+ create: {
3331
+ qty: item.qty !== undefined ? item.qty : undefined,
3332
+ price: item.price !== undefined ? item.price : undefined,
3333
+ total: item.total !== undefined ? item.total : undefined,
3334
+ signal: item.signal !== undefined ? item.signal : undefined,
3335
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
3336
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
3337
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
3338
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3339
+ status: item.status !== undefined ? item.status : undefined,
3340
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3341
+ },
3342
+ }))
3343
+ } : undefined,
3344
+ orders: item.alpacaAccount.orders ?
3345
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3346
+ connect: item.alpacaAccount.orders.map((item) => ({
3347
+ id: item.id
3348
+ }))
3349
+ }
3350
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
3351
+ where: {
3352
+ id: item.id !== undefined ? item.id : undefined,
3353
+ },
3354
+ create: {
3355
+ qty: item.qty !== undefined ? item.qty : undefined,
3356
+ notional: item.notional !== undefined ? item.notional : undefined,
3357
+ side: item.side !== undefined ? item.side : undefined,
3358
+ type: item.type !== undefined ? item.type : undefined,
3359
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
3360
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
3361
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
3362
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
3363
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
3364
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
3365
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3366
+ status: item.status !== undefined ? item.status : undefined,
3367
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
3368
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3369
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3370
+ fee: item.fee !== undefined ? item.fee : undefined,
3371
+ },
3372
+ }))
3373
+ } : undefined,
3374
+ alerts: item.alpacaAccount.alerts ?
3375
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3376
+ connect: item.alpacaAccount.alerts.map((item) => ({
3377
+ id: item.id
3378
+ }))
3379
+ }
3380
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
3381
+ where: {
3382
+ id: item.id !== undefined ? item.id : undefined,
3383
+ },
3384
+ create: {
3385
+ message: item.message !== undefined ? item.message : undefined,
3386
+ type: item.type !== undefined ? item.type : undefined,
3387
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
3388
+ },
3389
+ }))
3390
+ } : undefined,
1563
3391
  },
1564
3392
  }
1565
3393
  } : undefined,
@@ -1980,6 +3808,234 @@ exports.Asset = {
1980
3808
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1981
3809
  set: item.alpacaAccount.marketOpen
1982
3810
  } : undefined,
3811
+ user: item.alpacaAccount.user ? {
3812
+ upsert: {
3813
+ where: {
3814
+ id: item.alpacaAccount.user.id !== undefined ? {
3815
+ equals: item.alpacaAccount.user.id
3816
+ } : undefined,
3817
+ name: item.alpacaAccount.user.name !== undefined ? {
3818
+ equals: item.alpacaAccount.user.name
3819
+ } : undefined,
3820
+ email: item.alpacaAccount.user.email !== undefined ? {
3821
+ equals: item.alpacaAccount.user.email
3822
+ } : undefined,
3823
+ },
3824
+ update: {
3825
+ id: item.alpacaAccount.user.id !== undefined ? {
3826
+ set: item.alpacaAccount.user.id
3827
+ } : undefined,
3828
+ name: item.alpacaAccount.user.name !== undefined ? {
3829
+ set: item.alpacaAccount.user.name
3830
+ } : undefined,
3831
+ email: item.alpacaAccount.user.email !== undefined ? {
3832
+ set: item.alpacaAccount.user.email
3833
+ } : undefined,
3834
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
3835
+ set: item.alpacaAccount.user.emailVerified
3836
+ } : undefined,
3837
+ image: item.alpacaAccount.user.image !== undefined ? {
3838
+ set: item.alpacaAccount.user.image
3839
+ } : undefined,
3840
+ role: item.alpacaAccount.user.role !== undefined ? {
3841
+ set: item.alpacaAccount.user.role
3842
+ } : undefined,
3843
+ bio: item.alpacaAccount.user.bio !== undefined ? {
3844
+ set: item.alpacaAccount.user.bio
3845
+ } : undefined,
3846
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
3847
+ set: item.alpacaAccount.user.jobTitle
3848
+ } : undefined,
3849
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
3850
+ set: item.alpacaAccount.user.currentAccount
3851
+ } : undefined,
3852
+ plan: item.alpacaAccount.user.plan !== undefined ? {
3853
+ set: item.alpacaAccount.user.plan
3854
+ } : undefined,
3855
+ },
3856
+ create: {
3857
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
3858
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
3859
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
3860
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
3861
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
3862
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
3863
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
3864
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
3865
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
3866
+ },
3867
+ }
3868
+ } : undefined,
3869
+ orders: item.alpacaAccount.orders ? {
3870
+ upsert: item.alpacaAccount.orders.map((item) => ({
3871
+ where: {
3872
+ id: item.id !== undefined ? item.id : undefined,
3873
+ },
3874
+ update: {
3875
+ id: item.id !== undefined ? {
3876
+ set: item.id
3877
+ } : undefined,
3878
+ qty: item.qty !== undefined ? {
3879
+ set: item.qty
3880
+ } : undefined,
3881
+ notional: item.notional !== undefined ? {
3882
+ set: item.notional
3883
+ } : undefined,
3884
+ side: item.side !== undefined ? {
3885
+ set: item.side
3886
+ } : undefined,
3887
+ type: item.type !== undefined ? {
3888
+ set: item.type
3889
+ } : undefined,
3890
+ timeInForce: item.timeInForce !== undefined ? {
3891
+ set: item.timeInForce
3892
+ } : undefined,
3893
+ limitPrice: item.limitPrice !== undefined ? {
3894
+ set: item.limitPrice
3895
+ } : undefined,
3896
+ stopPrice: item.stopPrice !== undefined ? {
3897
+ set: item.stopPrice
3898
+ } : undefined,
3899
+ trailPrice: item.trailPrice !== undefined ? {
3900
+ set: item.trailPrice
3901
+ } : undefined,
3902
+ trailPercent: item.trailPercent !== undefined ? {
3903
+ set: item.trailPercent
3904
+ } : undefined,
3905
+ extendedHours: item.extendedHours !== undefined ? {
3906
+ set: item.extendedHours
3907
+ } : undefined,
3908
+ clientOrderId: item.clientOrderId !== undefined ? {
3909
+ set: item.clientOrderId
3910
+ } : undefined,
3911
+ status: item.status !== undefined ? {
3912
+ set: item.status
3913
+ } : undefined,
3914
+ submittedAt: item.submittedAt !== undefined ? {
3915
+ set: item.submittedAt
3916
+ } : undefined,
3917
+ filledAt: item.filledAt !== undefined ? {
3918
+ set: item.filledAt
3919
+ } : undefined,
3920
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
3921
+ set: item.filledAvgPrice
3922
+ } : undefined,
3923
+ fee: item.fee !== undefined ? {
3924
+ set: item.fee
3925
+ } : undefined,
3926
+ },
3927
+ create: {
3928
+ qty: item.qty !== undefined ? item.qty : undefined,
3929
+ notional: item.notional !== undefined ? item.notional : undefined,
3930
+ side: item.side !== undefined ? item.side : undefined,
3931
+ type: item.type !== undefined ? item.type : undefined,
3932
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
3933
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
3934
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
3935
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
3936
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
3937
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
3938
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3939
+ status: item.status !== undefined ? item.status : undefined,
3940
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
3941
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3942
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3943
+ fee: item.fee !== undefined ? item.fee : undefined,
3944
+ },
3945
+ }))
3946
+ } : undefined,
3947
+ positions: item.alpacaAccount.positions ? {
3948
+ upsert: item.alpacaAccount.positions.map((item) => ({
3949
+ where: {
3950
+ id: item.id !== undefined ? item.id : undefined,
3951
+ },
3952
+ update: {
3953
+ id: item.id !== undefined ? {
3954
+ set: item.id
3955
+ } : undefined,
3956
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
3957
+ set: item.averageEntryPrice
3958
+ } : undefined,
3959
+ qty: item.qty !== undefined ? {
3960
+ set: item.qty
3961
+ } : undefined,
3962
+ qtyAvailable: item.qtyAvailable !== undefined ? {
3963
+ set: item.qtyAvailable
3964
+ } : undefined,
3965
+ marketValue: item.marketValue !== undefined ? {
3966
+ set: item.marketValue
3967
+ } : undefined,
3968
+ costBasis: item.costBasis !== undefined ? {
3969
+ set: item.costBasis
3970
+ } : undefined,
3971
+ unrealizedPL: item.unrealizedPL !== undefined ? {
3972
+ set: item.unrealizedPL
3973
+ } : undefined,
3974
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
3975
+ set: item.unrealizedPLPC
3976
+ } : undefined,
3977
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
3978
+ set: item.unrealisedIntradayPL
3979
+ } : undefined,
3980
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
3981
+ set: item.unrealisedIntradayPLPC
3982
+ } : undefined,
3983
+ currentPrice: item.currentPrice !== undefined ? {
3984
+ set: item.currentPrice
3985
+ } : undefined,
3986
+ lastTradePrice: item.lastTradePrice !== undefined ? {
3987
+ set: item.lastTradePrice
3988
+ } : undefined,
3989
+ changeToday: item.changeToday !== undefined ? {
3990
+ set: item.changeToday
3991
+ } : undefined,
3992
+ assetMarginable: item.assetMarginable !== undefined ? {
3993
+ set: item.assetMarginable
3994
+ } : undefined,
3995
+ },
3996
+ create: {
3997
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
3998
+ qty: item.qty !== undefined ? item.qty : undefined,
3999
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4000
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4001
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4002
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4003
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4004
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4005
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4006
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4007
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4008
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4009
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4010
+ },
4011
+ }))
4012
+ } : undefined,
4013
+ alerts: item.alpacaAccount.alerts ? {
4014
+ upsert: item.alpacaAccount.alerts.map((item) => ({
4015
+ where: {
4016
+ id: item.id !== undefined ? item.id : undefined,
4017
+ },
4018
+ update: {
4019
+ id: item.id !== undefined ? {
4020
+ set: item.id
4021
+ } : undefined,
4022
+ message: item.message !== undefined ? {
4023
+ set: item.message
4024
+ } : undefined,
4025
+ type: item.type !== undefined ? {
4026
+ set: item.type
4027
+ } : undefined,
4028
+ isRead: item.isRead !== undefined ? {
4029
+ set: item.isRead
4030
+ } : undefined,
4031
+ },
4032
+ create: {
4033
+ message: item.message !== undefined ? item.message : undefined,
4034
+ type: item.type !== undefined ? item.type : undefined,
4035
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
4036
+ },
4037
+ }))
4038
+ } : undefined,
1983
4039
  },
1984
4040
  create: {
1985
4041
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1987,6 +4043,107 @@ exports.Asset = {
1987
4043
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1988
4044
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1989
4045
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4046
+ user: item.alpacaAccount.user ?
4047
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
4048
+ ? { connect: {
4049
+ id: item.alpacaAccount.user.id
4050
+ }
4051
+ }
4052
+ : { connectOrCreate: {
4053
+ where: {
4054
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
4055
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4056
+ name: item.alpacaAccount.user.name !== undefined ? {
4057
+ equals: item.alpacaAccount.user.name
4058
+ } : undefined,
4059
+ },
4060
+ create: {
4061
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
4062
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4063
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
4064
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
4065
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
4066
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
4067
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
4068
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
4069
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
4070
+ },
4071
+ }
4072
+ } : undefined,
4073
+ orders: item.alpacaAccount.orders ?
4074
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4075
+ connect: item.alpacaAccount.orders.map((item) => ({
4076
+ id: item.id
4077
+ }))
4078
+ }
4079
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
4080
+ where: {
4081
+ id: item.id !== undefined ? item.id : undefined,
4082
+ },
4083
+ create: {
4084
+ qty: item.qty !== undefined ? item.qty : undefined,
4085
+ notional: item.notional !== undefined ? item.notional : undefined,
4086
+ side: item.side !== undefined ? item.side : undefined,
4087
+ type: item.type !== undefined ? item.type : undefined,
4088
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
4089
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
4090
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
4091
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
4092
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
4093
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
4094
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4095
+ status: item.status !== undefined ? item.status : undefined,
4096
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
4097
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
4098
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
4099
+ fee: item.fee !== undefined ? item.fee : undefined,
4100
+ },
4101
+ }))
4102
+ } : undefined,
4103
+ positions: item.alpacaAccount.positions ?
4104
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4105
+ connect: item.alpacaAccount.positions.map((item) => ({
4106
+ id: item.id
4107
+ }))
4108
+ }
4109
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
4110
+ where: {
4111
+ id: item.id !== undefined ? item.id : undefined,
4112
+ },
4113
+ create: {
4114
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4115
+ qty: item.qty !== undefined ? item.qty : undefined,
4116
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4117
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4118
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4119
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4120
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4121
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4122
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4123
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4124
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4125
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4126
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4127
+ },
4128
+ }))
4129
+ } : undefined,
4130
+ alerts: item.alpacaAccount.alerts ?
4131
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4132
+ connect: item.alpacaAccount.alerts.map((item) => ({
4133
+ id: item.id
4134
+ }))
4135
+ }
4136
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
4137
+ where: {
4138
+ id: item.id !== undefined ? item.id : undefined,
4139
+ },
4140
+ create: {
4141
+ message: item.message !== undefined ? item.message : undefined,
4142
+ type: item.type !== undefined ? item.type : undefined,
4143
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
4144
+ },
4145
+ }))
4146
+ } : undefined,
1990
4147
  },
1991
4148
  }
1992
4149
  } : undefined,
@@ -2014,6 +4171,86 @@ exports.Asset = {
2014
4171
  fee: item.fee !== undefined ? {
2015
4172
  set: item.fee
2016
4173
  } : undefined,
4174
+ order: item.order ? {
4175
+ upsert: {
4176
+ where: {
4177
+ id: item.order.id !== undefined ? {
4178
+ equals: item.order.id
4179
+ } : undefined,
4180
+ },
4181
+ update: {
4182
+ id: item.order.id !== undefined ? {
4183
+ set: item.order.id
4184
+ } : undefined,
4185
+ qty: item.order.qty !== undefined ? {
4186
+ set: item.order.qty
4187
+ } : undefined,
4188
+ notional: item.order.notional !== undefined ? {
4189
+ set: item.order.notional
4190
+ } : undefined,
4191
+ side: item.order.side !== undefined ? {
4192
+ set: item.order.side
4193
+ } : undefined,
4194
+ type: item.order.type !== undefined ? {
4195
+ set: item.order.type
4196
+ } : undefined,
4197
+ timeInForce: item.order.timeInForce !== undefined ? {
4198
+ set: item.order.timeInForce
4199
+ } : undefined,
4200
+ limitPrice: item.order.limitPrice !== undefined ? {
4201
+ set: item.order.limitPrice
4202
+ } : undefined,
4203
+ stopPrice: item.order.stopPrice !== undefined ? {
4204
+ set: item.order.stopPrice
4205
+ } : undefined,
4206
+ trailPrice: item.order.trailPrice !== undefined ? {
4207
+ set: item.order.trailPrice
4208
+ } : undefined,
4209
+ trailPercent: item.order.trailPercent !== undefined ? {
4210
+ set: item.order.trailPercent
4211
+ } : undefined,
4212
+ extendedHours: item.order.extendedHours !== undefined ? {
4213
+ set: item.order.extendedHours
4214
+ } : undefined,
4215
+ clientOrderId: item.order.clientOrderId !== undefined ? {
4216
+ set: item.order.clientOrderId
4217
+ } : undefined,
4218
+ status: item.order.status !== undefined ? {
4219
+ set: item.order.status
4220
+ } : undefined,
4221
+ submittedAt: item.order.submittedAt !== undefined ? {
4222
+ set: item.order.submittedAt
4223
+ } : undefined,
4224
+ filledAt: item.order.filledAt !== undefined ? {
4225
+ set: item.order.filledAt
4226
+ } : undefined,
4227
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? {
4228
+ set: item.order.filledAvgPrice
4229
+ } : undefined,
4230
+ fee: item.order.fee !== undefined ? {
4231
+ set: item.order.fee
4232
+ } : undefined,
4233
+ },
4234
+ create: {
4235
+ qty: item.order.qty !== undefined ? item.order.qty : undefined,
4236
+ notional: item.order.notional !== undefined ? item.order.notional : undefined,
4237
+ side: item.order.side !== undefined ? item.order.side : undefined,
4238
+ type: item.order.type !== undefined ? item.order.type : undefined,
4239
+ timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
4240
+ limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
4241
+ stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
4242
+ trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
4243
+ trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
4244
+ extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
4245
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
4246
+ status: item.order.status !== undefined ? item.order.status : undefined,
4247
+ submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
4248
+ filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
4249
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
4250
+ fee: item.order.fee !== undefined ? item.order.fee : undefined,
4251
+ },
4252
+ }
4253
+ } : undefined,
2017
4254
  },
2018
4255
  create: {
2019
4256
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2021,6 +4258,36 @@ exports.Asset = {
2021
4258
  note: item.note !== undefined ? item.note : undefined,
2022
4259
  status: item.status !== undefined ? item.status : undefined,
2023
4260
  fee: item.fee !== undefined ? item.fee : undefined,
4261
+ order: item.order ?
4262
+ typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
4263
+ ? { connect: {
4264
+ id: item.order.id
4265
+ }
4266
+ }
4267
+ : { connectOrCreate: {
4268
+ where: {
4269
+ id: item.order.id !== undefined ? item.order.id : undefined,
4270
+ },
4271
+ create: {
4272
+ qty: item.order.qty !== undefined ? item.order.qty : undefined,
4273
+ notional: item.order.notional !== undefined ? item.order.notional : undefined,
4274
+ side: item.order.side !== undefined ? item.order.side : undefined,
4275
+ type: item.order.type !== undefined ? item.order.type : undefined,
4276
+ timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
4277
+ limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
4278
+ stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
4279
+ trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
4280
+ trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
4281
+ extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
4282
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
4283
+ status: item.order.status !== undefined ? item.order.status : undefined,
4284
+ submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
4285
+ filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
4286
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
4287
+ fee: item.order.fee !== undefined ? item.order.fee : undefined,
4288
+ },
4289
+ }
4290
+ } : undefined,
2024
4291
  },
2025
4292
  }))
2026
4293
  } : undefined,
@@ -2052,6 +4319,107 @@ exports.Asset = {
2052
4319
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2053
4320
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2054
4321
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4322
+ user: item.alpacaAccount.user ?
4323
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
4324
+ ? { connect: {
4325
+ id: item.alpacaAccount.user.id
4326
+ }
4327
+ }
4328
+ : { connectOrCreate: {
4329
+ where: {
4330
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
4331
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4332
+ name: item.alpacaAccount.user.name !== undefined ? {
4333
+ equals: item.alpacaAccount.user.name
4334
+ } : undefined,
4335
+ },
4336
+ create: {
4337
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
4338
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4339
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
4340
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
4341
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
4342
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
4343
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
4344
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
4345
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
4346
+ },
4347
+ }
4348
+ } : undefined,
4349
+ orders: item.alpacaAccount.orders ?
4350
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4351
+ connect: item.alpacaAccount.orders.map((item) => ({
4352
+ id: item.id
4353
+ }))
4354
+ }
4355
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
4356
+ where: {
4357
+ id: item.id !== undefined ? item.id : undefined,
4358
+ },
4359
+ create: {
4360
+ qty: item.qty !== undefined ? item.qty : undefined,
4361
+ notional: item.notional !== undefined ? item.notional : undefined,
4362
+ side: item.side !== undefined ? item.side : undefined,
4363
+ type: item.type !== undefined ? item.type : undefined,
4364
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
4365
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
4366
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
4367
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
4368
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
4369
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
4370
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4371
+ status: item.status !== undefined ? item.status : undefined,
4372
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
4373
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
4374
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
4375
+ fee: item.fee !== undefined ? item.fee : undefined,
4376
+ },
4377
+ }))
4378
+ } : undefined,
4379
+ positions: item.alpacaAccount.positions ?
4380
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4381
+ connect: item.alpacaAccount.positions.map((item) => ({
4382
+ id: item.id
4383
+ }))
4384
+ }
4385
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
4386
+ where: {
4387
+ id: item.id !== undefined ? item.id : undefined,
4388
+ },
4389
+ create: {
4390
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4391
+ qty: item.qty !== undefined ? item.qty : undefined,
4392
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4393
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4394
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4395
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4396
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4397
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4398
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4399
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4400
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4401
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4402
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4403
+ },
4404
+ }))
4405
+ } : undefined,
4406
+ alerts: item.alpacaAccount.alerts ?
4407
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4408
+ connect: item.alpacaAccount.alerts.map((item) => ({
4409
+ id: item.id
4410
+ }))
4411
+ }
4412
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
4413
+ where: {
4414
+ id: item.id !== undefined ? item.id : undefined,
4415
+ },
4416
+ create: {
4417
+ message: item.message !== undefined ? item.message : undefined,
4418
+ type: item.type !== undefined ? item.type : undefined,
4419
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
4420
+ },
4421
+ }))
4422
+ } : undefined,
2055
4423
  },
2056
4424
  }
2057
4425
  } : undefined,
@@ -2071,6 +4439,36 @@ exports.Asset = {
2071
4439
  note: item.note !== undefined ? item.note : undefined,
2072
4440
  status: item.status !== undefined ? item.status : undefined,
2073
4441
  fee: item.fee !== undefined ? item.fee : undefined,
4442
+ order: item.order ?
4443
+ typeof item.order === 'object' && Object.keys(item.order).length === 1 && Object.keys(item.order)[0] === 'id'
4444
+ ? { connect: {
4445
+ id: item.order.id
4446
+ }
4447
+ }
4448
+ : { connectOrCreate: {
4449
+ where: {
4450
+ id: item.order.id !== undefined ? item.order.id : undefined,
4451
+ },
4452
+ create: {
4453
+ qty: item.order.qty !== undefined ? item.order.qty : undefined,
4454
+ notional: item.order.notional !== undefined ? item.order.notional : undefined,
4455
+ side: item.order.side !== undefined ? item.order.side : undefined,
4456
+ type: item.order.type !== undefined ? item.order.type : undefined,
4457
+ timeInForce: item.order.timeInForce !== undefined ? item.order.timeInForce : undefined,
4458
+ limitPrice: item.order.limitPrice !== undefined ? item.order.limitPrice : undefined,
4459
+ stopPrice: item.order.stopPrice !== undefined ? item.order.stopPrice : undefined,
4460
+ trailPrice: item.order.trailPrice !== undefined ? item.order.trailPrice : undefined,
4461
+ trailPercent: item.order.trailPercent !== undefined ? item.order.trailPercent : undefined,
4462
+ extendedHours: item.order.extendedHours !== undefined ? item.order.extendedHours : undefined,
4463
+ clientOrderId: item.order.clientOrderId !== undefined ? item.order.clientOrderId : undefined,
4464
+ status: item.order.status !== undefined ? item.order.status : undefined,
4465
+ submittedAt: item.order.submittedAt !== undefined ? item.order.submittedAt : undefined,
4466
+ filledAt: item.order.filledAt !== undefined ? item.order.filledAt : undefined,
4467
+ filledAvgPrice: item.order.filledAvgPrice !== undefined ? item.order.filledAvgPrice : undefined,
4468
+ fee: item.order.fee !== undefined ? item.order.fee : undefined,
4469
+ },
4470
+ }
4471
+ } : undefined,
2074
4472
  },
2075
4473
  }))
2076
4474
  } : undefined,
@@ -2160,6 +4558,210 @@ exports.Asset = {
2160
4558
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2161
4559
  set: item.alpacaAccount.marketOpen
2162
4560
  } : undefined,
4561
+ user: item.alpacaAccount.user ? {
4562
+ upsert: {
4563
+ where: {
4564
+ id: item.alpacaAccount.user.id !== undefined ? {
4565
+ equals: item.alpacaAccount.user.id
4566
+ } : undefined,
4567
+ name: item.alpacaAccount.user.name !== undefined ? {
4568
+ equals: item.alpacaAccount.user.name
4569
+ } : undefined,
4570
+ email: item.alpacaAccount.user.email !== undefined ? {
4571
+ equals: item.alpacaAccount.user.email
4572
+ } : undefined,
4573
+ },
4574
+ update: {
4575
+ id: item.alpacaAccount.user.id !== undefined ? {
4576
+ set: item.alpacaAccount.user.id
4577
+ } : undefined,
4578
+ name: item.alpacaAccount.user.name !== undefined ? {
4579
+ set: item.alpacaAccount.user.name
4580
+ } : undefined,
4581
+ email: item.alpacaAccount.user.email !== undefined ? {
4582
+ set: item.alpacaAccount.user.email
4583
+ } : undefined,
4584
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
4585
+ set: item.alpacaAccount.user.emailVerified
4586
+ } : undefined,
4587
+ image: item.alpacaAccount.user.image !== undefined ? {
4588
+ set: item.alpacaAccount.user.image
4589
+ } : undefined,
4590
+ role: item.alpacaAccount.user.role !== undefined ? {
4591
+ set: item.alpacaAccount.user.role
4592
+ } : undefined,
4593
+ bio: item.alpacaAccount.user.bio !== undefined ? {
4594
+ set: item.alpacaAccount.user.bio
4595
+ } : undefined,
4596
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
4597
+ set: item.alpacaAccount.user.jobTitle
4598
+ } : undefined,
4599
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
4600
+ set: item.alpacaAccount.user.currentAccount
4601
+ } : undefined,
4602
+ plan: item.alpacaAccount.user.plan !== undefined ? {
4603
+ set: item.alpacaAccount.user.plan
4604
+ } : undefined,
4605
+ },
4606
+ create: {
4607
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
4608
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4609
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
4610
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
4611
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
4612
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
4613
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
4614
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
4615
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
4616
+ },
4617
+ }
4618
+ } : undefined,
4619
+ trades: item.alpacaAccount.trades ? {
4620
+ upsert: item.alpacaAccount.trades.map((item) => ({
4621
+ where: {
4622
+ id: item.id !== undefined ? item.id : undefined,
4623
+ },
4624
+ update: {
4625
+ id: item.id !== undefined ? {
4626
+ set: item.id
4627
+ } : undefined,
4628
+ qty: item.qty !== undefined ? {
4629
+ set: item.qty
4630
+ } : undefined,
4631
+ price: item.price !== undefined ? {
4632
+ set: item.price
4633
+ } : undefined,
4634
+ total: item.total !== undefined ? {
4635
+ set: item.total
4636
+ } : undefined,
4637
+ signal: item.signal !== undefined ? {
4638
+ set: item.signal
4639
+ } : undefined,
4640
+ strategy: item.strategy !== undefined ? {
4641
+ set: item.strategy
4642
+ } : undefined,
4643
+ analysis: item.analysis !== undefined ? {
4644
+ set: item.analysis
4645
+ } : undefined,
4646
+ confidence: item.confidence !== undefined ? {
4647
+ set: item.confidence
4648
+ } : undefined,
4649
+ timestamp: item.timestamp !== undefined ? {
4650
+ set: item.timestamp
4651
+ } : undefined,
4652
+ status: item.status !== undefined ? {
4653
+ set: item.status
4654
+ } : undefined,
4655
+ optionContractType: item.optionContractType !== undefined ? {
4656
+ set: item.optionContractType
4657
+ } : undefined,
4658
+ },
4659
+ create: {
4660
+ qty: item.qty !== undefined ? item.qty : undefined,
4661
+ price: item.price !== undefined ? item.price : undefined,
4662
+ total: item.total !== undefined ? item.total : undefined,
4663
+ signal: item.signal !== undefined ? item.signal : undefined,
4664
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
4665
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
4666
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
4667
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
4668
+ status: item.status !== undefined ? item.status : undefined,
4669
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
4670
+ },
4671
+ }))
4672
+ } : undefined,
4673
+ positions: item.alpacaAccount.positions ? {
4674
+ upsert: item.alpacaAccount.positions.map((item) => ({
4675
+ where: {
4676
+ id: item.id !== undefined ? item.id : undefined,
4677
+ },
4678
+ update: {
4679
+ id: item.id !== undefined ? {
4680
+ set: item.id
4681
+ } : undefined,
4682
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
4683
+ set: item.averageEntryPrice
4684
+ } : undefined,
4685
+ qty: item.qty !== undefined ? {
4686
+ set: item.qty
4687
+ } : undefined,
4688
+ qtyAvailable: item.qtyAvailable !== undefined ? {
4689
+ set: item.qtyAvailable
4690
+ } : undefined,
4691
+ marketValue: item.marketValue !== undefined ? {
4692
+ set: item.marketValue
4693
+ } : undefined,
4694
+ costBasis: item.costBasis !== undefined ? {
4695
+ set: item.costBasis
4696
+ } : undefined,
4697
+ unrealizedPL: item.unrealizedPL !== undefined ? {
4698
+ set: item.unrealizedPL
4699
+ } : undefined,
4700
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
4701
+ set: item.unrealizedPLPC
4702
+ } : undefined,
4703
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
4704
+ set: item.unrealisedIntradayPL
4705
+ } : undefined,
4706
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
4707
+ set: item.unrealisedIntradayPLPC
4708
+ } : undefined,
4709
+ currentPrice: item.currentPrice !== undefined ? {
4710
+ set: item.currentPrice
4711
+ } : undefined,
4712
+ lastTradePrice: item.lastTradePrice !== undefined ? {
4713
+ set: item.lastTradePrice
4714
+ } : undefined,
4715
+ changeToday: item.changeToday !== undefined ? {
4716
+ set: item.changeToday
4717
+ } : undefined,
4718
+ assetMarginable: item.assetMarginable !== undefined ? {
4719
+ set: item.assetMarginable
4720
+ } : undefined,
4721
+ },
4722
+ create: {
4723
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4724
+ qty: item.qty !== undefined ? item.qty : undefined,
4725
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4726
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4727
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4728
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4729
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4730
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4731
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4732
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4733
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4734
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4735
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4736
+ },
4737
+ }))
4738
+ } : undefined,
4739
+ alerts: item.alpacaAccount.alerts ? {
4740
+ upsert: item.alpacaAccount.alerts.map((item) => ({
4741
+ where: {
4742
+ id: item.id !== undefined ? item.id : undefined,
4743
+ },
4744
+ update: {
4745
+ id: item.id !== undefined ? {
4746
+ set: item.id
4747
+ } : undefined,
4748
+ message: item.message !== undefined ? {
4749
+ set: item.message
4750
+ } : undefined,
4751
+ type: item.type !== undefined ? {
4752
+ set: item.type
4753
+ } : undefined,
4754
+ isRead: item.isRead !== undefined ? {
4755
+ set: item.isRead
4756
+ } : undefined,
4757
+ },
4758
+ create: {
4759
+ message: item.message !== undefined ? item.message : undefined,
4760
+ type: item.type !== undefined ? item.type : undefined,
4761
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
4762
+ },
4763
+ }))
4764
+ } : undefined,
2163
4765
  },
2164
4766
  create: {
2165
4767
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2167,6 +4769,101 @@ exports.Asset = {
2167
4769
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2168
4770
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2169
4771
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
4772
+ user: item.alpacaAccount.user ?
4773
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
4774
+ ? { connect: {
4775
+ id: item.alpacaAccount.user.id
4776
+ }
4777
+ }
4778
+ : { connectOrCreate: {
4779
+ where: {
4780
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
4781
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4782
+ name: item.alpacaAccount.user.name !== undefined ? {
4783
+ equals: item.alpacaAccount.user.name
4784
+ } : undefined,
4785
+ },
4786
+ create: {
4787
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
4788
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
4789
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
4790
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
4791
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
4792
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
4793
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
4794
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
4795
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
4796
+ },
4797
+ }
4798
+ } : undefined,
4799
+ trades: item.alpacaAccount.trades ?
4800
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4801
+ connect: item.alpacaAccount.trades.map((item) => ({
4802
+ id: item.id
4803
+ }))
4804
+ }
4805
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
4806
+ where: {
4807
+ id: item.id !== undefined ? item.id : undefined,
4808
+ },
4809
+ create: {
4810
+ qty: item.qty !== undefined ? item.qty : undefined,
4811
+ price: item.price !== undefined ? item.price : undefined,
4812
+ total: item.total !== undefined ? item.total : undefined,
4813
+ signal: item.signal !== undefined ? item.signal : undefined,
4814
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
4815
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
4816
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
4817
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
4818
+ status: item.status !== undefined ? item.status : undefined,
4819
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
4820
+ },
4821
+ }))
4822
+ } : undefined,
4823
+ positions: item.alpacaAccount.positions ?
4824
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4825
+ connect: item.alpacaAccount.positions.map((item) => ({
4826
+ id: item.id
4827
+ }))
4828
+ }
4829
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
4830
+ where: {
4831
+ id: item.id !== undefined ? item.id : undefined,
4832
+ },
4833
+ create: {
4834
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4835
+ qty: item.qty !== undefined ? item.qty : undefined,
4836
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4837
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4838
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4839
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4840
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4841
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4842
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4843
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4844
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4845
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4846
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4847
+ },
4848
+ }))
4849
+ } : undefined,
4850
+ alerts: item.alpacaAccount.alerts ?
4851
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4852
+ connect: item.alpacaAccount.alerts.map((item) => ({
4853
+ id: item.id
4854
+ }))
4855
+ }
4856
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
4857
+ where: {
4858
+ id: item.id !== undefined ? item.id : undefined,
4859
+ },
4860
+ create: {
4861
+ message: item.message !== undefined ? item.message : undefined,
4862
+ type: item.type !== undefined ? item.type : undefined,
4863
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
4864
+ },
4865
+ }))
4866
+ } : undefined,
2170
4867
  },
2171
4868
  }
2172
4869
  } : undefined,
@@ -2196,6 +4893,62 @@ exports.Asset = {
2196
4893
  fee: item.action.fee !== undefined ? {
2197
4894
  set: item.action.fee
2198
4895
  } : undefined,
4896
+ trade: item.action.trade ? {
4897
+ upsert: {
4898
+ where: {
4899
+ id: item.action.trade.id !== undefined ? {
4900
+ equals: item.action.trade.id
4901
+ } : undefined,
4902
+ },
4903
+ update: {
4904
+ id: item.action.trade.id !== undefined ? {
4905
+ set: item.action.trade.id
4906
+ } : undefined,
4907
+ qty: item.action.trade.qty !== undefined ? {
4908
+ set: item.action.trade.qty
4909
+ } : undefined,
4910
+ price: item.action.trade.price !== undefined ? {
4911
+ set: item.action.trade.price
4912
+ } : undefined,
4913
+ total: item.action.trade.total !== undefined ? {
4914
+ set: item.action.trade.total
4915
+ } : undefined,
4916
+ signal: item.action.trade.signal !== undefined ? {
4917
+ set: item.action.trade.signal
4918
+ } : undefined,
4919
+ strategy: item.action.trade.strategy !== undefined ? {
4920
+ set: item.action.trade.strategy
4921
+ } : undefined,
4922
+ analysis: item.action.trade.analysis !== undefined ? {
4923
+ set: item.action.trade.analysis
4924
+ } : undefined,
4925
+ confidence: item.action.trade.confidence !== undefined ? {
4926
+ set: item.action.trade.confidence
4927
+ } : undefined,
4928
+ timestamp: item.action.trade.timestamp !== undefined ? {
4929
+ set: item.action.trade.timestamp
4930
+ } : undefined,
4931
+ status: item.action.trade.status !== undefined ? {
4932
+ set: item.action.trade.status
4933
+ } : undefined,
4934
+ optionContractType: item.action.trade.optionContractType !== undefined ? {
4935
+ set: item.action.trade.optionContractType
4936
+ } : undefined,
4937
+ },
4938
+ create: {
4939
+ qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
4940
+ price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
4941
+ total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
4942
+ signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
4943
+ strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
4944
+ analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
4945
+ confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
4946
+ timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
4947
+ status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
4948
+ optionContractType: item.action.trade.optionContractType !== undefined ? item.action.trade.optionContractType : undefined,
4949
+ },
4950
+ }
4951
+ } : undefined,
2199
4952
  },
2200
4953
  create: {
2201
4954
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2203,6 +4956,30 @@ exports.Asset = {
2203
4956
  note: item.action.note !== undefined ? item.action.note : undefined,
2204
4957
  status: item.action.status !== undefined ? item.action.status : undefined,
2205
4958
  fee: item.action.fee !== undefined ? item.action.fee : undefined,
4959
+ trade: item.action.trade ?
4960
+ typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
4961
+ ? { connect: {
4962
+ id: item.action.trade.id
4963
+ }
4964
+ }
4965
+ : { connectOrCreate: {
4966
+ where: {
4967
+ id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
4968
+ },
4969
+ create: {
4970
+ qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
4971
+ price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
4972
+ total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
4973
+ signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
4974
+ strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
4975
+ analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
4976
+ confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
4977
+ timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
4978
+ status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
4979
+ optionContractType: item.action.trade.optionContractType !== undefined ? item.action.trade.optionContractType : undefined,
4980
+ },
4981
+ }
4982
+ } : undefined,
2206
4983
  },
2207
4984
  }
2208
4985
  } : undefined,
@@ -2240,6 +5017,101 @@ exports.Asset = {
2240
5017
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2241
5018
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2242
5019
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
5020
+ user: item.alpacaAccount.user ?
5021
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
5022
+ ? { connect: {
5023
+ id: item.alpacaAccount.user.id
5024
+ }
5025
+ }
5026
+ : { connectOrCreate: {
5027
+ where: {
5028
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
5029
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5030
+ name: item.alpacaAccount.user.name !== undefined ? {
5031
+ equals: item.alpacaAccount.user.name
5032
+ } : undefined,
5033
+ },
5034
+ create: {
5035
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
5036
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5037
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
5038
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
5039
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
5040
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
5041
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
5042
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
5043
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
5044
+ },
5045
+ }
5046
+ } : undefined,
5047
+ trades: item.alpacaAccount.trades ?
5048
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5049
+ connect: item.alpacaAccount.trades.map((item) => ({
5050
+ id: item.id
5051
+ }))
5052
+ }
5053
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
5054
+ where: {
5055
+ id: item.id !== undefined ? item.id : undefined,
5056
+ },
5057
+ create: {
5058
+ qty: item.qty !== undefined ? item.qty : undefined,
5059
+ price: item.price !== undefined ? item.price : undefined,
5060
+ total: item.total !== undefined ? item.total : undefined,
5061
+ signal: item.signal !== undefined ? item.signal : undefined,
5062
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5063
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5064
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5065
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5066
+ status: item.status !== undefined ? item.status : undefined,
5067
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5068
+ },
5069
+ }))
5070
+ } : undefined,
5071
+ positions: item.alpacaAccount.positions ?
5072
+ Array.isArray(item.alpacaAccount.positions) && item.alpacaAccount.positions.length > 0 && item.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5073
+ connect: item.alpacaAccount.positions.map((item) => ({
5074
+ id: item.id
5075
+ }))
5076
+ }
5077
+ : { connectOrCreate: item.alpacaAccount.positions.map((item) => ({
5078
+ where: {
5079
+ id: item.id !== undefined ? item.id : undefined,
5080
+ },
5081
+ create: {
5082
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
5083
+ qty: item.qty !== undefined ? item.qty : undefined,
5084
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
5085
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
5086
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
5087
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
5088
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
5089
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
5090
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
5091
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
5092
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
5093
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
5094
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
5095
+ },
5096
+ }))
5097
+ } : undefined,
5098
+ alerts: item.alpacaAccount.alerts ?
5099
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5100
+ connect: item.alpacaAccount.alerts.map((item) => ({
5101
+ id: item.id
5102
+ }))
5103
+ }
5104
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
5105
+ where: {
5106
+ id: item.id !== undefined ? item.id : undefined,
5107
+ },
5108
+ create: {
5109
+ message: item.message !== undefined ? item.message : undefined,
5110
+ type: item.type !== undefined ? item.type : undefined,
5111
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
5112
+ },
5113
+ }))
5114
+ } : undefined,
2243
5115
  },
2244
5116
  }
2245
5117
  } : undefined,
@@ -2259,6 +5131,30 @@ exports.Asset = {
2259
5131
  note: item.action.note !== undefined ? item.action.note : undefined,
2260
5132
  status: item.action.status !== undefined ? item.action.status : undefined,
2261
5133
  fee: item.action.fee !== undefined ? item.action.fee : undefined,
5134
+ trade: item.action.trade ?
5135
+ typeof item.action.trade === 'object' && Object.keys(item.action.trade).length === 1 && Object.keys(item.action.trade)[0] === 'id'
5136
+ ? { connect: {
5137
+ id: item.action.trade.id
5138
+ }
5139
+ }
5140
+ : { connectOrCreate: {
5141
+ where: {
5142
+ id: item.action.trade.id !== undefined ? item.action.trade.id : undefined,
5143
+ },
5144
+ create: {
5145
+ qty: item.action.trade.qty !== undefined ? item.action.trade.qty : undefined,
5146
+ price: item.action.trade.price !== undefined ? item.action.trade.price : undefined,
5147
+ total: item.action.trade.total !== undefined ? item.action.trade.total : undefined,
5148
+ signal: item.action.trade.signal !== undefined ? item.action.trade.signal : undefined,
5149
+ strategy: item.action.trade.strategy !== undefined ? item.action.trade.strategy : undefined,
5150
+ analysis: item.action.trade.analysis !== undefined ? item.action.trade.analysis : undefined,
5151
+ confidence: item.action.trade.confidence !== undefined ? item.action.trade.confidence : undefined,
5152
+ timestamp: item.action.trade.timestamp !== undefined ? item.action.trade.timestamp : undefined,
5153
+ status: item.action.trade.status !== undefined ? item.action.trade.status : undefined,
5154
+ optionContractType: item.action.trade.optionContractType !== undefined ? item.action.trade.optionContractType : undefined,
5155
+ },
5156
+ }
5157
+ } : undefined,
2262
5158
  },
2263
5159
  }
2264
5160
  } : undefined,
@@ -2339,6 +5235,222 @@ exports.Asset = {
2339
5235
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2340
5236
  set: item.alpacaAccount.marketOpen
2341
5237
  } : undefined,
5238
+ user: item.alpacaAccount.user ? {
5239
+ upsert: {
5240
+ where: {
5241
+ id: item.alpacaAccount.user.id !== undefined ? {
5242
+ equals: item.alpacaAccount.user.id
5243
+ } : undefined,
5244
+ name: item.alpacaAccount.user.name !== undefined ? {
5245
+ equals: item.alpacaAccount.user.name
5246
+ } : undefined,
5247
+ email: item.alpacaAccount.user.email !== undefined ? {
5248
+ equals: item.alpacaAccount.user.email
5249
+ } : undefined,
5250
+ },
5251
+ update: {
5252
+ id: item.alpacaAccount.user.id !== undefined ? {
5253
+ set: item.alpacaAccount.user.id
5254
+ } : undefined,
5255
+ name: item.alpacaAccount.user.name !== undefined ? {
5256
+ set: item.alpacaAccount.user.name
5257
+ } : undefined,
5258
+ email: item.alpacaAccount.user.email !== undefined ? {
5259
+ set: item.alpacaAccount.user.email
5260
+ } : undefined,
5261
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? {
5262
+ set: item.alpacaAccount.user.emailVerified
5263
+ } : undefined,
5264
+ image: item.alpacaAccount.user.image !== undefined ? {
5265
+ set: item.alpacaAccount.user.image
5266
+ } : undefined,
5267
+ role: item.alpacaAccount.user.role !== undefined ? {
5268
+ set: item.alpacaAccount.user.role
5269
+ } : undefined,
5270
+ bio: item.alpacaAccount.user.bio !== undefined ? {
5271
+ set: item.alpacaAccount.user.bio
5272
+ } : undefined,
5273
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? {
5274
+ set: item.alpacaAccount.user.jobTitle
5275
+ } : undefined,
5276
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? {
5277
+ set: item.alpacaAccount.user.currentAccount
5278
+ } : undefined,
5279
+ plan: item.alpacaAccount.user.plan !== undefined ? {
5280
+ set: item.alpacaAccount.user.plan
5281
+ } : undefined,
5282
+ },
5283
+ create: {
5284
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
5285
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5286
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
5287
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
5288
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
5289
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
5290
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
5291
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
5292
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
5293
+ },
5294
+ }
5295
+ } : undefined,
5296
+ trades: item.alpacaAccount.trades ? {
5297
+ upsert: item.alpacaAccount.trades.map((item) => ({
5298
+ where: {
5299
+ id: item.id !== undefined ? item.id : undefined,
5300
+ },
5301
+ update: {
5302
+ id: item.id !== undefined ? {
5303
+ set: item.id
5304
+ } : undefined,
5305
+ qty: item.qty !== undefined ? {
5306
+ set: item.qty
5307
+ } : undefined,
5308
+ price: item.price !== undefined ? {
5309
+ set: item.price
5310
+ } : undefined,
5311
+ total: item.total !== undefined ? {
5312
+ set: item.total
5313
+ } : undefined,
5314
+ signal: item.signal !== undefined ? {
5315
+ set: item.signal
5316
+ } : undefined,
5317
+ strategy: item.strategy !== undefined ? {
5318
+ set: item.strategy
5319
+ } : undefined,
5320
+ analysis: item.analysis !== undefined ? {
5321
+ set: item.analysis
5322
+ } : undefined,
5323
+ confidence: item.confidence !== undefined ? {
5324
+ set: item.confidence
5325
+ } : undefined,
5326
+ timestamp: item.timestamp !== undefined ? {
5327
+ set: item.timestamp
5328
+ } : undefined,
5329
+ status: item.status !== undefined ? {
5330
+ set: item.status
5331
+ } : undefined,
5332
+ optionContractType: item.optionContractType !== undefined ? {
5333
+ set: item.optionContractType
5334
+ } : undefined,
5335
+ },
5336
+ create: {
5337
+ qty: item.qty !== undefined ? item.qty : undefined,
5338
+ price: item.price !== undefined ? item.price : undefined,
5339
+ total: item.total !== undefined ? item.total : undefined,
5340
+ signal: item.signal !== undefined ? item.signal : undefined,
5341
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5342
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5343
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5344
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5345
+ status: item.status !== undefined ? item.status : undefined,
5346
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5347
+ },
5348
+ }))
5349
+ } : undefined,
5350
+ orders: item.alpacaAccount.orders ? {
5351
+ upsert: item.alpacaAccount.orders.map((item) => ({
5352
+ where: {
5353
+ id: item.id !== undefined ? item.id : undefined,
5354
+ },
5355
+ update: {
5356
+ id: item.id !== undefined ? {
5357
+ set: item.id
5358
+ } : undefined,
5359
+ qty: item.qty !== undefined ? {
5360
+ set: item.qty
5361
+ } : undefined,
5362
+ notional: item.notional !== undefined ? {
5363
+ set: item.notional
5364
+ } : undefined,
5365
+ side: item.side !== undefined ? {
5366
+ set: item.side
5367
+ } : undefined,
5368
+ type: item.type !== undefined ? {
5369
+ set: item.type
5370
+ } : undefined,
5371
+ timeInForce: item.timeInForce !== undefined ? {
5372
+ set: item.timeInForce
5373
+ } : undefined,
5374
+ limitPrice: item.limitPrice !== undefined ? {
5375
+ set: item.limitPrice
5376
+ } : undefined,
5377
+ stopPrice: item.stopPrice !== undefined ? {
5378
+ set: item.stopPrice
5379
+ } : undefined,
5380
+ trailPrice: item.trailPrice !== undefined ? {
5381
+ set: item.trailPrice
5382
+ } : undefined,
5383
+ trailPercent: item.trailPercent !== undefined ? {
5384
+ set: item.trailPercent
5385
+ } : undefined,
5386
+ extendedHours: item.extendedHours !== undefined ? {
5387
+ set: item.extendedHours
5388
+ } : undefined,
5389
+ clientOrderId: item.clientOrderId !== undefined ? {
5390
+ set: item.clientOrderId
5391
+ } : undefined,
5392
+ status: item.status !== undefined ? {
5393
+ set: item.status
5394
+ } : undefined,
5395
+ submittedAt: item.submittedAt !== undefined ? {
5396
+ set: item.submittedAt
5397
+ } : undefined,
5398
+ filledAt: item.filledAt !== undefined ? {
5399
+ set: item.filledAt
5400
+ } : undefined,
5401
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
5402
+ set: item.filledAvgPrice
5403
+ } : undefined,
5404
+ fee: item.fee !== undefined ? {
5405
+ set: item.fee
5406
+ } : undefined,
5407
+ },
5408
+ create: {
5409
+ qty: item.qty !== undefined ? item.qty : undefined,
5410
+ notional: item.notional !== undefined ? item.notional : undefined,
5411
+ side: item.side !== undefined ? item.side : undefined,
5412
+ type: item.type !== undefined ? item.type : undefined,
5413
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
5414
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
5415
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
5416
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
5417
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
5418
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
5419
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5420
+ status: item.status !== undefined ? item.status : undefined,
5421
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
5422
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
5423
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
5424
+ fee: item.fee !== undefined ? item.fee : undefined,
5425
+ },
5426
+ }))
5427
+ } : undefined,
5428
+ alerts: item.alpacaAccount.alerts ? {
5429
+ upsert: item.alpacaAccount.alerts.map((item) => ({
5430
+ where: {
5431
+ id: item.id !== undefined ? item.id : undefined,
5432
+ },
5433
+ update: {
5434
+ id: item.id !== undefined ? {
5435
+ set: item.id
5436
+ } : undefined,
5437
+ message: item.message !== undefined ? {
5438
+ set: item.message
5439
+ } : undefined,
5440
+ type: item.type !== undefined ? {
5441
+ set: item.type
5442
+ } : undefined,
5443
+ isRead: item.isRead !== undefined ? {
5444
+ set: item.isRead
5445
+ } : undefined,
5446
+ },
5447
+ create: {
5448
+ message: item.message !== undefined ? item.message : undefined,
5449
+ type: item.type !== undefined ? item.type : undefined,
5450
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
5451
+ },
5452
+ }))
5453
+ } : undefined,
2342
5454
  },
2343
5455
  create: {
2344
5456
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2346,6 +5458,104 @@ exports.Asset = {
2346
5458
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2347
5459
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2348
5460
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
5461
+ user: item.alpacaAccount.user ?
5462
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
5463
+ ? { connect: {
5464
+ id: item.alpacaAccount.user.id
5465
+ }
5466
+ }
5467
+ : { connectOrCreate: {
5468
+ where: {
5469
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
5470
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5471
+ name: item.alpacaAccount.user.name !== undefined ? {
5472
+ equals: item.alpacaAccount.user.name
5473
+ } : undefined,
5474
+ },
5475
+ create: {
5476
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
5477
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5478
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
5479
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
5480
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
5481
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
5482
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
5483
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
5484
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
5485
+ },
5486
+ }
5487
+ } : undefined,
5488
+ trades: item.alpacaAccount.trades ?
5489
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5490
+ connect: item.alpacaAccount.trades.map((item) => ({
5491
+ id: item.id
5492
+ }))
5493
+ }
5494
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
5495
+ where: {
5496
+ id: item.id !== undefined ? item.id : undefined,
5497
+ },
5498
+ create: {
5499
+ qty: item.qty !== undefined ? item.qty : undefined,
5500
+ price: item.price !== undefined ? item.price : undefined,
5501
+ total: item.total !== undefined ? item.total : undefined,
5502
+ signal: item.signal !== undefined ? item.signal : undefined,
5503
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5504
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5505
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5506
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5507
+ status: item.status !== undefined ? item.status : undefined,
5508
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5509
+ },
5510
+ }))
5511
+ } : undefined,
5512
+ orders: item.alpacaAccount.orders ?
5513
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5514
+ connect: item.alpacaAccount.orders.map((item) => ({
5515
+ id: item.id
5516
+ }))
5517
+ }
5518
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
5519
+ where: {
5520
+ id: item.id !== undefined ? item.id : undefined,
5521
+ },
5522
+ create: {
5523
+ qty: item.qty !== undefined ? item.qty : undefined,
5524
+ notional: item.notional !== undefined ? item.notional : undefined,
5525
+ side: item.side !== undefined ? item.side : undefined,
5526
+ type: item.type !== undefined ? item.type : undefined,
5527
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
5528
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
5529
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
5530
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
5531
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
5532
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
5533
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5534
+ status: item.status !== undefined ? item.status : undefined,
5535
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
5536
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
5537
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
5538
+ fee: item.fee !== undefined ? item.fee : undefined,
5539
+ },
5540
+ }))
5541
+ } : undefined,
5542
+ alerts: item.alpacaAccount.alerts ?
5543
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5544
+ connect: item.alpacaAccount.alerts.map((item) => ({
5545
+ id: item.id
5546
+ }))
5547
+ }
5548
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
5549
+ where: {
5550
+ id: item.id !== undefined ? item.id : undefined,
5551
+ },
5552
+ create: {
5553
+ message: item.message !== undefined ? item.message : undefined,
5554
+ type: item.type !== undefined ? item.type : undefined,
5555
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
5556
+ },
5557
+ }))
5558
+ } : undefined,
2349
5559
  },
2350
5560
  }
2351
5561
  } : undefined,
@@ -2380,6 +5590,104 @@ exports.Asset = {
2380
5590
  APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2381
5591
  configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2382
5592
  marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
5593
+ user: item.alpacaAccount.user ?
5594
+ typeof item.alpacaAccount.user === 'object' && Object.keys(item.alpacaAccount.user).length === 1 && Object.keys(item.alpacaAccount.user)[0] === 'id'
5595
+ ? { connect: {
5596
+ id: item.alpacaAccount.user.id
5597
+ }
5598
+ }
5599
+ : { connectOrCreate: {
5600
+ where: {
5601
+ id: item.alpacaAccount.user.id !== undefined ? item.alpacaAccount.user.id : undefined,
5602
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5603
+ name: item.alpacaAccount.user.name !== undefined ? {
5604
+ equals: item.alpacaAccount.user.name
5605
+ } : undefined,
5606
+ },
5607
+ create: {
5608
+ name: item.alpacaAccount.user.name !== undefined ? item.alpacaAccount.user.name : undefined,
5609
+ email: item.alpacaAccount.user.email !== undefined ? item.alpacaAccount.user.email : undefined,
5610
+ emailVerified: item.alpacaAccount.user.emailVerified !== undefined ? item.alpacaAccount.user.emailVerified : undefined,
5611
+ image: item.alpacaAccount.user.image !== undefined ? item.alpacaAccount.user.image : undefined,
5612
+ role: item.alpacaAccount.user.role !== undefined ? item.alpacaAccount.user.role : undefined,
5613
+ bio: item.alpacaAccount.user.bio !== undefined ? item.alpacaAccount.user.bio : undefined,
5614
+ jobTitle: item.alpacaAccount.user.jobTitle !== undefined ? item.alpacaAccount.user.jobTitle : undefined,
5615
+ currentAccount: item.alpacaAccount.user.currentAccount !== undefined ? item.alpacaAccount.user.currentAccount : undefined,
5616
+ plan: item.alpacaAccount.user.plan !== undefined ? item.alpacaAccount.user.plan : undefined,
5617
+ },
5618
+ }
5619
+ } : undefined,
5620
+ trades: item.alpacaAccount.trades ?
5621
+ Array.isArray(item.alpacaAccount.trades) && item.alpacaAccount.trades.length > 0 && item.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5622
+ connect: item.alpacaAccount.trades.map((item) => ({
5623
+ id: item.id
5624
+ }))
5625
+ }
5626
+ : { connectOrCreate: item.alpacaAccount.trades.map((item) => ({
5627
+ where: {
5628
+ id: item.id !== undefined ? item.id : undefined,
5629
+ },
5630
+ create: {
5631
+ qty: item.qty !== undefined ? item.qty : undefined,
5632
+ price: item.price !== undefined ? item.price : undefined,
5633
+ total: item.total !== undefined ? item.total : undefined,
5634
+ signal: item.signal !== undefined ? item.signal : undefined,
5635
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5636
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5637
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5638
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5639
+ status: item.status !== undefined ? item.status : undefined,
5640
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5641
+ },
5642
+ }))
5643
+ } : undefined,
5644
+ orders: item.alpacaAccount.orders ?
5645
+ Array.isArray(item.alpacaAccount.orders) && item.alpacaAccount.orders.length > 0 && item.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5646
+ connect: item.alpacaAccount.orders.map((item) => ({
5647
+ id: item.id
5648
+ }))
5649
+ }
5650
+ : { connectOrCreate: item.alpacaAccount.orders.map((item) => ({
5651
+ where: {
5652
+ id: item.id !== undefined ? item.id : undefined,
5653
+ },
5654
+ create: {
5655
+ qty: item.qty !== undefined ? item.qty : undefined,
5656
+ notional: item.notional !== undefined ? item.notional : undefined,
5657
+ side: item.side !== undefined ? item.side : undefined,
5658
+ type: item.type !== undefined ? item.type : undefined,
5659
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
5660
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
5661
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
5662
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
5663
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
5664
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
5665
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5666
+ status: item.status !== undefined ? item.status : undefined,
5667
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
5668
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
5669
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
5670
+ fee: item.fee !== undefined ? item.fee : undefined,
5671
+ },
5672
+ }))
5673
+ } : undefined,
5674
+ alerts: item.alpacaAccount.alerts ?
5675
+ Array.isArray(item.alpacaAccount.alerts) && item.alpacaAccount.alerts.length > 0 && item.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5676
+ connect: item.alpacaAccount.alerts.map((item) => ({
5677
+ id: item.id
5678
+ }))
5679
+ }
5680
+ : { connectOrCreate: item.alpacaAccount.alerts.map((item) => ({
5681
+ where: {
5682
+ id: item.id !== undefined ? item.id : undefined,
5683
+ },
5684
+ create: {
5685
+ message: item.message !== undefined ? item.message : undefined,
5686
+ type: item.type !== undefined ? item.type : undefined,
5687
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
5688
+ },
5689
+ }))
5690
+ } : undefined,
2383
5691
  },
2384
5692
  }
2385
5693
  } : undefined,