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