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/Action.mjs CHANGED
@@ -290,6 +290,107 @@ export const Action = {
290
290
  APISecret: props.trade.alpacaAccount.APISecret !== undefined ? props.trade.alpacaAccount.APISecret : undefined,
291
291
  configuration: props.trade.alpacaAccount.configuration !== undefined ? props.trade.alpacaAccount.configuration : undefined,
292
292
  marketOpen: props.trade.alpacaAccount.marketOpen !== undefined ? props.trade.alpacaAccount.marketOpen : undefined,
293
+ user: props.trade.alpacaAccount.user ?
294
+ typeof props.trade.alpacaAccount.user === 'object' && Object.keys(props.trade.alpacaAccount.user).length === 1 && Object.keys(props.trade.alpacaAccount.user)[0] === 'id'
295
+ ? { connect: {
296
+ id: props.trade.alpacaAccount.user.id
297
+ }
298
+ }
299
+ : { connectOrCreate: {
300
+ where: {
301
+ id: props.trade.alpacaAccount.user.id !== undefined ? props.trade.alpacaAccount.user.id : undefined,
302
+ email: props.trade.alpacaAccount.user.email !== undefined ? props.trade.alpacaAccount.user.email : undefined,
303
+ name: props.trade.alpacaAccount.user.name !== undefined ? {
304
+ equals: props.trade.alpacaAccount.user.name
305
+ } : undefined,
306
+ },
307
+ create: {
308
+ name: props.trade.alpacaAccount.user.name !== undefined ? props.trade.alpacaAccount.user.name : undefined,
309
+ email: props.trade.alpacaAccount.user.email !== undefined ? props.trade.alpacaAccount.user.email : undefined,
310
+ emailVerified: props.trade.alpacaAccount.user.emailVerified !== undefined ? props.trade.alpacaAccount.user.emailVerified : undefined,
311
+ image: props.trade.alpacaAccount.user.image !== undefined ? props.trade.alpacaAccount.user.image : undefined,
312
+ role: props.trade.alpacaAccount.user.role !== undefined ? props.trade.alpacaAccount.user.role : undefined,
313
+ bio: props.trade.alpacaAccount.user.bio !== undefined ? props.trade.alpacaAccount.user.bio : undefined,
314
+ jobTitle: props.trade.alpacaAccount.user.jobTitle !== undefined ? props.trade.alpacaAccount.user.jobTitle : undefined,
315
+ currentAccount: props.trade.alpacaAccount.user.currentAccount !== undefined ? props.trade.alpacaAccount.user.currentAccount : undefined,
316
+ plan: props.trade.alpacaAccount.user.plan !== undefined ? props.trade.alpacaAccount.user.plan : undefined,
317
+ },
318
+ }
319
+ } : undefined,
320
+ orders: props.trade.alpacaAccount.orders ?
321
+ Array.isArray(props.trade.alpacaAccount.orders) && props.trade.alpacaAccount.orders.length > 0 && props.trade.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
322
+ connect: props.trade.alpacaAccount.orders.map((item) => ({
323
+ id: item.id
324
+ }))
325
+ }
326
+ : { connectOrCreate: props.trade.alpacaAccount.orders.map((item) => ({
327
+ where: {
328
+ id: item.id !== undefined ? item.id : undefined,
329
+ },
330
+ create: {
331
+ qty: item.qty !== undefined ? item.qty : undefined,
332
+ notional: item.notional !== undefined ? item.notional : undefined,
333
+ side: item.side !== undefined ? item.side : undefined,
334
+ type: item.type !== undefined ? item.type : undefined,
335
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
336
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
337
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
338
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
339
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
340
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
341
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
342
+ status: item.status !== undefined ? item.status : undefined,
343
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
344
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
345
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
346
+ fee: item.fee !== undefined ? item.fee : undefined,
347
+ },
348
+ }))
349
+ } : undefined,
350
+ positions: props.trade.alpacaAccount.positions ?
351
+ Array.isArray(props.trade.alpacaAccount.positions) && props.trade.alpacaAccount.positions.length > 0 && props.trade.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
352
+ connect: props.trade.alpacaAccount.positions.map((item) => ({
353
+ id: item.id
354
+ }))
355
+ }
356
+ : { connectOrCreate: props.trade.alpacaAccount.positions.map((item) => ({
357
+ where: {
358
+ id: item.id !== undefined ? item.id : undefined,
359
+ },
360
+ create: {
361
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
362
+ qty: item.qty !== undefined ? item.qty : undefined,
363
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
364
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
365
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
366
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
367
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
368
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
369
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
370
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
371
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
372
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
373
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
374
+ },
375
+ }))
376
+ } : undefined,
377
+ alerts: props.trade.alpacaAccount.alerts ?
378
+ Array.isArray(props.trade.alpacaAccount.alerts) && props.trade.alpacaAccount.alerts.length > 0 && props.trade.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
379
+ connect: props.trade.alpacaAccount.alerts.map((item) => ({
380
+ id: item.id
381
+ }))
382
+ }
383
+ : { connectOrCreate: props.trade.alpacaAccount.alerts.map((item) => ({
384
+ where: {
385
+ id: item.id !== undefined ? item.id : undefined,
386
+ },
387
+ create: {
388
+ message: item.message !== undefined ? item.message : undefined,
389
+ type: item.type !== undefined ? item.type : undefined,
390
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
391
+ },
392
+ }))
393
+ } : undefined,
293
394
  },
294
395
  }
295
396
  } : undefined,
@@ -361,6 +462,82 @@ export const Action = {
361
462
  exDividendDate: props.trade.asset.exDividendDate !== undefined ? props.trade.asset.exDividendDate : undefined,
362
463
  sellPrice: props.trade.asset.sellPrice !== undefined ? props.trade.asset.sellPrice : undefined,
363
464
  buyPrice: props.trade.asset.buyPrice !== undefined ? props.trade.asset.buyPrice : undefined,
465
+ orders: props.trade.asset.orders ?
466
+ Array.isArray(props.trade.asset.orders) && props.trade.asset.orders.length > 0 && props.trade.asset.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
467
+ connect: props.trade.asset.orders.map((item) => ({
468
+ id: item.id
469
+ }))
470
+ }
471
+ : { connectOrCreate: props.trade.asset.orders.map((item) => ({
472
+ where: {
473
+ id: item.id !== undefined ? item.id : undefined,
474
+ },
475
+ create: {
476
+ qty: item.qty !== undefined ? item.qty : undefined,
477
+ notional: item.notional !== undefined ? item.notional : undefined,
478
+ side: item.side !== undefined ? item.side : undefined,
479
+ type: item.type !== undefined ? item.type : undefined,
480
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
481
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
482
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
483
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
484
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
485
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
486
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
487
+ status: item.status !== undefined ? item.status : undefined,
488
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
489
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
490
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
491
+ fee: item.fee !== undefined ? item.fee : undefined,
492
+ },
493
+ }))
494
+ } : undefined,
495
+ positions: props.trade.asset.positions ?
496
+ Array.isArray(props.trade.asset.positions) && props.trade.asset.positions.length > 0 && props.trade.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
497
+ connect: props.trade.asset.positions.map((item) => ({
498
+ id: item.id
499
+ }))
500
+ }
501
+ : { connectOrCreate: props.trade.asset.positions.map((item) => ({
502
+ where: {
503
+ id: item.id !== undefined ? item.id : undefined,
504
+ },
505
+ create: {
506
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
507
+ qty: item.qty !== undefined ? item.qty : undefined,
508
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
509
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
510
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
511
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
512
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
513
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
514
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
515
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
516
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
517
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
518
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
519
+ },
520
+ }))
521
+ } : undefined,
522
+ newsMentions: props.trade.asset.newsMentions ?
523
+ Array.isArray(props.trade.asset.newsMentions) && props.trade.asset.newsMentions.length > 0 && props.trade.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
524
+ connect: props.trade.asset.newsMentions.map((item) => ({
525
+ id: item.id
526
+ }))
527
+ }
528
+ : { connectOrCreate: props.trade.asset.newsMentions.map((item) => ({
529
+ where: {
530
+ id: item.id !== undefined ? item.id : undefined,
531
+ url: item.url !== undefined ? item.url : undefined,
532
+ },
533
+ create: {
534
+ url: item.url !== undefined ? item.url : undefined,
535
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
536
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
537
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
538
+ },
539
+ }))
540
+ } : undefined,
364
541
  },
365
542
  }
366
543
  } : undefined,
@@ -410,6 +587,101 @@ export const Action = {
410
587
  APISecret: props.order.alpacaAccount.APISecret !== undefined ? props.order.alpacaAccount.APISecret : undefined,
411
588
  configuration: props.order.alpacaAccount.configuration !== undefined ? props.order.alpacaAccount.configuration : undefined,
412
589
  marketOpen: props.order.alpacaAccount.marketOpen !== undefined ? props.order.alpacaAccount.marketOpen : undefined,
590
+ user: props.order.alpacaAccount.user ?
591
+ typeof props.order.alpacaAccount.user === 'object' && Object.keys(props.order.alpacaAccount.user).length === 1 && Object.keys(props.order.alpacaAccount.user)[0] === 'id'
592
+ ? { connect: {
593
+ id: props.order.alpacaAccount.user.id
594
+ }
595
+ }
596
+ : { connectOrCreate: {
597
+ where: {
598
+ id: props.order.alpacaAccount.user.id !== undefined ? props.order.alpacaAccount.user.id : undefined,
599
+ email: props.order.alpacaAccount.user.email !== undefined ? props.order.alpacaAccount.user.email : undefined,
600
+ name: props.order.alpacaAccount.user.name !== undefined ? {
601
+ equals: props.order.alpacaAccount.user.name
602
+ } : undefined,
603
+ },
604
+ create: {
605
+ name: props.order.alpacaAccount.user.name !== undefined ? props.order.alpacaAccount.user.name : undefined,
606
+ email: props.order.alpacaAccount.user.email !== undefined ? props.order.alpacaAccount.user.email : undefined,
607
+ emailVerified: props.order.alpacaAccount.user.emailVerified !== undefined ? props.order.alpacaAccount.user.emailVerified : undefined,
608
+ image: props.order.alpacaAccount.user.image !== undefined ? props.order.alpacaAccount.user.image : undefined,
609
+ role: props.order.alpacaAccount.user.role !== undefined ? props.order.alpacaAccount.user.role : undefined,
610
+ bio: props.order.alpacaAccount.user.bio !== undefined ? props.order.alpacaAccount.user.bio : undefined,
611
+ jobTitle: props.order.alpacaAccount.user.jobTitle !== undefined ? props.order.alpacaAccount.user.jobTitle : undefined,
612
+ currentAccount: props.order.alpacaAccount.user.currentAccount !== undefined ? props.order.alpacaAccount.user.currentAccount : undefined,
613
+ plan: props.order.alpacaAccount.user.plan !== undefined ? props.order.alpacaAccount.user.plan : undefined,
614
+ },
615
+ }
616
+ } : undefined,
617
+ trades: props.order.alpacaAccount.trades ?
618
+ Array.isArray(props.order.alpacaAccount.trades) && props.order.alpacaAccount.trades.length > 0 && props.order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
619
+ connect: props.order.alpacaAccount.trades.map((item) => ({
620
+ id: item.id
621
+ }))
622
+ }
623
+ : { connectOrCreate: props.order.alpacaAccount.trades.map((item) => ({
624
+ where: {
625
+ id: item.id !== undefined ? item.id : undefined,
626
+ },
627
+ create: {
628
+ qty: item.qty !== undefined ? item.qty : undefined,
629
+ price: item.price !== undefined ? item.price : undefined,
630
+ total: item.total !== undefined ? item.total : undefined,
631
+ signal: item.signal !== undefined ? item.signal : undefined,
632
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
633
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
634
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
635
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
636
+ status: item.status !== undefined ? item.status : undefined,
637
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
638
+ },
639
+ }))
640
+ } : undefined,
641
+ positions: props.order.alpacaAccount.positions ?
642
+ Array.isArray(props.order.alpacaAccount.positions) && props.order.alpacaAccount.positions.length > 0 && props.order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
643
+ connect: props.order.alpacaAccount.positions.map((item) => ({
644
+ id: item.id
645
+ }))
646
+ }
647
+ : { connectOrCreate: props.order.alpacaAccount.positions.map((item) => ({
648
+ where: {
649
+ id: item.id !== undefined ? item.id : undefined,
650
+ },
651
+ create: {
652
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
653
+ qty: item.qty !== undefined ? item.qty : undefined,
654
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
655
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
656
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
657
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
658
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
659
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
660
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
661
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
662
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
663
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
664
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
665
+ },
666
+ }))
667
+ } : undefined,
668
+ alerts: props.order.alpacaAccount.alerts ?
669
+ Array.isArray(props.order.alpacaAccount.alerts) && props.order.alpacaAccount.alerts.length > 0 && props.order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
670
+ connect: props.order.alpacaAccount.alerts.map((item) => ({
671
+ id: item.id
672
+ }))
673
+ }
674
+ : { connectOrCreate: props.order.alpacaAccount.alerts.map((item) => ({
675
+ where: {
676
+ id: item.id !== undefined ? item.id : undefined,
677
+ },
678
+ create: {
679
+ message: item.message !== undefined ? item.message : undefined,
680
+ type: item.type !== undefined ? item.type : undefined,
681
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
682
+ },
683
+ }))
684
+ } : undefined,
413
685
  },
414
686
  }
415
687
  } : undefined,
@@ -481,6 +753,76 @@ export const Action = {
481
753
  exDividendDate: props.order.asset.exDividendDate !== undefined ? props.order.asset.exDividendDate : undefined,
482
754
  sellPrice: props.order.asset.sellPrice !== undefined ? props.order.asset.sellPrice : undefined,
483
755
  buyPrice: props.order.asset.buyPrice !== undefined ? props.order.asset.buyPrice : undefined,
756
+ trades: props.order.asset.trades ?
757
+ Array.isArray(props.order.asset.trades) && props.order.asset.trades.length > 0 && props.order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
758
+ connect: props.order.asset.trades.map((item) => ({
759
+ id: item.id
760
+ }))
761
+ }
762
+ : { connectOrCreate: props.order.asset.trades.map((item) => ({
763
+ where: {
764
+ id: item.id !== undefined ? item.id : undefined,
765
+ },
766
+ create: {
767
+ qty: item.qty !== undefined ? item.qty : undefined,
768
+ price: item.price !== undefined ? item.price : undefined,
769
+ total: item.total !== undefined ? item.total : undefined,
770
+ signal: item.signal !== undefined ? item.signal : undefined,
771
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
772
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
773
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
774
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
775
+ status: item.status !== undefined ? item.status : undefined,
776
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
777
+ },
778
+ }))
779
+ } : undefined,
780
+ positions: props.order.asset.positions ?
781
+ Array.isArray(props.order.asset.positions) && props.order.asset.positions.length > 0 && props.order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
782
+ connect: props.order.asset.positions.map((item) => ({
783
+ id: item.id
784
+ }))
785
+ }
786
+ : { connectOrCreate: props.order.asset.positions.map((item) => ({
787
+ where: {
788
+ id: item.id !== undefined ? item.id : undefined,
789
+ },
790
+ create: {
791
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
792
+ qty: item.qty !== undefined ? item.qty : undefined,
793
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
794
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
795
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
796
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
797
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
798
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
799
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
800
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
801
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
802
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
803
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
804
+ },
805
+ }))
806
+ } : undefined,
807
+ newsMentions: props.order.asset.newsMentions ?
808
+ Array.isArray(props.order.asset.newsMentions) && props.order.asset.newsMentions.length > 0 && props.order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
809
+ connect: props.order.asset.newsMentions.map((item) => ({
810
+ id: item.id
811
+ }))
812
+ }
813
+ : { connectOrCreate: props.order.asset.newsMentions.map((item) => ({
814
+ where: {
815
+ id: item.id !== undefined ? item.id : undefined,
816
+ url: item.url !== undefined ? item.url : undefined,
817
+ },
818
+ create: {
819
+ url: item.url !== undefined ? item.url : undefined,
820
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
821
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
822
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
823
+ },
824
+ }))
825
+ } : undefined,
484
826
  },
485
827
  }
486
828
  } : undefined,
@@ -875,6 +1217,234 @@ export const Action = {
875
1217
  marketOpen: props.trade.alpacaAccount.marketOpen !== undefined ? {
876
1218
  set: props.trade.alpacaAccount.marketOpen
877
1219
  } : undefined,
1220
+ user: props.trade.alpacaAccount.user ? {
1221
+ upsert: {
1222
+ where: {
1223
+ id: props.trade.alpacaAccount.user.id !== undefined ? {
1224
+ equals: props.trade.alpacaAccount.user.id
1225
+ } : undefined,
1226
+ name: props.trade.alpacaAccount.user.name !== undefined ? {
1227
+ equals: props.trade.alpacaAccount.user.name
1228
+ } : undefined,
1229
+ email: props.trade.alpacaAccount.user.email !== undefined ? {
1230
+ equals: props.trade.alpacaAccount.user.email
1231
+ } : undefined,
1232
+ },
1233
+ update: {
1234
+ id: props.trade.alpacaAccount.user.id !== undefined ? {
1235
+ set: props.trade.alpacaAccount.user.id
1236
+ } : undefined,
1237
+ name: props.trade.alpacaAccount.user.name !== undefined ? {
1238
+ set: props.trade.alpacaAccount.user.name
1239
+ } : undefined,
1240
+ email: props.trade.alpacaAccount.user.email !== undefined ? {
1241
+ set: props.trade.alpacaAccount.user.email
1242
+ } : undefined,
1243
+ emailVerified: props.trade.alpacaAccount.user.emailVerified !== undefined ? {
1244
+ set: props.trade.alpacaAccount.user.emailVerified
1245
+ } : undefined,
1246
+ image: props.trade.alpacaAccount.user.image !== undefined ? {
1247
+ set: props.trade.alpacaAccount.user.image
1248
+ } : undefined,
1249
+ role: props.trade.alpacaAccount.user.role !== undefined ? {
1250
+ set: props.trade.alpacaAccount.user.role
1251
+ } : undefined,
1252
+ bio: props.trade.alpacaAccount.user.bio !== undefined ? {
1253
+ set: props.trade.alpacaAccount.user.bio
1254
+ } : undefined,
1255
+ jobTitle: props.trade.alpacaAccount.user.jobTitle !== undefined ? {
1256
+ set: props.trade.alpacaAccount.user.jobTitle
1257
+ } : undefined,
1258
+ currentAccount: props.trade.alpacaAccount.user.currentAccount !== undefined ? {
1259
+ set: props.trade.alpacaAccount.user.currentAccount
1260
+ } : undefined,
1261
+ plan: props.trade.alpacaAccount.user.plan !== undefined ? {
1262
+ set: props.trade.alpacaAccount.user.plan
1263
+ } : undefined,
1264
+ },
1265
+ create: {
1266
+ name: props.trade.alpacaAccount.user.name !== undefined ? props.trade.alpacaAccount.user.name : undefined,
1267
+ email: props.trade.alpacaAccount.user.email !== undefined ? props.trade.alpacaAccount.user.email : undefined,
1268
+ emailVerified: props.trade.alpacaAccount.user.emailVerified !== undefined ? props.trade.alpacaAccount.user.emailVerified : undefined,
1269
+ image: props.trade.alpacaAccount.user.image !== undefined ? props.trade.alpacaAccount.user.image : undefined,
1270
+ role: props.trade.alpacaAccount.user.role !== undefined ? props.trade.alpacaAccount.user.role : undefined,
1271
+ bio: props.trade.alpacaAccount.user.bio !== undefined ? props.trade.alpacaAccount.user.bio : undefined,
1272
+ jobTitle: props.trade.alpacaAccount.user.jobTitle !== undefined ? props.trade.alpacaAccount.user.jobTitle : undefined,
1273
+ currentAccount: props.trade.alpacaAccount.user.currentAccount !== undefined ? props.trade.alpacaAccount.user.currentAccount : undefined,
1274
+ plan: props.trade.alpacaAccount.user.plan !== undefined ? props.trade.alpacaAccount.user.plan : undefined,
1275
+ },
1276
+ }
1277
+ } : undefined,
1278
+ orders: props.trade.alpacaAccount.orders ? {
1279
+ upsert: props.trade.alpacaAccount.orders.map((item) => ({
1280
+ where: {
1281
+ id: item.id !== undefined ? item.id : undefined,
1282
+ },
1283
+ update: {
1284
+ id: item.id !== undefined ? {
1285
+ set: item.id
1286
+ } : undefined,
1287
+ qty: item.qty !== undefined ? {
1288
+ set: item.qty
1289
+ } : undefined,
1290
+ notional: item.notional !== undefined ? {
1291
+ set: item.notional
1292
+ } : undefined,
1293
+ side: item.side !== undefined ? {
1294
+ set: item.side
1295
+ } : undefined,
1296
+ type: item.type !== undefined ? {
1297
+ set: item.type
1298
+ } : undefined,
1299
+ timeInForce: item.timeInForce !== undefined ? {
1300
+ set: item.timeInForce
1301
+ } : undefined,
1302
+ limitPrice: item.limitPrice !== undefined ? {
1303
+ set: item.limitPrice
1304
+ } : undefined,
1305
+ stopPrice: item.stopPrice !== undefined ? {
1306
+ set: item.stopPrice
1307
+ } : undefined,
1308
+ trailPrice: item.trailPrice !== undefined ? {
1309
+ set: item.trailPrice
1310
+ } : undefined,
1311
+ trailPercent: item.trailPercent !== undefined ? {
1312
+ set: item.trailPercent
1313
+ } : undefined,
1314
+ extendedHours: item.extendedHours !== undefined ? {
1315
+ set: item.extendedHours
1316
+ } : undefined,
1317
+ clientOrderId: item.clientOrderId !== undefined ? {
1318
+ set: item.clientOrderId
1319
+ } : undefined,
1320
+ status: item.status !== undefined ? {
1321
+ set: item.status
1322
+ } : undefined,
1323
+ submittedAt: item.submittedAt !== undefined ? {
1324
+ set: item.submittedAt
1325
+ } : undefined,
1326
+ filledAt: item.filledAt !== undefined ? {
1327
+ set: item.filledAt
1328
+ } : undefined,
1329
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
1330
+ set: item.filledAvgPrice
1331
+ } : undefined,
1332
+ fee: item.fee !== undefined ? {
1333
+ set: item.fee
1334
+ } : undefined,
1335
+ },
1336
+ create: {
1337
+ qty: item.qty !== undefined ? item.qty : undefined,
1338
+ notional: item.notional !== undefined ? item.notional : undefined,
1339
+ side: item.side !== undefined ? item.side : undefined,
1340
+ type: item.type !== undefined ? item.type : undefined,
1341
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1342
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1343
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1344
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1345
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1346
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1347
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1348
+ status: item.status !== undefined ? item.status : undefined,
1349
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1350
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1351
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1352
+ fee: item.fee !== undefined ? item.fee : undefined,
1353
+ },
1354
+ }))
1355
+ } : undefined,
1356
+ positions: props.trade.alpacaAccount.positions ? {
1357
+ upsert: props.trade.alpacaAccount.positions.map((item) => ({
1358
+ where: {
1359
+ id: item.id !== undefined ? item.id : undefined,
1360
+ },
1361
+ update: {
1362
+ id: item.id !== undefined ? {
1363
+ set: item.id
1364
+ } : undefined,
1365
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
1366
+ set: item.averageEntryPrice
1367
+ } : undefined,
1368
+ qty: item.qty !== undefined ? {
1369
+ set: item.qty
1370
+ } : undefined,
1371
+ qtyAvailable: item.qtyAvailable !== undefined ? {
1372
+ set: item.qtyAvailable
1373
+ } : undefined,
1374
+ marketValue: item.marketValue !== undefined ? {
1375
+ set: item.marketValue
1376
+ } : undefined,
1377
+ costBasis: item.costBasis !== undefined ? {
1378
+ set: item.costBasis
1379
+ } : undefined,
1380
+ unrealizedPL: item.unrealizedPL !== undefined ? {
1381
+ set: item.unrealizedPL
1382
+ } : undefined,
1383
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
1384
+ set: item.unrealizedPLPC
1385
+ } : undefined,
1386
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
1387
+ set: item.unrealisedIntradayPL
1388
+ } : undefined,
1389
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
1390
+ set: item.unrealisedIntradayPLPC
1391
+ } : undefined,
1392
+ currentPrice: item.currentPrice !== undefined ? {
1393
+ set: item.currentPrice
1394
+ } : undefined,
1395
+ lastTradePrice: item.lastTradePrice !== undefined ? {
1396
+ set: item.lastTradePrice
1397
+ } : undefined,
1398
+ changeToday: item.changeToday !== undefined ? {
1399
+ set: item.changeToday
1400
+ } : undefined,
1401
+ assetMarginable: item.assetMarginable !== undefined ? {
1402
+ set: item.assetMarginable
1403
+ } : undefined,
1404
+ },
1405
+ create: {
1406
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1407
+ qty: item.qty !== undefined ? item.qty : undefined,
1408
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1409
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1410
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1411
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1412
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1413
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1414
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1415
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1416
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1417
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1418
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1419
+ },
1420
+ }))
1421
+ } : undefined,
1422
+ alerts: props.trade.alpacaAccount.alerts ? {
1423
+ upsert: props.trade.alpacaAccount.alerts.map((item) => ({
1424
+ where: {
1425
+ id: item.id !== undefined ? item.id : undefined,
1426
+ },
1427
+ update: {
1428
+ id: item.id !== undefined ? {
1429
+ set: item.id
1430
+ } : undefined,
1431
+ message: item.message !== undefined ? {
1432
+ set: item.message
1433
+ } : undefined,
1434
+ type: item.type !== undefined ? {
1435
+ set: item.type
1436
+ } : undefined,
1437
+ isRead: item.isRead !== undefined ? {
1438
+ set: item.isRead
1439
+ } : undefined,
1440
+ },
1441
+ create: {
1442
+ message: item.message !== undefined ? item.message : undefined,
1443
+ type: item.type !== undefined ? item.type : undefined,
1444
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
1445
+ },
1446
+ }))
1447
+ } : undefined,
878
1448
  },
879
1449
  create: {
880
1450
  type: props.trade.alpacaAccount.type !== undefined ? props.trade.alpacaAccount.type : undefined,
@@ -882,6 +1452,107 @@ export const Action = {
882
1452
  APISecret: props.trade.alpacaAccount.APISecret !== undefined ? props.trade.alpacaAccount.APISecret : undefined,
883
1453
  configuration: props.trade.alpacaAccount.configuration !== undefined ? props.trade.alpacaAccount.configuration : undefined,
884
1454
  marketOpen: props.trade.alpacaAccount.marketOpen !== undefined ? props.trade.alpacaAccount.marketOpen : undefined,
1455
+ user: props.trade.alpacaAccount.user ?
1456
+ typeof props.trade.alpacaAccount.user === 'object' && Object.keys(props.trade.alpacaAccount.user).length === 1 && Object.keys(props.trade.alpacaAccount.user)[0] === 'id'
1457
+ ? { connect: {
1458
+ id: props.trade.alpacaAccount.user.id
1459
+ }
1460
+ }
1461
+ : { connectOrCreate: {
1462
+ where: {
1463
+ id: props.trade.alpacaAccount.user.id !== undefined ? props.trade.alpacaAccount.user.id : undefined,
1464
+ email: props.trade.alpacaAccount.user.email !== undefined ? props.trade.alpacaAccount.user.email : undefined,
1465
+ name: props.trade.alpacaAccount.user.name !== undefined ? {
1466
+ equals: props.trade.alpacaAccount.user.name
1467
+ } : undefined,
1468
+ },
1469
+ create: {
1470
+ name: props.trade.alpacaAccount.user.name !== undefined ? props.trade.alpacaAccount.user.name : undefined,
1471
+ email: props.trade.alpacaAccount.user.email !== undefined ? props.trade.alpacaAccount.user.email : undefined,
1472
+ emailVerified: props.trade.alpacaAccount.user.emailVerified !== undefined ? props.trade.alpacaAccount.user.emailVerified : undefined,
1473
+ image: props.trade.alpacaAccount.user.image !== undefined ? props.trade.alpacaAccount.user.image : undefined,
1474
+ role: props.trade.alpacaAccount.user.role !== undefined ? props.trade.alpacaAccount.user.role : undefined,
1475
+ bio: props.trade.alpacaAccount.user.bio !== undefined ? props.trade.alpacaAccount.user.bio : undefined,
1476
+ jobTitle: props.trade.alpacaAccount.user.jobTitle !== undefined ? props.trade.alpacaAccount.user.jobTitle : undefined,
1477
+ currentAccount: props.trade.alpacaAccount.user.currentAccount !== undefined ? props.trade.alpacaAccount.user.currentAccount : undefined,
1478
+ plan: props.trade.alpacaAccount.user.plan !== undefined ? props.trade.alpacaAccount.user.plan : undefined,
1479
+ },
1480
+ }
1481
+ } : undefined,
1482
+ orders: props.trade.alpacaAccount.orders ?
1483
+ Array.isArray(props.trade.alpacaAccount.orders) && props.trade.alpacaAccount.orders.length > 0 && props.trade.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1484
+ connect: props.trade.alpacaAccount.orders.map((item) => ({
1485
+ id: item.id
1486
+ }))
1487
+ }
1488
+ : { connectOrCreate: props.trade.alpacaAccount.orders.map((item) => ({
1489
+ where: {
1490
+ id: item.id !== undefined ? item.id : undefined,
1491
+ },
1492
+ create: {
1493
+ qty: item.qty !== undefined ? item.qty : undefined,
1494
+ notional: item.notional !== undefined ? item.notional : undefined,
1495
+ side: item.side !== undefined ? item.side : undefined,
1496
+ type: item.type !== undefined ? item.type : undefined,
1497
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1498
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1499
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1500
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1501
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1502
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1503
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1504
+ status: item.status !== undefined ? item.status : undefined,
1505
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1506
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1507
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1508
+ fee: item.fee !== undefined ? item.fee : undefined,
1509
+ },
1510
+ }))
1511
+ } : undefined,
1512
+ positions: props.trade.alpacaAccount.positions ?
1513
+ Array.isArray(props.trade.alpacaAccount.positions) && props.trade.alpacaAccount.positions.length > 0 && props.trade.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1514
+ connect: props.trade.alpacaAccount.positions.map((item) => ({
1515
+ id: item.id
1516
+ }))
1517
+ }
1518
+ : { connectOrCreate: props.trade.alpacaAccount.positions.map((item) => ({
1519
+ where: {
1520
+ id: item.id !== undefined ? item.id : undefined,
1521
+ },
1522
+ create: {
1523
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1524
+ qty: item.qty !== undefined ? item.qty : undefined,
1525
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1526
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1527
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1528
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1529
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1530
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1531
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1532
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1533
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1534
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1535
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1536
+ },
1537
+ }))
1538
+ } : undefined,
1539
+ alerts: props.trade.alpacaAccount.alerts ?
1540
+ Array.isArray(props.trade.alpacaAccount.alerts) && props.trade.alpacaAccount.alerts.length > 0 && props.trade.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1541
+ connect: props.trade.alpacaAccount.alerts.map((item) => ({
1542
+ id: item.id
1543
+ }))
1544
+ }
1545
+ : { connectOrCreate: props.trade.alpacaAccount.alerts.map((item) => ({
1546
+ where: {
1547
+ id: item.id !== undefined ? item.id : undefined,
1548
+ },
1549
+ create: {
1550
+ message: item.message !== undefined ? item.message : undefined,
1551
+ type: item.type !== undefined ? item.type : undefined,
1552
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
1553
+ },
1554
+ }))
1555
+ } : undefined,
885
1556
  },
886
1557
  }
887
1558
  } : undefined,
@@ -1067,6 +1738,181 @@ export const Action = {
1067
1738
  buyPrice: props.trade.asset.buyPrice !== undefined ? {
1068
1739
  set: props.trade.asset.buyPrice
1069
1740
  } : undefined,
1741
+ orders: props.trade.asset.orders ? {
1742
+ upsert: props.trade.asset.orders.map((item) => ({
1743
+ where: {
1744
+ id: item.id !== undefined ? item.id : undefined,
1745
+ },
1746
+ update: {
1747
+ id: item.id !== undefined ? {
1748
+ set: item.id
1749
+ } : undefined,
1750
+ qty: item.qty !== undefined ? {
1751
+ set: item.qty
1752
+ } : undefined,
1753
+ notional: item.notional !== undefined ? {
1754
+ set: item.notional
1755
+ } : undefined,
1756
+ side: item.side !== undefined ? {
1757
+ set: item.side
1758
+ } : undefined,
1759
+ type: item.type !== undefined ? {
1760
+ set: item.type
1761
+ } : undefined,
1762
+ timeInForce: item.timeInForce !== undefined ? {
1763
+ set: item.timeInForce
1764
+ } : undefined,
1765
+ limitPrice: item.limitPrice !== undefined ? {
1766
+ set: item.limitPrice
1767
+ } : undefined,
1768
+ stopPrice: item.stopPrice !== undefined ? {
1769
+ set: item.stopPrice
1770
+ } : undefined,
1771
+ trailPrice: item.trailPrice !== undefined ? {
1772
+ set: item.trailPrice
1773
+ } : undefined,
1774
+ trailPercent: item.trailPercent !== undefined ? {
1775
+ set: item.trailPercent
1776
+ } : undefined,
1777
+ extendedHours: item.extendedHours !== undefined ? {
1778
+ set: item.extendedHours
1779
+ } : undefined,
1780
+ clientOrderId: item.clientOrderId !== undefined ? {
1781
+ set: item.clientOrderId
1782
+ } : undefined,
1783
+ status: item.status !== undefined ? {
1784
+ set: item.status
1785
+ } : undefined,
1786
+ submittedAt: item.submittedAt !== undefined ? {
1787
+ set: item.submittedAt
1788
+ } : undefined,
1789
+ filledAt: item.filledAt !== undefined ? {
1790
+ set: item.filledAt
1791
+ } : undefined,
1792
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
1793
+ set: item.filledAvgPrice
1794
+ } : undefined,
1795
+ fee: item.fee !== undefined ? {
1796
+ set: item.fee
1797
+ } : undefined,
1798
+ },
1799
+ create: {
1800
+ qty: item.qty !== undefined ? item.qty : undefined,
1801
+ notional: item.notional !== undefined ? item.notional : undefined,
1802
+ side: item.side !== undefined ? item.side : undefined,
1803
+ type: item.type !== undefined ? item.type : undefined,
1804
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1805
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1806
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1807
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1808
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1809
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1810
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1811
+ status: item.status !== undefined ? item.status : undefined,
1812
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1813
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1814
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1815
+ fee: item.fee !== undefined ? item.fee : undefined,
1816
+ },
1817
+ }))
1818
+ } : undefined,
1819
+ positions: props.trade.asset.positions ? {
1820
+ upsert: props.trade.asset.positions.map((item) => ({
1821
+ where: {
1822
+ id: item.id !== undefined ? item.id : undefined,
1823
+ },
1824
+ update: {
1825
+ id: item.id !== undefined ? {
1826
+ set: item.id
1827
+ } : undefined,
1828
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
1829
+ set: item.averageEntryPrice
1830
+ } : undefined,
1831
+ qty: item.qty !== undefined ? {
1832
+ set: item.qty
1833
+ } : undefined,
1834
+ qtyAvailable: item.qtyAvailable !== undefined ? {
1835
+ set: item.qtyAvailable
1836
+ } : undefined,
1837
+ marketValue: item.marketValue !== undefined ? {
1838
+ set: item.marketValue
1839
+ } : undefined,
1840
+ costBasis: item.costBasis !== undefined ? {
1841
+ set: item.costBasis
1842
+ } : undefined,
1843
+ unrealizedPL: item.unrealizedPL !== undefined ? {
1844
+ set: item.unrealizedPL
1845
+ } : undefined,
1846
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
1847
+ set: item.unrealizedPLPC
1848
+ } : undefined,
1849
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
1850
+ set: item.unrealisedIntradayPL
1851
+ } : undefined,
1852
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
1853
+ set: item.unrealisedIntradayPLPC
1854
+ } : undefined,
1855
+ currentPrice: item.currentPrice !== undefined ? {
1856
+ set: item.currentPrice
1857
+ } : undefined,
1858
+ lastTradePrice: item.lastTradePrice !== undefined ? {
1859
+ set: item.lastTradePrice
1860
+ } : undefined,
1861
+ changeToday: item.changeToday !== undefined ? {
1862
+ set: item.changeToday
1863
+ } : undefined,
1864
+ assetMarginable: item.assetMarginable !== undefined ? {
1865
+ set: item.assetMarginable
1866
+ } : undefined,
1867
+ },
1868
+ create: {
1869
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1870
+ qty: item.qty !== undefined ? item.qty : undefined,
1871
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1872
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1873
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1874
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1875
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1876
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1877
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1878
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1879
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1880
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1881
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1882
+ },
1883
+ }))
1884
+ } : undefined,
1885
+ newsMentions: props.trade.asset.newsMentions ? {
1886
+ upsert: props.trade.asset.newsMentions.map((item) => ({
1887
+ where: {
1888
+ id: item.id !== undefined ? item.id : undefined,
1889
+ url: item.url !== undefined ? item.url : undefined,
1890
+ },
1891
+ update: {
1892
+ id: item.id !== undefined ? {
1893
+ set: item.id
1894
+ } : undefined,
1895
+ url: item.url !== undefined ? {
1896
+ set: item.url
1897
+ } : undefined,
1898
+ relevancyScore: item.relevancyScore !== undefined ? {
1899
+ set: item.relevancyScore
1900
+ } : undefined,
1901
+ sentimentScore: item.sentimentScore !== undefined ? {
1902
+ set: item.sentimentScore
1903
+ } : undefined,
1904
+ sentimentLabel: item.sentimentLabel !== undefined ? {
1905
+ set: item.sentimentLabel
1906
+ } : undefined,
1907
+ },
1908
+ create: {
1909
+ url: item.url !== undefined ? item.url : undefined,
1910
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
1911
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
1912
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
1913
+ },
1914
+ }))
1915
+ } : undefined,
1070
1916
  },
1071
1917
  create: {
1072
1918
  symbol: props.trade.asset.symbol !== undefined ? props.trade.asset.symbol : undefined,
@@ -1124,6 +1970,82 @@ export const Action = {
1124
1970
  exDividendDate: props.trade.asset.exDividendDate !== undefined ? props.trade.asset.exDividendDate : undefined,
1125
1971
  sellPrice: props.trade.asset.sellPrice !== undefined ? props.trade.asset.sellPrice : undefined,
1126
1972
  buyPrice: props.trade.asset.buyPrice !== undefined ? props.trade.asset.buyPrice : undefined,
1973
+ orders: props.trade.asset.orders ?
1974
+ Array.isArray(props.trade.asset.orders) && props.trade.asset.orders.length > 0 && props.trade.asset.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1975
+ connect: props.trade.asset.orders.map((item) => ({
1976
+ id: item.id
1977
+ }))
1978
+ }
1979
+ : { connectOrCreate: props.trade.asset.orders.map((item) => ({
1980
+ where: {
1981
+ id: item.id !== undefined ? item.id : undefined,
1982
+ },
1983
+ create: {
1984
+ qty: item.qty !== undefined ? item.qty : undefined,
1985
+ notional: item.notional !== undefined ? item.notional : undefined,
1986
+ side: item.side !== undefined ? item.side : undefined,
1987
+ type: item.type !== undefined ? item.type : undefined,
1988
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1989
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1990
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1991
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1992
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1993
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1994
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1995
+ status: item.status !== undefined ? item.status : undefined,
1996
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1997
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1998
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1999
+ fee: item.fee !== undefined ? item.fee : undefined,
2000
+ },
2001
+ }))
2002
+ } : undefined,
2003
+ positions: props.trade.asset.positions ?
2004
+ Array.isArray(props.trade.asset.positions) && props.trade.asset.positions.length > 0 && props.trade.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2005
+ connect: props.trade.asset.positions.map((item) => ({
2006
+ id: item.id
2007
+ }))
2008
+ }
2009
+ : { connectOrCreate: props.trade.asset.positions.map((item) => ({
2010
+ where: {
2011
+ id: item.id !== undefined ? item.id : undefined,
2012
+ },
2013
+ create: {
2014
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2015
+ qty: item.qty !== undefined ? item.qty : undefined,
2016
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2017
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2018
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2019
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2020
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2021
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2022
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2023
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2024
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2025
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2026
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2027
+ },
2028
+ }))
2029
+ } : undefined,
2030
+ newsMentions: props.trade.asset.newsMentions ?
2031
+ Array.isArray(props.trade.asset.newsMentions) && props.trade.asset.newsMentions.length > 0 && props.trade.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2032
+ connect: props.trade.asset.newsMentions.map((item) => ({
2033
+ id: item.id
2034
+ }))
2035
+ }
2036
+ : { connectOrCreate: props.trade.asset.newsMentions.map((item) => ({
2037
+ where: {
2038
+ id: item.id !== undefined ? item.id : undefined,
2039
+ url: item.url !== undefined ? item.url : undefined,
2040
+ },
2041
+ create: {
2042
+ url: item.url !== undefined ? item.url : undefined,
2043
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
2044
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
2045
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
2046
+ },
2047
+ }))
2048
+ } : undefined,
1127
2049
  },
1128
2050
  }
1129
2051
  } : undefined,
@@ -1155,6 +2077,107 @@ export const Action = {
1155
2077
  APISecret: props.trade.alpacaAccount.APISecret !== undefined ? props.trade.alpacaAccount.APISecret : undefined,
1156
2078
  configuration: props.trade.alpacaAccount.configuration !== undefined ? props.trade.alpacaAccount.configuration : undefined,
1157
2079
  marketOpen: props.trade.alpacaAccount.marketOpen !== undefined ? props.trade.alpacaAccount.marketOpen : undefined,
2080
+ user: props.trade.alpacaAccount.user ?
2081
+ typeof props.trade.alpacaAccount.user === 'object' && Object.keys(props.trade.alpacaAccount.user).length === 1 && Object.keys(props.trade.alpacaAccount.user)[0] === 'id'
2082
+ ? { connect: {
2083
+ id: props.trade.alpacaAccount.user.id
2084
+ }
2085
+ }
2086
+ : { connectOrCreate: {
2087
+ where: {
2088
+ id: props.trade.alpacaAccount.user.id !== undefined ? props.trade.alpacaAccount.user.id : undefined,
2089
+ email: props.trade.alpacaAccount.user.email !== undefined ? props.trade.alpacaAccount.user.email : undefined,
2090
+ name: props.trade.alpacaAccount.user.name !== undefined ? {
2091
+ equals: props.trade.alpacaAccount.user.name
2092
+ } : undefined,
2093
+ },
2094
+ create: {
2095
+ name: props.trade.alpacaAccount.user.name !== undefined ? props.trade.alpacaAccount.user.name : undefined,
2096
+ email: props.trade.alpacaAccount.user.email !== undefined ? props.trade.alpacaAccount.user.email : undefined,
2097
+ emailVerified: props.trade.alpacaAccount.user.emailVerified !== undefined ? props.trade.alpacaAccount.user.emailVerified : undefined,
2098
+ image: props.trade.alpacaAccount.user.image !== undefined ? props.trade.alpacaAccount.user.image : undefined,
2099
+ role: props.trade.alpacaAccount.user.role !== undefined ? props.trade.alpacaAccount.user.role : undefined,
2100
+ bio: props.trade.alpacaAccount.user.bio !== undefined ? props.trade.alpacaAccount.user.bio : undefined,
2101
+ jobTitle: props.trade.alpacaAccount.user.jobTitle !== undefined ? props.trade.alpacaAccount.user.jobTitle : undefined,
2102
+ currentAccount: props.trade.alpacaAccount.user.currentAccount !== undefined ? props.trade.alpacaAccount.user.currentAccount : undefined,
2103
+ plan: props.trade.alpacaAccount.user.plan !== undefined ? props.trade.alpacaAccount.user.plan : undefined,
2104
+ },
2105
+ }
2106
+ } : undefined,
2107
+ orders: props.trade.alpacaAccount.orders ?
2108
+ Array.isArray(props.trade.alpacaAccount.orders) && props.trade.alpacaAccount.orders.length > 0 && props.trade.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2109
+ connect: props.trade.alpacaAccount.orders.map((item) => ({
2110
+ id: item.id
2111
+ }))
2112
+ }
2113
+ : { connectOrCreate: props.trade.alpacaAccount.orders.map((item) => ({
2114
+ where: {
2115
+ id: item.id !== undefined ? item.id : undefined,
2116
+ },
2117
+ create: {
2118
+ qty: item.qty !== undefined ? item.qty : undefined,
2119
+ notional: item.notional !== undefined ? item.notional : undefined,
2120
+ side: item.side !== undefined ? item.side : undefined,
2121
+ type: item.type !== undefined ? item.type : undefined,
2122
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
2123
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
2124
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
2125
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
2126
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
2127
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
2128
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2129
+ status: item.status !== undefined ? item.status : undefined,
2130
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
2131
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2132
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2133
+ fee: item.fee !== undefined ? item.fee : undefined,
2134
+ },
2135
+ }))
2136
+ } : undefined,
2137
+ positions: props.trade.alpacaAccount.positions ?
2138
+ Array.isArray(props.trade.alpacaAccount.positions) && props.trade.alpacaAccount.positions.length > 0 && props.trade.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2139
+ connect: props.trade.alpacaAccount.positions.map((item) => ({
2140
+ id: item.id
2141
+ }))
2142
+ }
2143
+ : { connectOrCreate: props.trade.alpacaAccount.positions.map((item) => ({
2144
+ where: {
2145
+ id: item.id !== undefined ? item.id : undefined,
2146
+ },
2147
+ create: {
2148
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2149
+ qty: item.qty !== undefined ? item.qty : undefined,
2150
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2151
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2152
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2153
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2154
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2155
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2156
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2157
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2158
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2159
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2160
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2161
+ },
2162
+ }))
2163
+ } : undefined,
2164
+ alerts: props.trade.alpacaAccount.alerts ?
2165
+ Array.isArray(props.trade.alpacaAccount.alerts) && props.trade.alpacaAccount.alerts.length > 0 && props.trade.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2166
+ connect: props.trade.alpacaAccount.alerts.map((item) => ({
2167
+ id: item.id
2168
+ }))
2169
+ }
2170
+ : { connectOrCreate: props.trade.alpacaAccount.alerts.map((item) => ({
2171
+ where: {
2172
+ id: item.id !== undefined ? item.id : undefined,
2173
+ },
2174
+ create: {
2175
+ message: item.message !== undefined ? item.message : undefined,
2176
+ type: item.type !== undefined ? item.type : undefined,
2177
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
2178
+ },
2179
+ }))
2180
+ } : undefined,
1158
2181
  },
1159
2182
  }
1160
2183
  } : undefined,
@@ -1226,6 +2249,82 @@ export const Action = {
1226
2249
  exDividendDate: props.trade.asset.exDividendDate !== undefined ? props.trade.asset.exDividendDate : undefined,
1227
2250
  sellPrice: props.trade.asset.sellPrice !== undefined ? props.trade.asset.sellPrice : undefined,
1228
2251
  buyPrice: props.trade.asset.buyPrice !== undefined ? props.trade.asset.buyPrice : undefined,
2252
+ orders: props.trade.asset.orders ?
2253
+ Array.isArray(props.trade.asset.orders) && props.trade.asset.orders.length > 0 && props.trade.asset.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2254
+ connect: props.trade.asset.orders.map((item) => ({
2255
+ id: item.id
2256
+ }))
2257
+ }
2258
+ : { connectOrCreate: props.trade.asset.orders.map((item) => ({
2259
+ where: {
2260
+ id: item.id !== undefined ? item.id : undefined,
2261
+ },
2262
+ create: {
2263
+ qty: item.qty !== undefined ? item.qty : undefined,
2264
+ notional: item.notional !== undefined ? item.notional : undefined,
2265
+ side: item.side !== undefined ? item.side : undefined,
2266
+ type: item.type !== undefined ? item.type : undefined,
2267
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
2268
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
2269
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
2270
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
2271
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
2272
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
2273
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2274
+ status: item.status !== undefined ? item.status : undefined,
2275
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
2276
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2277
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2278
+ fee: item.fee !== undefined ? item.fee : undefined,
2279
+ },
2280
+ }))
2281
+ } : undefined,
2282
+ positions: props.trade.asset.positions ?
2283
+ Array.isArray(props.trade.asset.positions) && props.trade.asset.positions.length > 0 && props.trade.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2284
+ connect: props.trade.asset.positions.map((item) => ({
2285
+ id: item.id
2286
+ }))
2287
+ }
2288
+ : { connectOrCreate: props.trade.asset.positions.map((item) => ({
2289
+ where: {
2290
+ id: item.id !== undefined ? item.id : undefined,
2291
+ },
2292
+ create: {
2293
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2294
+ qty: item.qty !== undefined ? item.qty : undefined,
2295
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2296
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2297
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2298
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2299
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2300
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2301
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2302
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2303
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2304
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2305
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2306
+ },
2307
+ }))
2308
+ } : undefined,
2309
+ newsMentions: props.trade.asset.newsMentions ?
2310
+ Array.isArray(props.trade.asset.newsMentions) && props.trade.asset.newsMentions.length > 0 && props.trade.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2311
+ connect: props.trade.asset.newsMentions.map((item) => ({
2312
+ id: item.id
2313
+ }))
2314
+ }
2315
+ : { connectOrCreate: props.trade.asset.newsMentions.map((item) => ({
2316
+ where: {
2317
+ id: item.id !== undefined ? item.id : undefined,
2318
+ url: item.url !== undefined ? item.url : undefined,
2319
+ },
2320
+ create: {
2321
+ url: item.url !== undefined ? item.url : undefined,
2322
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
2323
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
2324
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
2325
+ },
2326
+ }))
2327
+ } : undefined,
1229
2328
  },
1230
2329
  }
1231
2330
  } : undefined,
@@ -1317,6 +2416,210 @@ export const Action = {
1317
2416
  marketOpen: props.order.alpacaAccount.marketOpen !== undefined ? {
1318
2417
  set: props.order.alpacaAccount.marketOpen
1319
2418
  } : undefined,
2419
+ user: props.order.alpacaAccount.user ? {
2420
+ upsert: {
2421
+ where: {
2422
+ id: props.order.alpacaAccount.user.id !== undefined ? {
2423
+ equals: props.order.alpacaAccount.user.id
2424
+ } : undefined,
2425
+ name: props.order.alpacaAccount.user.name !== undefined ? {
2426
+ equals: props.order.alpacaAccount.user.name
2427
+ } : undefined,
2428
+ email: props.order.alpacaAccount.user.email !== undefined ? {
2429
+ equals: props.order.alpacaAccount.user.email
2430
+ } : undefined,
2431
+ },
2432
+ update: {
2433
+ id: props.order.alpacaAccount.user.id !== undefined ? {
2434
+ set: props.order.alpacaAccount.user.id
2435
+ } : undefined,
2436
+ name: props.order.alpacaAccount.user.name !== undefined ? {
2437
+ set: props.order.alpacaAccount.user.name
2438
+ } : undefined,
2439
+ email: props.order.alpacaAccount.user.email !== undefined ? {
2440
+ set: props.order.alpacaAccount.user.email
2441
+ } : undefined,
2442
+ emailVerified: props.order.alpacaAccount.user.emailVerified !== undefined ? {
2443
+ set: props.order.alpacaAccount.user.emailVerified
2444
+ } : undefined,
2445
+ image: props.order.alpacaAccount.user.image !== undefined ? {
2446
+ set: props.order.alpacaAccount.user.image
2447
+ } : undefined,
2448
+ role: props.order.alpacaAccount.user.role !== undefined ? {
2449
+ set: props.order.alpacaAccount.user.role
2450
+ } : undefined,
2451
+ bio: props.order.alpacaAccount.user.bio !== undefined ? {
2452
+ set: props.order.alpacaAccount.user.bio
2453
+ } : undefined,
2454
+ jobTitle: props.order.alpacaAccount.user.jobTitle !== undefined ? {
2455
+ set: props.order.alpacaAccount.user.jobTitle
2456
+ } : undefined,
2457
+ currentAccount: props.order.alpacaAccount.user.currentAccount !== undefined ? {
2458
+ set: props.order.alpacaAccount.user.currentAccount
2459
+ } : undefined,
2460
+ plan: props.order.alpacaAccount.user.plan !== undefined ? {
2461
+ set: props.order.alpacaAccount.user.plan
2462
+ } : undefined,
2463
+ },
2464
+ create: {
2465
+ name: props.order.alpacaAccount.user.name !== undefined ? props.order.alpacaAccount.user.name : undefined,
2466
+ email: props.order.alpacaAccount.user.email !== undefined ? props.order.alpacaAccount.user.email : undefined,
2467
+ emailVerified: props.order.alpacaAccount.user.emailVerified !== undefined ? props.order.alpacaAccount.user.emailVerified : undefined,
2468
+ image: props.order.alpacaAccount.user.image !== undefined ? props.order.alpacaAccount.user.image : undefined,
2469
+ role: props.order.alpacaAccount.user.role !== undefined ? props.order.alpacaAccount.user.role : undefined,
2470
+ bio: props.order.alpacaAccount.user.bio !== undefined ? props.order.alpacaAccount.user.bio : undefined,
2471
+ jobTitle: props.order.alpacaAccount.user.jobTitle !== undefined ? props.order.alpacaAccount.user.jobTitle : undefined,
2472
+ currentAccount: props.order.alpacaAccount.user.currentAccount !== undefined ? props.order.alpacaAccount.user.currentAccount : undefined,
2473
+ plan: props.order.alpacaAccount.user.plan !== undefined ? props.order.alpacaAccount.user.plan : undefined,
2474
+ },
2475
+ }
2476
+ } : undefined,
2477
+ trades: props.order.alpacaAccount.trades ? {
2478
+ upsert: props.order.alpacaAccount.trades.map((item) => ({
2479
+ where: {
2480
+ id: item.id !== undefined ? item.id : undefined,
2481
+ },
2482
+ update: {
2483
+ id: item.id !== undefined ? {
2484
+ set: item.id
2485
+ } : undefined,
2486
+ qty: item.qty !== undefined ? {
2487
+ set: item.qty
2488
+ } : undefined,
2489
+ price: item.price !== undefined ? {
2490
+ set: item.price
2491
+ } : undefined,
2492
+ total: item.total !== undefined ? {
2493
+ set: item.total
2494
+ } : undefined,
2495
+ signal: item.signal !== undefined ? {
2496
+ set: item.signal
2497
+ } : undefined,
2498
+ strategy: item.strategy !== undefined ? {
2499
+ set: item.strategy
2500
+ } : undefined,
2501
+ analysis: item.analysis !== undefined ? {
2502
+ set: item.analysis
2503
+ } : undefined,
2504
+ confidence: item.confidence !== undefined ? {
2505
+ set: item.confidence
2506
+ } : undefined,
2507
+ timestamp: item.timestamp !== undefined ? {
2508
+ set: item.timestamp
2509
+ } : undefined,
2510
+ status: item.status !== undefined ? {
2511
+ set: item.status
2512
+ } : undefined,
2513
+ optionContractType: item.optionContractType !== undefined ? {
2514
+ set: item.optionContractType
2515
+ } : undefined,
2516
+ },
2517
+ create: {
2518
+ qty: item.qty !== undefined ? item.qty : undefined,
2519
+ price: item.price !== undefined ? item.price : undefined,
2520
+ total: item.total !== undefined ? item.total : undefined,
2521
+ signal: item.signal !== undefined ? item.signal : undefined,
2522
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
2523
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
2524
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
2525
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2526
+ status: item.status !== undefined ? item.status : undefined,
2527
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2528
+ },
2529
+ }))
2530
+ } : undefined,
2531
+ positions: props.order.alpacaAccount.positions ? {
2532
+ upsert: props.order.alpacaAccount.positions.map((item) => ({
2533
+ where: {
2534
+ id: item.id !== undefined ? item.id : undefined,
2535
+ },
2536
+ update: {
2537
+ id: item.id !== undefined ? {
2538
+ set: item.id
2539
+ } : undefined,
2540
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
2541
+ set: item.averageEntryPrice
2542
+ } : undefined,
2543
+ qty: item.qty !== undefined ? {
2544
+ set: item.qty
2545
+ } : undefined,
2546
+ qtyAvailable: item.qtyAvailable !== undefined ? {
2547
+ set: item.qtyAvailable
2548
+ } : undefined,
2549
+ marketValue: item.marketValue !== undefined ? {
2550
+ set: item.marketValue
2551
+ } : undefined,
2552
+ costBasis: item.costBasis !== undefined ? {
2553
+ set: item.costBasis
2554
+ } : undefined,
2555
+ unrealizedPL: item.unrealizedPL !== undefined ? {
2556
+ set: item.unrealizedPL
2557
+ } : undefined,
2558
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
2559
+ set: item.unrealizedPLPC
2560
+ } : undefined,
2561
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
2562
+ set: item.unrealisedIntradayPL
2563
+ } : undefined,
2564
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
2565
+ set: item.unrealisedIntradayPLPC
2566
+ } : undefined,
2567
+ currentPrice: item.currentPrice !== undefined ? {
2568
+ set: item.currentPrice
2569
+ } : undefined,
2570
+ lastTradePrice: item.lastTradePrice !== undefined ? {
2571
+ set: item.lastTradePrice
2572
+ } : undefined,
2573
+ changeToday: item.changeToday !== undefined ? {
2574
+ set: item.changeToday
2575
+ } : undefined,
2576
+ assetMarginable: item.assetMarginable !== undefined ? {
2577
+ set: item.assetMarginable
2578
+ } : undefined,
2579
+ },
2580
+ create: {
2581
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2582
+ qty: item.qty !== undefined ? item.qty : undefined,
2583
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2584
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2585
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2586
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2587
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2588
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2589
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2590
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2591
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2592
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2593
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2594
+ },
2595
+ }))
2596
+ } : undefined,
2597
+ alerts: props.order.alpacaAccount.alerts ? {
2598
+ upsert: props.order.alpacaAccount.alerts.map((item) => ({
2599
+ where: {
2600
+ id: item.id !== undefined ? item.id : undefined,
2601
+ },
2602
+ update: {
2603
+ id: item.id !== undefined ? {
2604
+ set: item.id
2605
+ } : undefined,
2606
+ message: item.message !== undefined ? {
2607
+ set: item.message
2608
+ } : undefined,
2609
+ type: item.type !== undefined ? {
2610
+ set: item.type
2611
+ } : undefined,
2612
+ isRead: item.isRead !== undefined ? {
2613
+ set: item.isRead
2614
+ } : undefined,
2615
+ },
2616
+ create: {
2617
+ message: item.message !== undefined ? item.message : undefined,
2618
+ type: item.type !== undefined ? item.type : undefined,
2619
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
2620
+ },
2621
+ }))
2622
+ } : undefined,
1320
2623
  },
1321
2624
  create: {
1322
2625
  type: props.order.alpacaAccount.type !== undefined ? props.order.alpacaAccount.type : undefined,
@@ -1324,6 +2627,101 @@ export const Action = {
1324
2627
  APISecret: props.order.alpacaAccount.APISecret !== undefined ? props.order.alpacaAccount.APISecret : undefined,
1325
2628
  configuration: props.order.alpacaAccount.configuration !== undefined ? props.order.alpacaAccount.configuration : undefined,
1326
2629
  marketOpen: props.order.alpacaAccount.marketOpen !== undefined ? props.order.alpacaAccount.marketOpen : undefined,
2630
+ user: props.order.alpacaAccount.user ?
2631
+ typeof props.order.alpacaAccount.user === 'object' && Object.keys(props.order.alpacaAccount.user).length === 1 && Object.keys(props.order.alpacaAccount.user)[0] === 'id'
2632
+ ? { connect: {
2633
+ id: props.order.alpacaAccount.user.id
2634
+ }
2635
+ }
2636
+ : { connectOrCreate: {
2637
+ where: {
2638
+ id: props.order.alpacaAccount.user.id !== undefined ? props.order.alpacaAccount.user.id : undefined,
2639
+ email: props.order.alpacaAccount.user.email !== undefined ? props.order.alpacaAccount.user.email : undefined,
2640
+ name: props.order.alpacaAccount.user.name !== undefined ? {
2641
+ equals: props.order.alpacaAccount.user.name
2642
+ } : undefined,
2643
+ },
2644
+ create: {
2645
+ name: props.order.alpacaAccount.user.name !== undefined ? props.order.alpacaAccount.user.name : undefined,
2646
+ email: props.order.alpacaAccount.user.email !== undefined ? props.order.alpacaAccount.user.email : undefined,
2647
+ emailVerified: props.order.alpacaAccount.user.emailVerified !== undefined ? props.order.alpacaAccount.user.emailVerified : undefined,
2648
+ image: props.order.alpacaAccount.user.image !== undefined ? props.order.alpacaAccount.user.image : undefined,
2649
+ role: props.order.alpacaAccount.user.role !== undefined ? props.order.alpacaAccount.user.role : undefined,
2650
+ bio: props.order.alpacaAccount.user.bio !== undefined ? props.order.alpacaAccount.user.bio : undefined,
2651
+ jobTitle: props.order.alpacaAccount.user.jobTitle !== undefined ? props.order.alpacaAccount.user.jobTitle : undefined,
2652
+ currentAccount: props.order.alpacaAccount.user.currentAccount !== undefined ? props.order.alpacaAccount.user.currentAccount : undefined,
2653
+ plan: props.order.alpacaAccount.user.plan !== undefined ? props.order.alpacaAccount.user.plan : undefined,
2654
+ },
2655
+ }
2656
+ } : undefined,
2657
+ trades: props.order.alpacaAccount.trades ?
2658
+ Array.isArray(props.order.alpacaAccount.trades) && props.order.alpacaAccount.trades.length > 0 && props.order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2659
+ connect: props.order.alpacaAccount.trades.map((item) => ({
2660
+ id: item.id
2661
+ }))
2662
+ }
2663
+ : { connectOrCreate: props.order.alpacaAccount.trades.map((item) => ({
2664
+ where: {
2665
+ id: item.id !== undefined ? item.id : undefined,
2666
+ },
2667
+ create: {
2668
+ qty: item.qty !== undefined ? item.qty : undefined,
2669
+ price: item.price !== undefined ? item.price : undefined,
2670
+ total: item.total !== undefined ? item.total : undefined,
2671
+ signal: item.signal !== undefined ? item.signal : undefined,
2672
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
2673
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
2674
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
2675
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2676
+ status: item.status !== undefined ? item.status : undefined,
2677
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2678
+ },
2679
+ }))
2680
+ } : undefined,
2681
+ positions: props.order.alpacaAccount.positions ?
2682
+ Array.isArray(props.order.alpacaAccount.positions) && props.order.alpacaAccount.positions.length > 0 && props.order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2683
+ connect: props.order.alpacaAccount.positions.map((item) => ({
2684
+ id: item.id
2685
+ }))
2686
+ }
2687
+ : { connectOrCreate: props.order.alpacaAccount.positions.map((item) => ({
2688
+ where: {
2689
+ id: item.id !== undefined ? item.id : undefined,
2690
+ },
2691
+ create: {
2692
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
2693
+ qty: item.qty !== undefined ? item.qty : undefined,
2694
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
2695
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
2696
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
2697
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
2698
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
2699
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
2700
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
2701
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
2702
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2703
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2704
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2705
+ },
2706
+ }))
2707
+ } : undefined,
2708
+ alerts: props.order.alpacaAccount.alerts ?
2709
+ Array.isArray(props.order.alpacaAccount.alerts) && props.order.alpacaAccount.alerts.length > 0 && props.order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2710
+ connect: props.order.alpacaAccount.alerts.map((item) => ({
2711
+ id: item.id
2712
+ }))
2713
+ }
2714
+ : { connectOrCreate: props.order.alpacaAccount.alerts.map((item) => ({
2715
+ where: {
2716
+ id: item.id !== undefined ? item.id : undefined,
2717
+ },
2718
+ create: {
2719
+ message: item.message !== undefined ? item.message : undefined,
2720
+ type: item.type !== undefined ? item.type : undefined,
2721
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
2722
+ },
2723
+ }))
2724
+ } : undefined,
1327
2725
  },
1328
2726
  }
1329
2727
  } : undefined,
@@ -1509,6 +2907,157 @@ export const Action = {
1509
2907
  buyPrice: props.order.asset.buyPrice !== undefined ? {
1510
2908
  set: props.order.asset.buyPrice
1511
2909
  } : undefined,
2910
+ trades: props.order.asset.trades ? {
2911
+ upsert: props.order.asset.trades.map((item) => ({
2912
+ where: {
2913
+ id: item.id !== undefined ? item.id : undefined,
2914
+ },
2915
+ update: {
2916
+ id: item.id !== undefined ? {
2917
+ set: item.id
2918
+ } : undefined,
2919
+ qty: item.qty !== undefined ? {
2920
+ set: item.qty
2921
+ } : undefined,
2922
+ price: item.price !== undefined ? {
2923
+ set: item.price
2924
+ } : undefined,
2925
+ total: item.total !== undefined ? {
2926
+ set: item.total
2927
+ } : undefined,
2928
+ signal: item.signal !== undefined ? {
2929
+ set: item.signal
2930
+ } : undefined,
2931
+ strategy: item.strategy !== undefined ? {
2932
+ set: item.strategy
2933
+ } : undefined,
2934
+ analysis: item.analysis !== undefined ? {
2935
+ set: item.analysis
2936
+ } : undefined,
2937
+ confidence: item.confidence !== undefined ? {
2938
+ set: item.confidence
2939
+ } : undefined,
2940
+ timestamp: item.timestamp !== undefined ? {
2941
+ set: item.timestamp
2942
+ } : undefined,
2943
+ status: item.status !== undefined ? {
2944
+ set: item.status
2945
+ } : undefined,
2946
+ optionContractType: item.optionContractType !== undefined ? {
2947
+ set: item.optionContractType
2948
+ } : undefined,
2949
+ },
2950
+ create: {
2951
+ qty: item.qty !== undefined ? item.qty : undefined,
2952
+ price: item.price !== undefined ? item.price : undefined,
2953
+ total: item.total !== undefined ? item.total : undefined,
2954
+ signal: item.signal !== undefined ? item.signal : undefined,
2955
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
2956
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
2957
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
2958
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
2959
+ status: item.status !== undefined ? item.status : undefined,
2960
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2961
+ },
2962
+ }))
2963
+ } : undefined,
2964
+ positions: props.order.asset.positions ? {
2965
+ upsert: props.order.asset.positions.map((item) => ({
2966
+ where: {
2967
+ id: item.id !== undefined ? item.id : undefined,
2968
+ },
2969
+ update: {
2970
+ id: item.id !== undefined ? {
2971
+ set: item.id
2972
+ } : undefined,
2973
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
2974
+ set: item.averageEntryPrice
2975
+ } : undefined,
2976
+ qty: item.qty !== undefined ? {
2977
+ set: item.qty
2978
+ } : undefined,
2979
+ qtyAvailable: item.qtyAvailable !== undefined ? {
2980
+ set: item.qtyAvailable
2981
+ } : undefined,
2982
+ marketValue: item.marketValue !== undefined ? {
2983
+ set: item.marketValue
2984
+ } : undefined,
2985
+ costBasis: item.costBasis !== undefined ? {
2986
+ set: item.costBasis
2987
+ } : undefined,
2988
+ unrealizedPL: item.unrealizedPL !== undefined ? {
2989
+ set: item.unrealizedPL
2990
+ } : undefined,
2991
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
2992
+ set: item.unrealizedPLPC
2993
+ } : undefined,
2994
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
2995
+ set: item.unrealisedIntradayPL
2996
+ } : undefined,
2997
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
2998
+ set: item.unrealisedIntradayPLPC
2999
+ } : undefined,
3000
+ currentPrice: item.currentPrice !== undefined ? {
3001
+ set: item.currentPrice
3002
+ } : undefined,
3003
+ lastTradePrice: item.lastTradePrice !== undefined ? {
3004
+ set: item.lastTradePrice
3005
+ } : undefined,
3006
+ changeToday: item.changeToday !== undefined ? {
3007
+ set: item.changeToday
3008
+ } : undefined,
3009
+ assetMarginable: item.assetMarginable !== undefined ? {
3010
+ set: item.assetMarginable
3011
+ } : undefined,
3012
+ },
3013
+ create: {
3014
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
3015
+ qty: item.qty !== undefined ? item.qty : undefined,
3016
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
3017
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
3018
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
3019
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
3020
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
3021
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
3022
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
3023
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
3024
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
3025
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
3026
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
3027
+ },
3028
+ }))
3029
+ } : undefined,
3030
+ newsMentions: props.order.asset.newsMentions ? {
3031
+ upsert: props.order.asset.newsMentions.map((item) => ({
3032
+ where: {
3033
+ id: item.id !== undefined ? item.id : undefined,
3034
+ url: item.url !== undefined ? item.url : undefined,
3035
+ },
3036
+ update: {
3037
+ id: item.id !== undefined ? {
3038
+ set: item.id
3039
+ } : undefined,
3040
+ url: item.url !== undefined ? {
3041
+ set: item.url
3042
+ } : undefined,
3043
+ relevancyScore: item.relevancyScore !== undefined ? {
3044
+ set: item.relevancyScore
3045
+ } : undefined,
3046
+ sentimentScore: item.sentimentScore !== undefined ? {
3047
+ set: item.sentimentScore
3048
+ } : undefined,
3049
+ sentimentLabel: item.sentimentLabel !== undefined ? {
3050
+ set: item.sentimentLabel
3051
+ } : undefined,
3052
+ },
3053
+ create: {
3054
+ url: item.url !== undefined ? item.url : undefined,
3055
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
3056
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
3057
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
3058
+ },
3059
+ }))
3060
+ } : undefined,
1512
3061
  },
1513
3062
  create: {
1514
3063
  symbol: props.order.asset.symbol !== undefined ? props.order.asset.symbol : undefined,
@@ -1566,6 +3115,76 @@ export const Action = {
1566
3115
  exDividendDate: props.order.asset.exDividendDate !== undefined ? props.order.asset.exDividendDate : undefined,
1567
3116
  sellPrice: props.order.asset.sellPrice !== undefined ? props.order.asset.sellPrice : undefined,
1568
3117
  buyPrice: props.order.asset.buyPrice !== undefined ? props.order.asset.buyPrice : undefined,
3118
+ trades: props.order.asset.trades ?
3119
+ Array.isArray(props.order.asset.trades) && props.order.asset.trades.length > 0 && props.order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3120
+ connect: props.order.asset.trades.map((item) => ({
3121
+ id: item.id
3122
+ }))
3123
+ }
3124
+ : { connectOrCreate: props.order.asset.trades.map((item) => ({
3125
+ where: {
3126
+ id: item.id !== undefined ? item.id : undefined,
3127
+ },
3128
+ create: {
3129
+ qty: item.qty !== undefined ? item.qty : undefined,
3130
+ price: item.price !== undefined ? item.price : undefined,
3131
+ total: item.total !== undefined ? item.total : undefined,
3132
+ signal: item.signal !== undefined ? item.signal : undefined,
3133
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
3134
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
3135
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
3136
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3137
+ status: item.status !== undefined ? item.status : undefined,
3138
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3139
+ },
3140
+ }))
3141
+ } : undefined,
3142
+ positions: props.order.asset.positions ?
3143
+ Array.isArray(props.order.asset.positions) && props.order.asset.positions.length > 0 && props.order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3144
+ connect: props.order.asset.positions.map((item) => ({
3145
+ id: item.id
3146
+ }))
3147
+ }
3148
+ : { connectOrCreate: props.order.asset.positions.map((item) => ({
3149
+ where: {
3150
+ id: item.id !== undefined ? item.id : undefined,
3151
+ },
3152
+ create: {
3153
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
3154
+ qty: item.qty !== undefined ? item.qty : undefined,
3155
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
3156
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
3157
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
3158
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
3159
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
3160
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
3161
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
3162
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
3163
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
3164
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
3165
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
3166
+ },
3167
+ }))
3168
+ } : undefined,
3169
+ newsMentions: props.order.asset.newsMentions ?
3170
+ Array.isArray(props.order.asset.newsMentions) && props.order.asset.newsMentions.length > 0 && props.order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3171
+ connect: props.order.asset.newsMentions.map((item) => ({
3172
+ id: item.id
3173
+ }))
3174
+ }
3175
+ : { connectOrCreate: props.order.asset.newsMentions.map((item) => ({
3176
+ where: {
3177
+ id: item.id !== undefined ? item.id : undefined,
3178
+ url: item.url !== undefined ? item.url : undefined,
3179
+ },
3180
+ create: {
3181
+ url: item.url !== undefined ? item.url : undefined,
3182
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
3183
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
3184
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
3185
+ },
3186
+ }))
3187
+ } : undefined,
1569
3188
  },
1570
3189
  }
1571
3190
  } : undefined,
@@ -1603,6 +3222,101 @@ export const Action = {
1603
3222
  APISecret: props.order.alpacaAccount.APISecret !== undefined ? props.order.alpacaAccount.APISecret : undefined,
1604
3223
  configuration: props.order.alpacaAccount.configuration !== undefined ? props.order.alpacaAccount.configuration : undefined,
1605
3224
  marketOpen: props.order.alpacaAccount.marketOpen !== undefined ? props.order.alpacaAccount.marketOpen : undefined,
3225
+ user: props.order.alpacaAccount.user ?
3226
+ typeof props.order.alpacaAccount.user === 'object' && Object.keys(props.order.alpacaAccount.user).length === 1 && Object.keys(props.order.alpacaAccount.user)[0] === 'id'
3227
+ ? { connect: {
3228
+ id: props.order.alpacaAccount.user.id
3229
+ }
3230
+ }
3231
+ : { connectOrCreate: {
3232
+ where: {
3233
+ id: props.order.alpacaAccount.user.id !== undefined ? props.order.alpacaAccount.user.id : undefined,
3234
+ email: props.order.alpacaAccount.user.email !== undefined ? props.order.alpacaAccount.user.email : undefined,
3235
+ name: props.order.alpacaAccount.user.name !== undefined ? {
3236
+ equals: props.order.alpacaAccount.user.name
3237
+ } : undefined,
3238
+ },
3239
+ create: {
3240
+ name: props.order.alpacaAccount.user.name !== undefined ? props.order.alpacaAccount.user.name : undefined,
3241
+ email: props.order.alpacaAccount.user.email !== undefined ? props.order.alpacaAccount.user.email : undefined,
3242
+ emailVerified: props.order.alpacaAccount.user.emailVerified !== undefined ? props.order.alpacaAccount.user.emailVerified : undefined,
3243
+ image: props.order.alpacaAccount.user.image !== undefined ? props.order.alpacaAccount.user.image : undefined,
3244
+ role: props.order.alpacaAccount.user.role !== undefined ? props.order.alpacaAccount.user.role : undefined,
3245
+ bio: props.order.alpacaAccount.user.bio !== undefined ? props.order.alpacaAccount.user.bio : undefined,
3246
+ jobTitle: props.order.alpacaAccount.user.jobTitle !== undefined ? props.order.alpacaAccount.user.jobTitle : undefined,
3247
+ currentAccount: props.order.alpacaAccount.user.currentAccount !== undefined ? props.order.alpacaAccount.user.currentAccount : undefined,
3248
+ plan: props.order.alpacaAccount.user.plan !== undefined ? props.order.alpacaAccount.user.plan : undefined,
3249
+ },
3250
+ }
3251
+ } : undefined,
3252
+ trades: props.order.alpacaAccount.trades ?
3253
+ Array.isArray(props.order.alpacaAccount.trades) && props.order.alpacaAccount.trades.length > 0 && props.order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3254
+ connect: props.order.alpacaAccount.trades.map((item) => ({
3255
+ id: item.id
3256
+ }))
3257
+ }
3258
+ : { connectOrCreate: props.order.alpacaAccount.trades.map((item) => ({
3259
+ where: {
3260
+ id: item.id !== undefined ? item.id : undefined,
3261
+ },
3262
+ create: {
3263
+ qty: item.qty !== undefined ? item.qty : undefined,
3264
+ price: item.price !== undefined ? item.price : undefined,
3265
+ total: item.total !== undefined ? item.total : undefined,
3266
+ signal: item.signal !== undefined ? item.signal : undefined,
3267
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
3268
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
3269
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
3270
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3271
+ status: item.status !== undefined ? item.status : undefined,
3272
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3273
+ },
3274
+ }))
3275
+ } : undefined,
3276
+ positions: props.order.alpacaAccount.positions ?
3277
+ Array.isArray(props.order.alpacaAccount.positions) && props.order.alpacaAccount.positions.length > 0 && props.order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3278
+ connect: props.order.alpacaAccount.positions.map((item) => ({
3279
+ id: item.id
3280
+ }))
3281
+ }
3282
+ : { connectOrCreate: props.order.alpacaAccount.positions.map((item) => ({
3283
+ where: {
3284
+ id: item.id !== undefined ? item.id : undefined,
3285
+ },
3286
+ create: {
3287
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
3288
+ qty: item.qty !== undefined ? item.qty : undefined,
3289
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
3290
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
3291
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
3292
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
3293
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
3294
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
3295
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
3296
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
3297
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
3298
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
3299
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
3300
+ },
3301
+ }))
3302
+ } : undefined,
3303
+ alerts: props.order.alpacaAccount.alerts ?
3304
+ Array.isArray(props.order.alpacaAccount.alerts) && props.order.alpacaAccount.alerts.length > 0 && props.order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3305
+ connect: props.order.alpacaAccount.alerts.map((item) => ({
3306
+ id: item.id
3307
+ }))
3308
+ }
3309
+ : { connectOrCreate: props.order.alpacaAccount.alerts.map((item) => ({
3310
+ where: {
3311
+ id: item.id !== undefined ? item.id : undefined,
3312
+ },
3313
+ create: {
3314
+ message: item.message !== undefined ? item.message : undefined,
3315
+ type: item.type !== undefined ? item.type : undefined,
3316
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
3317
+ },
3318
+ }))
3319
+ } : undefined,
1606
3320
  },
1607
3321
  }
1608
3322
  } : undefined,
@@ -1674,6 +3388,76 @@ export const Action = {
1674
3388
  exDividendDate: props.order.asset.exDividendDate !== undefined ? props.order.asset.exDividendDate : undefined,
1675
3389
  sellPrice: props.order.asset.sellPrice !== undefined ? props.order.asset.sellPrice : undefined,
1676
3390
  buyPrice: props.order.asset.buyPrice !== undefined ? props.order.asset.buyPrice : undefined,
3391
+ trades: props.order.asset.trades ?
3392
+ Array.isArray(props.order.asset.trades) && props.order.asset.trades.length > 0 && props.order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3393
+ connect: props.order.asset.trades.map((item) => ({
3394
+ id: item.id
3395
+ }))
3396
+ }
3397
+ : { connectOrCreate: props.order.asset.trades.map((item) => ({
3398
+ where: {
3399
+ id: item.id !== undefined ? item.id : undefined,
3400
+ },
3401
+ create: {
3402
+ qty: item.qty !== undefined ? item.qty : undefined,
3403
+ price: item.price !== undefined ? item.price : undefined,
3404
+ total: item.total !== undefined ? item.total : undefined,
3405
+ signal: item.signal !== undefined ? item.signal : undefined,
3406
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
3407
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
3408
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
3409
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3410
+ status: item.status !== undefined ? item.status : undefined,
3411
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3412
+ },
3413
+ }))
3414
+ } : undefined,
3415
+ positions: props.order.asset.positions ?
3416
+ Array.isArray(props.order.asset.positions) && props.order.asset.positions.length > 0 && props.order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3417
+ connect: props.order.asset.positions.map((item) => ({
3418
+ id: item.id
3419
+ }))
3420
+ }
3421
+ : { connectOrCreate: props.order.asset.positions.map((item) => ({
3422
+ where: {
3423
+ id: item.id !== undefined ? item.id : undefined,
3424
+ },
3425
+ create: {
3426
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
3427
+ qty: item.qty !== undefined ? item.qty : undefined,
3428
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
3429
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
3430
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
3431
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
3432
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
3433
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
3434
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
3435
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
3436
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
3437
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
3438
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
3439
+ },
3440
+ }))
3441
+ } : undefined,
3442
+ newsMentions: props.order.asset.newsMentions ?
3443
+ Array.isArray(props.order.asset.newsMentions) && props.order.asset.newsMentions.length > 0 && props.order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3444
+ connect: props.order.asset.newsMentions.map((item) => ({
3445
+ id: item.id
3446
+ }))
3447
+ }
3448
+ : { connectOrCreate: props.order.asset.newsMentions.map((item) => ({
3449
+ where: {
3450
+ id: item.id !== undefined ? item.id : undefined,
3451
+ url: item.url !== undefined ? item.url : undefined,
3452
+ },
3453
+ create: {
3454
+ url: item.url !== undefined ? item.url : undefined,
3455
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
3456
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
3457
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
3458
+ },
3459
+ }))
3460
+ } : undefined,
1677
3461
  },
1678
3462
  }
1679
3463
  } : undefined,
@@ -1802,6 +3586,234 @@ export const Action = {
1802
3586
  marketOpen: prop.trade.alpacaAccount.marketOpen !== undefined ? {
1803
3587
  set: prop.trade.alpacaAccount.marketOpen
1804
3588
  } : undefined,
3589
+ user: prop.trade.alpacaAccount.user ? {
3590
+ upsert: {
3591
+ where: {
3592
+ id: prop.trade.alpacaAccount.user.id !== undefined ? {
3593
+ equals: prop.trade.alpacaAccount.user.id
3594
+ } : undefined,
3595
+ name: prop.trade.alpacaAccount.user.name !== undefined ? {
3596
+ equals: prop.trade.alpacaAccount.user.name
3597
+ } : undefined,
3598
+ email: prop.trade.alpacaAccount.user.email !== undefined ? {
3599
+ equals: prop.trade.alpacaAccount.user.email
3600
+ } : undefined,
3601
+ },
3602
+ update: {
3603
+ id: prop.trade.alpacaAccount.user.id !== undefined ? {
3604
+ set: prop.trade.alpacaAccount.user.id
3605
+ } : undefined,
3606
+ name: prop.trade.alpacaAccount.user.name !== undefined ? {
3607
+ set: prop.trade.alpacaAccount.user.name
3608
+ } : undefined,
3609
+ email: prop.trade.alpacaAccount.user.email !== undefined ? {
3610
+ set: prop.trade.alpacaAccount.user.email
3611
+ } : undefined,
3612
+ emailVerified: prop.trade.alpacaAccount.user.emailVerified !== undefined ? {
3613
+ set: prop.trade.alpacaAccount.user.emailVerified
3614
+ } : undefined,
3615
+ image: prop.trade.alpacaAccount.user.image !== undefined ? {
3616
+ set: prop.trade.alpacaAccount.user.image
3617
+ } : undefined,
3618
+ role: prop.trade.alpacaAccount.user.role !== undefined ? {
3619
+ set: prop.trade.alpacaAccount.user.role
3620
+ } : undefined,
3621
+ bio: prop.trade.alpacaAccount.user.bio !== undefined ? {
3622
+ set: prop.trade.alpacaAccount.user.bio
3623
+ } : undefined,
3624
+ jobTitle: prop.trade.alpacaAccount.user.jobTitle !== undefined ? {
3625
+ set: prop.trade.alpacaAccount.user.jobTitle
3626
+ } : undefined,
3627
+ currentAccount: prop.trade.alpacaAccount.user.currentAccount !== undefined ? {
3628
+ set: prop.trade.alpacaAccount.user.currentAccount
3629
+ } : undefined,
3630
+ plan: prop.trade.alpacaAccount.user.plan !== undefined ? {
3631
+ set: prop.trade.alpacaAccount.user.plan
3632
+ } : undefined,
3633
+ },
3634
+ create: {
3635
+ name: prop.trade.alpacaAccount.user.name !== undefined ? prop.trade.alpacaAccount.user.name : undefined,
3636
+ email: prop.trade.alpacaAccount.user.email !== undefined ? prop.trade.alpacaAccount.user.email : undefined,
3637
+ emailVerified: prop.trade.alpacaAccount.user.emailVerified !== undefined ? prop.trade.alpacaAccount.user.emailVerified : undefined,
3638
+ image: prop.trade.alpacaAccount.user.image !== undefined ? prop.trade.alpacaAccount.user.image : undefined,
3639
+ role: prop.trade.alpacaAccount.user.role !== undefined ? prop.trade.alpacaAccount.user.role : undefined,
3640
+ bio: prop.trade.alpacaAccount.user.bio !== undefined ? prop.trade.alpacaAccount.user.bio : undefined,
3641
+ jobTitle: prop.trade.alpacaAccount.user.jobTitle !== undefined ? prop.trade.alpacaAccount.user.jobTitle : undefined,
3642
+ currentAccount: prop.trade.alpacaAccount.user.currentAccount !== undefined ? prop.trade.alpacaAccount.user.currentAccount : undefined,
3643
+ plan: prop.trade.alpacaAccount.user.plan !== undefined ? prop.trade.alpacaAccount.user.plan : undefined,
3644
+ },
3645
+ }
3646
+ } : undefined,
3647
+ orders: prop.trade.alpacaAccount.orders ? {
3648
+ upsert: prop.trade.alpacaAccount.orders.map((item) => ({
3649
+ where: {
3650
+ id: item.id !== undefined ? item.id : undefined,
3651
+ },
3652
+ update: {
3653
+ id: item.id !== undefined ? {
3654
+ set: item.id
3655
+ } : undefined,
3656
+ qty: item.qty !== undefined ? {
3657
+ set: item.qty
3658
+ } : undefined,
3659
+ notional: item.notional !== undefined ? {
3660
+ set: item.notional
3661
+ } : undefined,
3662
+ side: item.side !== undefined ? {
3663
+ set: item.side
3664
+ } : undefined,
3665
+ type: item.type !== undefined ? {
3666
+ set: item.type
3667
+ } : undefined,
3668
+ timeInForce: item.timeInForce !== undefined ? {
3669
+ set: item.timeInForce
3670
+ } : undefined,
3671
+ limitPrice: item.limitPrice !== undefined ? {
3672
+ set: item.limitPrice
3673
+ } : undefined,
3674
+ stopPrice: item.stopPrice !== undefined ? {
3675
+ set: item.stopPrice
3676
+ } : undefined,
3677
+ trailPrice: item.trailPrice !== undefined ? {
3678
+ set: item.trailPrice
3679
+ } : undefined,
3680
+ trailPercent: item.trailPercent !== undefined ? {
3681
+ set: item.trailPercent
3682
+ } : undefined,
3683
+ extendedHours: item.extendedHours !== undefined ? {
3684
+ set: item.extendedHours
3685
+ } : undefined,
3686
+ clientOrderId: item.clientOrderId !== undefined ? {
3687
+ set: item.clientOrderId
3688
+ } : undefined,
3689
+ status: item.status !== undefined ? {
3690
+ set: item.status
3691
+ } : undefined,
3692
+ submittedAt: item.submittedAt !== undefined ? {
3693
+ set: item.submittedAt
3694
+ } : undefined,
3695
+ filledAt: item.filledAt !== undefined ? {
3696
+ set: item.filledAt
3697
+ } : undefined,
3698
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
3699
+ set: item.filledAvgPrice
3700
+ } : undefined,
3701
+ fee: item.fee !== undefined ? {
3702
+ set: item.fee
3703
+ } : undefined,
3704
+ },
3705
+ create: {
3706
+ qty: item.qty !== undefined ? item.qty : undefined,
3707
+ notional: item.notional !== undefined ? item.notional : undefined,
3708
+ side: item.side !== undefined ? item.side : undefined,
3709
+ type: item.type !== undefined ? item.type : undefined,
3710
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
3711
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
3712
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
3713
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
3714
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
3715
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
3716
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3717
+ status: item.status !== undefined ? item.status : undefined,
3718
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
3719
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3720
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3721
+ fee: item.fee !== undefined ? item.fee : undefined,
3722
+ },
3723
+ }))
3724
+ } : undefined,
3725
+ positions: prop.trade.alpacaAccount.positions ? {
3726
+ upsert: prop.trade.alpacaAccount.positions.map((item) => ({
3727
+ where: {
3728
+ id: item.id !== undefined ? item.id : undefined,
3729
+ },
3730
+ update: {
3731
+ id: item.id !== undefined ? {
3732
+ set: item.id
3733
+ } : undefined,
3734
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
3735
+ set: item.averageEntryPrice
3736
+ } : undefined,
3737
+ qty: item.qty !== undefined ? {
3738
+ set: item.qty
3739
+ } : undefined,
3740
+ qtyAvailable: item.qtyAvailable !== undefined ? {
3741
+ set: item.qtyAvailable
3742
+ } : undefined,
3743
+ marketValue: item.marketValue !== undefined ? {
3744
+ set: item.marketValue
3745
+ } : undefined,
3746
+ costBasis: item.costBasis !== undefined ? {
3747
+ set: item.costBasis
3748
+ } : undefined,
3749
+ unrealizedPL: item.unrealizedPL !== undefined ? {
3750
+ set: item.unrealizedPL
3751
+ } : undefined,
3752
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
3753
+ set: item.unrealizedPLPC
3754
+ } : undefined,
3755
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
3756
+ set: item.unrealisedIntradayPL
3757
+ } : undefined,
3758
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
3759
+ set: item.unrealisedIntradayPLPC
3760
+ } : undefined,
3761
+ currentPrice: item.currentPrice !== undefined ? {
3762
+ set: item.currentPrice
3763
+ } : undefined,
3764
+ lastTradePrice: item.lastTradePrice !== undefined ? {
3765
+ set: item.lastTradePrice
3766
+ } : undefined,
3767
+ changeToday: item.changeToday !== undefined ? {
3768
+ set: item.changeToday
3769
+ } : undefined,
3770
+ assetMarginable: item.assetMarginable !== undefined ? {
3771
+ set: item.assetMarginable
3772
+ } : undefined,
3773
+ },
3774
+ create: {
3775
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
3776
+ qty: item.qty !== undefined ? item.qty : undefined,
3777
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
3778
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
3779
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
3780
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
3781
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
3782
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
3783
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
3784
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
3785
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
3786
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
3787
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
3788
+ },
3789
+ }))
3790
+ } : undefined,
3791
+ alerts: prop.trade.alpacaAccount.alerts ? {
3792
+ upsert: prop.trade.alpacaAccount.alerts.map((item) => ({
3793
+ where: {
3794
+ id: item.id !== undefined ? item.id : undefined,
3795
+ },
3796
+ update: {
3797
+ id: item.id !== undefined ? {
3798
+ set: item.id
3799
+ } : undefined,
3800
+ message: item.message !== undefined ? {
3801
+ set: item.message
3802
+ } : undefined,
3803
+ type: item.type !== undefined ? {
3804
+ set: item.type
3805
+ } : undefined,
3806
+ isRead: item.isRead !== undefined ? {
3807
+ set: item.isRead
3808
+ } : undefined,
3809
+ },
3810
+ create: {
3811
+ message: item.message !== undefined ? item.message : undefined,
3812
+ type: item.type !== undefined ? item.type : undefined,
3813
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
3814
+ },
3815
+ }))
3816
+ } : undefined,
1805
3817
  },
1806
3818
  create: {
1807
3819
  type: prop.trade.alpacaAccount.type !== undefined ? prop.trade.alpacaAccount.type : undefined,
@@ -1809,6 +3821,107 @@ export const Action = {
1809
3821
  APISecret: prop.trade.alpacaAccount.APISecret !== undefined ? prop.trade.alpacaAccount.APISecret : undefined,
1810
3822
  configuration: prop.trade.alpacaAccount.configuration !== undefined ? prop.trade.alpacaAccount.configuration : undefined,
1811
3823
  marketOpen: prop.trade.alpacaAccount.marketOpen !== undefined ? prop.trade.alpacaAccount.marketOpen : undefined,
3824
+ user: prop.trade.alpacaAccount.user ?
3825
+ typeof prop.trade.alpacaAccount.user === 'object' && Object.keys(prop.trade.alpacaAccount.user).length === 1 && Object.keys(prop.trade.alpacaAccount.user)[0] === 'id'
3826
+ ? { connect: {
3827
+ id: prop.trade.alpacaAccount.user.id
3828
+ }
3829
+ }
3830
+ : { connectOrCreate: {
3831
+ where: {
3832
+ id: prop.trade.alpacaAccount.user.id !== undefined ? prop.trade.alpacaAccount.user.id : undefined,
3833
+ email: prop.trade.alpacaAccount.user.email !== undefined ? prop.trade.alpacaAccount.user.email : undefined,
3834
+ name: prop.trade.alpacaAccount.user.name !== undefined ? {
3835
+ equals: prop.trade.alpacaAccount.user.name
3836
+ } : undefined,
3837
+ },
3838
+ create: {
3839
+ name: prop.trade.alpacaAccount.user.name !== undefined ? prop.trade.alpacaAccount.user.name : undefined,
3840
+ email: prop.trade.alpacaAccount.user.email !== undefined ? prop.trade.alpacaAccount.user.email : undefined,
3841
+ emailVerified: prop.trade.alpacaAccount.user.emailVerified !== undefined ? prop.trade.alpacaAccount.user.emailVerified : undefined,
3842
+ image: prop.trade.alpacaAccount.user.image !== undefined ? prop.trade.alpacaAccount.user.image : undefined,
3843
+ role: prop.trade.alpacaAccount.user.role !== undefined ? prop.trade.alpacaAccount.user.role : undefined,
3844
+ bio: prop.trade.alpacaAccount.user.bio !== undefined ? prop.trade.alpacaAccount.user.bio : undefined,
3845
+ jobTitle: prop.trade.alpacaAccount.user.jobTitle !== undefined ? prop.trade.alpacaAccount.user.jobTitle : undefined,
3846
+ currentAccount: prop.trade.alpacaAccount.user.currentAccount !== undefined ? prop.trade.alpacaAccount.user.currentAccount : undefined,
3847
+ plan: prop.trade.alpacaAccount.user.plan !== undefined ? prop.trade.alpacaAccount.user.plan : undefined,
3848
+ },
3849
+ }
3850
+ } : undefined,
3851
+ orders: prop.trade.alpacaAccount.orders ?
3852
+ Array.isArray(prop.trade.alpacaAccount.orders) && prop.trade.alpacaAccount.orders.length > 0 && prop.trade.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3853
+ connect: prop.trade.alpacaAccount.orders.map((item) => ({
3854
+ id: item.id
3855
+ }))
3856
+ }
3857
+ : { connectOrCreate: prop.trade.alpacaAccount.orders.map((item) => ({
3858
+ where: {
3859
+ id: item.id !== undefined ? item.id : undefined,
3860
+ },
3861
+ create: {
3862
+ qty: item.qty !== undefined ? item.qty : undefined,
3863
+ notional: item.notional !== undefined ? item.notional : undefined,
3864
+ side: item.side !== undefined ? item.side : undefined,
3865
+ type: item.type !== undefined ? item.type : undefined,
3866
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
3867
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
3868
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
3869
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
3870
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
3871
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
3872
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3873
+ status: item.status !== undefined ? item.status : undefined,
3874
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
3875
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3876
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3877
+ fee: item.fee !== undefined ? item.fee : undefined,
3878
+ },
3879
+ }))
3880
+ } : undefined,
3881
+ positions: prop.trade.alpacaAccount.positions ?
3882
+ Array.isArray(prop.trade.alpacaAccount.positions) && prop.trade.alpacaAccount.positions.length > 0 && prop.trade.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3883
+ connect: prop.trade.alpacaAccount.positions.map((item) => ({
3884
+ id: item.id
3885
+ }))
3886
+ }
3887
+ : { connectOrCreate: prop.trade.alpacaAccount.positions.map((item) => ({
3888
+ where: {
3889
+ id: item.id !== undefined ? item.id : undefined,
3890
+ },
3891
+ create: {
3892
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
3893
+ qty: item.qty !== undefined ? item.qty : undefined,
3894
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
3895
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
3896
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
3897
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
3898
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
3899
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
3900
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
3901
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
3902
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
3903
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
3904
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
3905
+ },
3906
+ }))
3907
+ } : undefined,
3908
+ alerts: prop.trade.alpacaAccount.alerts ?
3909
+ Array.isArray(prop.trade.alpacaAccount.alerts) && prop.trade.alpacaAccount.alerts.length > 0 && prop.trade.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
3910
+ connect: prop.trade.alpacaAccount.alerts.map((item) => ({
3911
+ id: item.id
3912
+ }))
3913
+ }
3914
+ : { connectOrCreate: prop.trade.alpacaAccount.alerts.map((item) => ({
3915
+ where: {
3916
+ id: item.id !== undefined ? item.id : undefined,
3917
+ },
3918
+ create: {
3919
+ message: item.message !== undefined ? item.message : undefined,
3920
+ type: item.type !== undefined ? item.type : undefined,
3921
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
3922
+ },
3923
+ }))
3924
+ } : undefined,
1812
3925
  },
1813
3926
  }
1814
3927
  } : undefined,
@@ -1994,6 +4107,181 @@ export const Action = {
1994
4107
  buyPrice: prop.trade.asset.buyPrice !== undefined ? {
1995
4108
  set: prop.trade.asset.buyPrice
1996
4109
  } : undefined,
4110
+ orders: prop.trade.asset.orders ? {
4111
+ upsert: prop.trade.asset.orders.map((item) => ({
4112
+ where: {
4113
+ id: item.id !== undefined ? item.id : undefined,
4114
+ },
4115
+ update: {
4116
+ id: item.id !== undefined ? {
4117
+ set: item.id
4118
+ } : undefined,
4119
+ qty: item.qty !== undefined ? {
4120
+ set: item.qty
4121
+ } : undefined,
4122
+ notional: item.notional !== undefined ? {
4123
+ set: item.notional
4124
+ } : undefined,
4125
+ side: item.side !== undefined ? {
4126
+ set: item.side
4127
+ } : undefined,
4128
+ type: item.type !== undefined ? {
4129
+ set: item.type
4130
+ } : undefined,
4131
+ timeInForce: item.timeInForce !== undefined ? {
4132
+ set: item.timeInForce
4133
+ } : undefined,
4134
+ limitPrice: item.limitPrice !== undefined ? {
4135
+ set: item.limitPrice
4136
+ } : undefined,
4137
+ stopPrice: item.stopPrice !== undefined ? {
4138
+ set: item.stopPrice
4139
+ } : undefined,
4140
+ trailPrice: item.trailPrice !== undefined ? {
4141
+ set: item.trailPrice
4142
+ } : undefined,
4143
+ trailPercent: item.trailPercent !== undefined ? {
4144
+ set: item.trailPercent
4145
+ } : undefined,
4146
+ extendedHours: item.extendedHours !== undefined ? {
4147
+ set: item.extendedHours
4148
+ } : undefined,
4149
+ clientOrderId: item.clientOrderId !== undefined ? {
4150
+ set: item.clientOrderId
4151
+ } : undefined,
4152
+ status: item.status !== undefined ? {
4153
+ set: item.status
4154
+ } : undefined,
4155
+ submittedAt: item.submittedAt !== undefined ? {
4156
+ set: item.submittedAt
4157
+ } : undefined,
4158
+ filledAt: item.filledAt !== undefined ? {
4159
+ set: item.filledAt
4160
+ } : undefined,
4161
+ filledAvgPrice: item.filledAvgPrice !== undefined ? {
4162
+ set: item.filledAvgPrice
4163
+ } : undefined,
4164
+ fee: item.fee !== undefined ? {
4165
+ set: item.fee
4166
+ } : undefined,
4167
+ },
4168
+ create: {
4169
+ qty: item.qty !== undefined ? item.qty : undefined,
4170
+ notional: item.notional !== undefined ? item.notional : undefined,
4171
+ side: item.side !== undefined ? item.side : undefined,
4172
+ type: item.type !== undefined ? item.type : undefined,
4173
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
4174
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
4175
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
4176
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
4177
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
4178
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
4179
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4180
+ status: item.status !== undefined ? item.status : undefined,
4181
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
4182
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
4183
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
4184
+ fee: item.fee !== undefined ? item.fee : undefined,
4185
+ },
4186
+ }))
4187
+ } : undefined,
4188
+ positions: prop.trade.asset.positions ? {
4189
+ upsert: prop.trade.asset.positions.map((item) => ({
4190
+ where: {
4191
+ id: item.id !== undefined ? item.id : undefined,
4192
+ },
4193
+ update: {
4194
+ id: item.id !== undefined ? {
4195
+ set: item.id
4196
+ } : undefined,
4197
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
4198
+ set: item.averageEntryPrice
4199
+ } : undefined,
4200
+ qty: item.qty !== undefined ? {
4201
+ set: item.qty
4202
+ } : undefined,
4203
+ qtyAvailable: item.qtyAvailable !== undefined ? {
4204
+ set: item.qtyAvailable
4205
+ } : undefined,
4206
+ marketValue: item.marketValue !== undefined ? {
4207
+ set: item.marketValue
4208
+ } : undefined,
4209
+ costBasis: item.costBasis !== undefined ? {
4210
+ set: item.costBasis
4211
+ } : undefined,
4212
+ unrealizedPL: item.unrealizedPL !== undefined ? {
4213
+ set: item.unrealizedPL
4214
+ } : undefined,
4215
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
4216
+ set: item.unrealizedPLPC
4217
+ } : undefined,
4218
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
4219
+ set: item.unrealisedIntradayPL
4220
+ } : undefined,
4221
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
4222
+ set: item.unrealisedIntradayPLPC
4223
+ } : undefined,
4224
+ currentPrice: item.currentPrice !== undefined ? {
4225
+ set: item.currentPrice
4226
+ } : undefined,
4227
+ lastTradePrice: item.lastTradePrice !== undefined ? {
4228
+ set: item.lastTradePrice
4229
+ } : undefined,
4230
+ changeToday: item.changeToday !== undefined ? {
4231
+ set: item.changeToday
4232
+ } : undefined,
4233
+ assetMarginable: item.assetMarginable !== undefined ? {
4234
+ set: item.assetMarginable
4235
+ } : undefined,
4236
+ },
4237
+ create: {
4238
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4239
+ qty: item.qty !== undefined ? item.qty : undefined,
4240
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4241
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4242
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4243
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4244
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4245
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4246
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4247
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4248
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4249
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4250
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4251
+ },
4252
+ }))
4253
+ } : undefined,
4254
+ newsMentions: prop.trade.asset.newsMentions ? {
4255
+ upsert: prop.trade.asset.newsMentions.map((item) => ({
4256
+ where: {
4257
+ id: item.id !== undefined ? item.id : undefined,
4258
+ url: item.url !== undefined ? item.url : undefined,
4259
+ },
4260
+ update: {
4261
+ id: item.id !== undefined ? {
4262
+ set: item.id
4263
+ } : undefined,
4264
+ url: item.url !== undefined ? {
4265
+ set: item.url
4266
+ } : undefined,
4267
+ relevancyScore: item.relevancyScore !== undefined ? {
4268
+ set: item.relevancyScore
4269
+ } : undefined,
4270
+ sentimentScore: item.sentimentScore !== undefined ? {
4271
+ set: item.sentimentScore
4272
+ } : undefined,
4273
+ sentimentLabel: item.sentimentLabel !== undefined ? {
4274
+ set: item.sentimentLabel
4275
+ } : undefined,
4276
+ },
4277
+ create: {
4278
+ url: item.url !== undefined ? item.url : undefined,
4279
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
4280
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
4281
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
4282
+ },
4283
+ }))
4284
+ } : undefined,
1997
4285
  },
1998
4286
  create: {
1999
4287
  symbol: prop.trade.asset.symbol !== undefined ? prop.trade.asset.symbol : undefined,
@@ -2051,6 +4339,82 @@ export const Action = {
2051
4339
  exDividendDate: prop.trade.asset.exDividendDate !== undefined ? prop.trade.asset.exDividendDate : undefined,
2052
4340
  sellPrice: prop.trade.asset.sellPrice !== undefined ? prop.trade.asset.sellPrice : undefined,
2053
4341
  buyPrice: prop.trade.asset.buyPrice !== undefined ? prop.trade.asset.buyPrice : undefined,
4342
+ orders: prop.trade.asset.orders ?
4343
+ Array.isArray(prop.trade.asset.orders) && prop.trade.asset.orders.length > 0 && prop.trade.asset.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4344
+ connect: prop.trade.asset.orders.map((item) => ({
4345
+ id: item.id
4346
+ }))
4347
+ }
4348
+ : { connectOrCreate: prop.trade.asset.orders.map((item) => ({
4349
+ where: {
4350
+ id: item.id !== undefined ? item.id : undefined,
4351
+ },
4352
+ create: {
4353
+ qty: item.qty !== undefined ? item.qty : undefined,
4354
+ notional: item.notional !== undefined ? item.notional : undefined,
4355
+ side: item.side !== undefined ? item.side : undefined,
4356
+ type: item.type !== undefined ? item.type : undefined,
4357
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
4358
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
4359
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
4360
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
4361
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
4362
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
4363
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4364
+ status: item.status !== undefined ? item.status : undefined,
4365
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
4366
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
4367
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
4368
+ fee: item.fee !== undefined ? item.fee : undefined,
4369
+ },
4370
+ }))
4371
+ } : undefined,
4372
+ positions: prop.trade.asset.positions ?
4373
+ Array.isArray(prop.trade.asset.positions) && prop.trade.asset.positions.length > 0 && prop.trade.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4374
+ connect: prop.trade.asset.positions.map((item) => ({
4375
+ id: item.id
4376
+ }))
4377
+ }
4378
+ : { connectOrCreate: prop.trade.asset.positions.map((item) => ({
4379
+ where: {
4380
+ id: item.id !== undefined ? item.id : undefined,
4381
+ },
4382
+ create: {
4383
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4384
+ qty: item.qty !== undefined ? item.qty : undefined,
4385
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4386
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4387
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4388
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4389
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4390
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4391
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4392
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4393
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4394
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4395
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4396
+ },
4397
+ }))
4398
+ } : undefined,
4399
+ newsMentions: prop.trade.asset.newsMentions ?
4400
+ Array.isArray(prop.trade.asset.newsMentions) && prop.trade.asset.newsMentions.length > 0 && prop.trade.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4401
+ connect: prop.trade.asset.newsMentions.map((item) => ({
4402
+ id: item.id
4403
+ }))
4404
+ }
4405
+ : { connectOrCreate: prop.trade.asset.newsMentions.map((item) => ({
4406
+ where: {
4407
+ id: item.id !== undefined ? item.id : undefined,
4408
+ url: item.url !== undefined ? item.url : undefined,
4409
+ },
4410
+ create: {
4411
+ url: item.url !== undefined ? item.url : undefined,
4412
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
4413
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
4414
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
4415
+ },
4416
+ }))
4417
+ } : undefined,
2054
4418
  },
2055
4419
  }
2056
4420
  } : undefined,
@@ -2082,6 +4446,107 @@ export const Action = {
2082
4446
  APISecret: prop.trade.alpacaAccount.APISecret !== undefined ? prop.trade.alpacaAccount.APISecret : undefined,
2083
4447
  configuration: prop.trade.alpacaAccount.configuration !== undefined ? prop.trade.alpacaAccount.configuration : undefined,
2084
4448
  marketOpen: prop.trade.alpacaAccount.marketOpen !== undefined ? prop.trade.alpacaAccount.marketOpen : undefined,
4449
+ user: prop.trade.alpacaAccount.user ?
4450
+ typeof prop.trade.alpacaAccount.user === 'object' && Object.keys(prop.trade.alpacaAccount.user).length === 1 && Object.keys(prop.trade.alpacaAccount.user)[0] === 'id'
4451
+ ? { connect: {
4452
+ id: prop.trade.alpacaAccount.user.id
4453
+ }
4454
+ }
4455
+ : { connectOrCreate: {
4456
+ where: {
4457
+ id: prop.trade.alpacaAccount.user.id !== undefined ? prop.trade.alpacaAccount.user.id : undefined,
4458
+ email: prop.trade.alpacaAccount.user.email !== undefined ? prop.trade.alpacaAccount.user.email : undefined,
4459
+ name: prop.trade.alpacaAccount.user.name !== undefined ? {
4460
+ equals: prop.trade.alpacaAccount.user.name
4461
+ } : undefined,
4462
+ },
4463
+ create: {
4464
+ name: prop.trade.alpacaAccount.user.name !== undefined ? prop.trade.alpacaAccount.user.name : undefined,
4465
+ email: prop.trade.alpacaAccount.user.email !== undefined ? prop.trade.alpacaAccount.user.email : undefined,
4466
+ emailVerified: prop.trade.alpacaAccount.user.emailVerified !== undefined ? prop.trade.alpacaAccount.user.emailVerified : undefined,
4467
+ image: prop.trade.alpacaAccount.user.image !== undefined ? prop.trade.alpacaAccount.user.image : undefined,
4468
+ role: prop.trade.alpacaAccount.user.role !== undefined ? prop.trade.alpacaAccount.user.role : undefined,
4469
+ bio: prop.trade.alpacaAccount.user.bio !== undefined ? prop.trade.alpacaAccount.user.bio : undefined,
4470
+ jobTitle: prop.trade.alpacaAccount.user.jobTitle !== undefined ? prop.trade.alpacaAccount.user.jobTitle : undefined,
4471
+ currentAccount: prop.trade.alpacaAccount.user.currentAccount !== undefined ? prop.trade.alpacaAccount.user.currentAccount : undefined,
4472
+ plan: prop.trade.alpacaAccount.user.plan !== undefined ? prop.trade.alpacaAccount.user.plan : undefined,
4473
+ },
4474
+ }
4475
+ } : undefined,
4476
+ orders: prop.trade.alpacaAccount.orders ?
4477
+ Array.isArray(prop.trade.alpacaAccount.orders) && prop.trade.alpacaAccount.orders.length > 0 && prop.trade.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4478
+ connect: prop.trade.alpacaAccount.orders.map((item) => ({
4479
+ id: item.id
4480
+ }))
4481
+ }
4482
+ : { connectOrCreate: prop.trade.alpacaAccount.orders.map((item) => ({
4483
+ where: {
4484
+ id: item.id !== undefined ? item.id : undefined,
4485
+ },
4486
+ create: {
4487
+ qty: item.qty !== undefined ? item.qty : undefined,
4488
+ notional: item.notional !== undefined ? item.notional : undefined,
4489
+ side: item.side !== undefined ? item.side : undefined,
4490
+ type: item.type !== undefined ? item.type : undefined,
4491
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
4492
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
4493
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
4494
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
4495
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
4496
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
4497
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4498
+ status: item.status !== undefined ? item.status : undefined,
4499
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
4500
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
4501
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
4502
+ fee: item.fee !== undefined ? item.fee : undefined,
4503
+ },
4504
+ }))
4505
+ } : undefined,
4506
+ positions: prop.trade.alpacaAccount.positions ?
4507
+ Array.isArray(prop.trade.alpacaAccount.positions) && prop.trade.alpacaAccount.positions.length > 0 && prop.trade.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4508
+ connect: prop.trade.alpacaAccount.positions.map((item) => ({
4509
+ id: item.id
4510
+ }))
4511
+ }
4512
+ : { connectOrCreate: prop.trade.alpacaAccount.positions.map((item) => ({
4513
+ where: {
4514
+ id: item.id !== undefined ? item.id : undefined,
4515
+ },
4516
+ create: {
4517
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4518
+ qty: item.qty !== undefined ? item.qty : undefined,
4519
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4520
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4521
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4522
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4523
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4524
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4525
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4526
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4527
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4528
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4529
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4530
+ },
4531
+ }))
4532
+ } : undefined,
4533
+ alerts: prop.trade.alpacaAccount.alerts ?
4534
+ Array.isArray(prop.trade.alpacaAccount.alerts) && prop.trade.alpacaAccount.alerts.length > 0 && prop.trade.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4535
+ connect: prop.trade.alpacaAccount.alerts.map((item) => ({
4536
+ id: item.id
4537
+ }))
4538
+ }
4539
+ : { connectOrCreate: prop.trade.alpacaAccount.alerts.map((item) => ({
4540
+ where: {
4541
+ id: item.id !== undefined ? item.id : undefined,
4542
+ },
4543
+ create: {
4544
+ message: item.message !== undefined ? item.message : undefined,
4545
+ type: item.type !== undefined ? item.type : undefined,
4546
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
4547
+ },
4548
+ }))
4549
+ } : undefined,
2085
4550
  },
2086
4551
  }
2087
4552
  } : undefined,
@@ -2153,6 +4618,82 @@ export const Action = {
2153
4618
  exDividendDate: prop.trade.asset.exDividendDate !== undefined ? prop.trade.asset.exDividendDate : undefined,
2154
4619
  sellPrice: prop.trade.asset.sellPrice !== undefined ? prop.trade.asset.sellPrice : undefined,
2155
4620
  buyPrice: prop.trade.asset.buyPrice !== undefined ? prop.trade.asset.buyPrice : undefined,
4621
+ orders: prop.trade.asset.orders ?
4622
+ Array.isArray(prop.trade.asset.orders) && prop.trade.asset.orders.length > 0 && prop.trade.asset.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4623
+ connect: prop.trade.asset.orders.map((item) => ({
4624
+ id: item.id
4625
+ }))
4626
+ }
4627
+ : { connectOrCreate: prop.trade.asset.orders.map((item) => ({
4628
+ where: {
4629
+ id: item.id !== undefined ? item.id : undefined,
4630
+ },
4631
+ create: {
4632
+ qty: item.qty !== undefined ? item.qty : undefined,
4633
+ notional: item.notional !== undefined ? item.notional : undefined,
4634
+ side: item.side !== undefined ? item.side : undefined,
4635
+ type: item.type !== undefined ? item.type : undefined,
4636
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
4637
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
4638
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
4639
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
4640
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
4641
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
4642
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4643
+ status: item.status !== undefined ? item.status : undefined,
4644
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
4645
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
4646
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
4647
+ fee: item.fee !== undefined ? item.fee : undefined,
4648
+ },
4649
+ }))
4650
+ } : undefined,
4651
+ positions: prop.trade.asset.positions ?
4652
+ Array.isArray(prop.trade.asset.positions) && prop.trade.asset.positions.length > 0 && prop.trade.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4653
+ connect: prop.trade.asset.positions.map((item) => ({
4654
+ id: item.id
4655
+ }))
4656
+ }
4657
+ : { connectOrCreate: prop.trade.asset.positions.map((item) => ({
4658
+ where: {
4659
+ id: item.id !== undefined ? item.id : undefined,
4660
+ },
4661
+ create: {
4662
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4663
+ qty: item.qty !== undefined ? item.qty : undefined,
4664
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4665
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4666
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4667
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4668
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4669
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4670
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4671
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4672
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4673
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4674
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4675
+ },
4676
+ }))
4677
+ } : undefined,
4678
+ newsMentions: prop.trade.asset.newsMentions ?
4679
+ Array.isArray(prop.trade.asset.newsMentions) && prop.trade.asset.newsMentions.length > 0 && prop.trade.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
4680
+ connect: prop.trade.asset.newsMentions.map((item) => ({
4681
+ id: item.id
4682
+ }))
4683
+ }
4684
+ : { connectOrCreate: prop.trade.asset.newsMentions.map((item) => ({
4685
+ where: {
4686
+ id: item.id !== undefined ? item.id : undefined,
4687
+ url: item.url !== undefined ? item.url : undefined,
4688
+ },
4689
+ create: {
4690
+ url: item.url !== undefined ? item.url : undefined,
4691
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
4692
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
4693
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
4694
+ },
4695
+ }))
4696
+ } : undefined,
2156
4697
  },
2157
4698
  }
2158
4699
  } : undefined,
@@ -2244,6 +4785,210 @@ export const Action = {
2244
4785
  marketOpen: prop.order.alpacaAccount.marketOpen !== undefined ? {
2245
4786
  set: prop.order.alpacaAccount.marketOpen
2246
4787
  } : undefined,
4788
+ user: prop.order.alpacaAccount.user ? {
4789
+ upsert: {
4790
+ where: {
4791
+ id: prop.order.alpacaAccount.user.id !== undefined ? {
4792
+ equals: prop.order.alpacaAccount.user.id
4793
+ } : undefined,
4794
+ name: prop.order.alpacaAccount.user.name !== undefined ? {
4795
+ equals: prop.order.alpacaAccount.user.name
4796
+ } : undefined,
4797
+ email: prop.order.alpacaAccount.user.email !== undefined ? {
4798
+ equals: prop.order.alpacaAccount.user.email
4799
+ } : undefined,
4800
+ },
4801
+ update: {
4802
+ id: prop.order.alpacaAccount.user.id !== undefined ? {
4803
+ set: prop.order.alpacaAccount.user.id
4804
+ } : undefined,
4805
+ name: prop.order.alpacaAccount.user.name !== undefined ? {
4806
+ set: prop.order.alpacaAccount.user.name
4807
+ } : undefined,
4808
+ email: prop.order.alpacaAccount.user.email !== undefined ? {
4809
+ set: prop.order.alpacaAccount.user.email
4810
+ } : undefined,
4811
+ emailVerified: prop.order.alpacaAccount.user.emailVerified !== undefined ? {
4812
+ set: prop.order.alpacaAccount.user.emailVerified
4813
+ } : undefined,
4814
+ image: prop.order.alpacaAccount.user.image !== undefined ? {
4815
+ set: prop.order.alpacaAccount.user.image
4816
+ } : undefined,
4817
+ role: prop.order.alpacaAccount.user.role !== undefined ? {
4818
+ set: prop.order.alpacaAccount.user.role
4819
+ } : undefined,
4820
+ bio: prop.order.alpacaAccount.user.bio !== undefined ? {
4821
+ set: prop.order.alpacaAccount.user.bio
4822
+ } : undefined,
4823
+ jobTitle: prop.order.alpacaAccount.user.jobTitle !== undefined ? {
4824
+ set: prop.order.alpacaAccount.user.jobTitle
4825
+ } : undefined,
4826
+ currentAccount: prop.order.alpacaAccount.user.currentAccount !== undefined ? {
4827
+ set: prop.order.alpacaAccount.user.currentAccount
4828
+ } : undefined,
4829
+ plan: prop.order.alpacaAccount.user.plan !== undefined ? {
4830
+ set: prop.order.alpacaAccount.user.plan
4831
+ } : undefined,
4832
+ },
4833
+ create: {
4834
+ name: prop.order.alpacaAccount.user.name !== undefined ? prop.order.alpacaAccount.user.name : undefined,
4835
+ email: prop.order.alpacaAccount.user.email !== undefined ? prop.order.alpacaAccount.user.email : undefined,
4836
+ emailVerified: prop.order.alpacaAccount.user.emailVerified !== undefined ? prop.order.alpacaAccount.user.emailVerified : undefined,
4837
+ image: prop.order.alpacaAccount.user.image !== undefined ? prop.order.alpacaAccount.user.image : undefined,
4838
+ role: prop.order.alpacaAccount.user.role !== undefined ? prop.order.alpacaAccount.user.role : undefined,
4839
+ bio: prop.order.alpacaAccount.user.bio !== undefined ? prop.order.alpacaAccount.user.bio : undefined,
4840
+ jobTitle: prop.order.alpacaAccount.user.jobTitle !== undefined ? prop.order.alpacaAccount.user.jobTitle : undefined,
4841
+ currentAccount: prop.order.alpacaAccount.user.currentAccount !== undefined ? prop.order.alpacaAccount.user.currentAccount : undefined,
4842
+ plan: prop.order.alpacaAccount.user.plan !== undefined ? prop.order.alpacaAccount.user.plan : undefined,
4843
+ },
4844
+ }
4845
+ } : undefined,
4846
+ trades: prop.order.alpacaAccount.trades ? {
4847
+ upsert: prop.order.alpacaAccount.trades.map((item) => ({
4848
+ where: {
4849
+ id: item.id !== undefined ? item.id : undefined,
4850
+ },
4851
+ update: {
4852
+ id: item.id !== undefined ? {
4853
+ set: item.id
4854
+ } : undefined,
4855
+ qty: item.qty !== undefined ? {
4856
+ set: item.qty
4857
+ } : undefined,
4858
+ price: item.price !== undefined ? {
4859
+ set: item.price
4860
+ } : undefined,
4861
+ total: item.total !== undefined ? {
4862
+ set: item.total
4863
+ } : undefined,
4864
+ signal: item.signal !== undefined ? {
4865
+ set: item.signal
4866
+ } : undefined,
4867
+ strategy: item.strategy !== undefined ? {
4868
+ set: item.strategy
4869
+ } : undefined,
4870
+ analysis: item.analysis !== undefined ? {
4871
+ set: item.analysis
4872
+ } : undefined,
4873
+ confidence: item.confidence !== undefined ? {
4874
+ set: item.confidence
4875
+ } : undefined,
4876
+ timestamp: item.timestamp !== undefined ? {
4877
+ set: item.timestamp
4878
+ } : undefined,
4879
+ status: item.status !== undefined ? {
4880
+ set: item.status
4881
+ } : undefined,
4882
+ optionContractType: item.optionContractType !== undefined ? {
4883
+ set: item.optionContractType
4884
+ } : undefined,
4885
+ },
4886
+ create: {
4887
+ qty: item.qty !== undefined ? item.qty : undefined,
4888
+ price: item.price !== undefined ? item.price : undefined,
4889
+ total: item.total !== undefined ? item.total : undefined,
4890
+ signal: item.signal !== undefined ? item.signal : undefined,
4891
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
4892
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
4893
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
4894
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
4895
+ status: item.status !== undefined ? item.status : undefined,
4896
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
4897
+ },
4898
+ }))
4899
+ } : undefined,
4900
+ positions: prop.order.alpacaAccount.positions ? {
4901
+ upsert: prop.order.alpacaAccount.positions.map((item) => ({
4902
+ where: {
4903
+ id: item.id !== undefined ? item.id : undefined,
4904
+ },
4905
+ update: {
4906
+ id: item.id !== undefined ? {
4907
+ set: item.id
4908
+ } : undefined,
4909
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
4910
+ set: item.averageEntryPrice
4911
+ } : undefined,
4912
+ qty: item.qty !== undefined ? {
4913
+ set: item.qty
4914
+ } : undefined,
4915
+ qtyAvailable: item.qtyAvailable !== undefined ? {
4916
+ set: item.qtyAvailable
4917
+ } : undefined,
4918
+ marketValue: item.marketValue !== undefined ? {
4919
+ set: item.marketValue
4920
+ } : undefined,
4921
+ costBasis: item.costBasis !== undefined ? {
4922
+ set: item.costBasis
4923
+ } : undefined,
4924
+ unrealizedPL: item.unrealizedPL !== undefined ? {
4925
+ set: item.unrealizedPL
4926
+ } : undefined,
4927
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
4928
+ set: item.unrealizedPLPC
4929
+ } : undefined,
4930
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
4931
+ set: item.unrealisedIntradayPL
4932
+ } : undefined,
4933
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
4934
+ set: item.unrealisedIntradayPLPC
4935
+ } : undefined,
4936
+ currentPrice: item.currentPrice !== undefined ? {
4937
+ set: item.currentPrice
4938
+ } : undefined,
4939
+ lastTradePrice: item.lastTradePrice !== undefined ? {
4940
+ set: item.lastTradePrice
4941
+ } : undefined,
4942
+ changeToday: item.changeToday !== undefined ? {
4943
+ set: item.changeToday
4944
+ } : undefined,
4945
+ assetMarginable: item.assetMarginable !== undefined ? {
4946
+ set: item.assetMarginable
4947
+ } : undefined,
4948
+ },
4949
+ create: {
4950
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
4951
+ qty: item.qty !== undefined ? item.qty : undefined,
4952
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
4953
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
4954
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
4955
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
4956
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
4957
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
4958
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
4959
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
4960
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4961
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4962
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4963
+ },
4964
+ }))
4965
+ } : undefined,
4966
+ alerts: prop.order.alpacaAccount.alerts ? {
4967
+ upsert: prop.order.alpacaAccount.alerts.map((item) => ({
4968
+ where: {
4969
+ id: item.id !== undefined ? item.id : undefined,
4970
+ },
4971
+ update: {
4972
+ id: item.id !== undefined ? {
4973
+ set: item.id
4974
+ } : undefined,
4975
+ message: item.message !== undefined ? {
4976
+ set: item.message
4977
+ } : undefined,
4978
+ type: item.type !== undefined ? {
4979
+ set: item.type
4980
+ } : undefined,
4981
+ isRead: item.isRead !== undefined ? {
4982
+ set: item.isRead
4983
+ } : undefined,
4984
+ },
4985
+ create: {
4986
+ message: item.message !== undefined ? item.message : undefined,
4987
+ type: item.type !== undefined ? item.type : undefined,
4988
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
4989
+ },
4990
+ }))
4991
+ } : undefined,
2247
4992
  },
2248
4993
  create: {
2249
4994
  type: prop.order.alpacaAccount.type !== undefined ? prop.order.alpacaAccount.type : undefined,
@@ -2251,6 +4996,101 @@ export const Action = {
2251
4996
  APISecret: prop.order.alpacaAccount.APISecret !== undefined ? prop.order.alpacaAccount.APISecret : undefined,
2252
4997
  configuration: prop.order.alpacaAccount.configuration !== undefined ? prop.order.alpacaAccount.configuration : undefined,
2253
4998
  marketOpen: prop.order.alpacaAccount.marketOpen !== undefined ? prop.order.alpacaAccount.marketOpen : undefined,
4999
+ user: prop.order.alpacaAccount.user ?
5000
+ typeof prop.order.alpacaAccount.user === 'object' && Object.keys(prop.order.alpacaAccount.user).length === 1 && Object.keys(prop.order.alpacaAccount.user)[0] === 'id'
5001
+ ? { connect: {
5002
+ id: prop.order.alpacaAccount.user.id
5003
+ }
5004
+ }
5005
+ : { connectOrCreate: {
5006
+ where: {
5007
+ id: prop.order.alpacaAccount.user.id !== undefined ? prop.order.alpacaAccount.user.id : undefined,
5008
+ email: prop.order.alpacaAccount.user.email !== undefined ? prop.order.alpacaAccount.user.email : undefined,
5009
+ name: prop.order.alpacaAccount.user.name !== undefined ? {
5010
+ equals: prop.order.alpacaAccount.user.name
5011
+ } : undefined,
5012
+ },
5013
+ create: {
5014
+ name: prop.order.alpacaAccount.user.name !== undefined ? prop.order.alpacaAccount.user.name : undefined,
5015
+ email: prop.order.alpacaAccount.user.email !== undefined ? prop.order.alpacaAccount.user.email : undefined,
5016
+ emailVerified: prop.order.alpacaAccount.user.emailVerified !== undefined ? prop.order.alpacaAccount.user.emailVerified : undefined,
5017
+ image: prop.order.alpacaAccount.user.image !== undefined ? prop.order.alpacaAccount.user.image : undefined,
5018
+ role: prop.order.alpacaAccount.user.role !== undefined ? prop.order.alpacaAccount.user.role : undefined,
5019
+ bio: prop.order.alpacaAccount.user.bio !== undefined ? prop.order.alpacaAccount.user.bio : undefined,
5020
+ jobTitle: prop.order.alpacaAccount.user.jobTitle !== undefined ? prop.order.alpacaAccount.user.jobTitle : undefined,
5021
+ currentAccount: prop.order.alpacaAccount.user.currentAccount !== undefined ? prop.order.alpacaAccount.user.currentAccount : undefined,
5022
+ plan: prop.order.alpacaAccount.user.plan !== undefined ? prop.order.alpacaAccount.user.plan : undefined,
5023
+ },
5024
+ }
5025
+ } : undefined,
5026
+ trades: prop.order.alpacaAccount.trades ?
5027
+ Array.isArray(prop.order.alpacaAccount.trades) && prop.order.alpacaAccount.trades.length > 0 && prop.order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5028
+ connect: prop.order.alpacaAccount.trades.map((item) => ({
5029
+ id: item.id
5030
+ }))
5031
+ }
5032
+ : { connectOrCreate: prop.order.alpacaAccount.trades.map((item) => ({
5033
+ where: {
5034
+ id: item.id !== undefined ? item.id : undefined,
5035
+ },
5036
+ create: {
5037
+ qty: item.qty !== undefined ? item.qty : undefined,
5038
+ price: item.price !== undefined ? item.price : undefined,
5039
+ total: item.total !== undefined ? item.total : undefined,
5040
+ signal: item.signal !== undefined ? item.signal : undefined,
5041
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5042
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5043
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5044
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5045
+ status: item.status !== undefined ? item.status : undefined,
5046
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5047
+ },
5048
+ }))
5049
+ } : undefined,
5050
+ positions: prop.order.alpacaAccount.positions ?
5051
+ Array.isArray(prop.order.alpacaAccount.positions) && prop.order.alpacaAccount.positions.length > 0 && prop.order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5052
+ connect: prop.order.alpacaAccount.positions.map((item) => ({
5053
+ id: item.id
5054
+ }))
5055
+ }
5056
+ : { connectOrCreate: prop.order.alpacaAccount.positions.map((item) => ({
5057
+ where: {
5058
+ id: item.id !== undefined ? item.id : undefined,
5059
+ },
5060
+ create: {
5061
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
5062
+ qty: item.qty !== undefined ? item.qty : undefined,
5063
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
5064
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
5065
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
5066
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
5067
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
5068
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
5069
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
5070
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
5071
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
5072
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
5073
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
5074
+ },
5075
+ }))
5076
+ } : undefined,
5077
+ alerts: prop.order.alpacaAccount.alerts ?
5078
+ Array.isArray(prop.order.alpacaAccount.alerts) && prop.order.alpacaAccount.alerts.length > 0 && prop.order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5079
+ connect: prop.order.alpacaAccount.alerts.map((item) => ({
5080
+ id: item.id
5081
+ }))
5082
+ }
5083
+ : { connectOrCreate: prop.order.alpacaAccount.alerts.map((item) => ({
5084
+ where: {
5085
+ id: item.id !== undefined ? item.id : undefined,
5086
+ },
5087
+ create: {
5088
+ message: item.message !== undefined ? item.message : undefined,
5089
+ type: item.type !== undefined ? item.type : undefined,
5090
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
5091
+ },
5092
+ }))
5093
+ } : undefined,
2254
5094
  },
2255
5095
  }
2256
5096
  } : undefined,
@@ -2436,6 +5276,157 @@ export const Action = {
2436
5276
  buyPrice: prop.order.asset.buyPrice !== undefined ? {
2437
5277
  set: prop.order.asset.buyPrice
2438
5278
  } : undefined,
5279
+ trades: prop.order.asset.trades ? {
5280
+ upsert: prop.order.asset.trades.map((item) => ({
5281
+ where: {
5282
+ id: item.id !== undefined ? item.id : undefined,
5283
+ },
5284
+ update: {
5285
+ id: item.id !== undefined ? {
5286
+ set: item.id
5287
+ } : undefined,
5288
+ qty: item.qty !== undefined ? {
5289
+ set: item.qty
5290
+ } : undefined,
5291
+ price: item.price !== undefined ? {
5292
+ set: item.price
5293
+ } : undefined,
5294
+ total: item.total !== undefined ? {
5295
+ set: item.total
5296
+ } : undefined,
5297
+ signal: item.signal !== undefined ? {
5298
+ set: item.signal
5299
+ } : undefined,
5300
+ strategy: item.strategy !== undefined ? {
5301
+ set: item.strategy
5302
+ } : undefined,
5303
+ analysis: item.analysis !== undefined ? {
5304
+ set: item.analysis
5305
+ } : undefined,
5306
+ confidence: item.confidence !== undefined ? {
5307
+ set: item.confidence
5308
+ } : undefined,
5309
+ timestamp: item.timestamp !== undefined ? {
5310
+ set: item.timestamp
5311
+ } : undefined,
5312
+ status: item.status !== undefined ? {
5313
+ set: item.status
5314
+ } : undefined,
5315
+ optionContractType: item.optionContractType !== undefined ? {
5316
+ set: item.optionContractType
5317
+ } : undefined,
5318
+ },
5319
+ create: {
5320
+ qty: item.qty !== undefined ? item.qty : undefined,
5321
+ price: item.price !== undefined ? item.price : undefined,
5322
+ total: item.total !== undefined ? item.total : undefined,
5323
+ signal: item.signal !== undefined ? item.signal : undefined,
5324
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5325
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5326
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5327
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5328
+ status: item.status !== undefined ? item.status : undefined,
5329
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5330
+ },
5331
+ }))
5332
+ } : undefined,
5333
+ positions: prop.order.asset.positions ? {
5334
+ upsert: prop.order.asset.positions.map((item) => ({
5335
+ where: {
5336
+ id: item.id !== undefined ? item.id : undefined,
5337
+ },
5338
+ update: {
5339
+ id: item.id !== undefined ? {
5340
+ set: item.id
5341
+ } : undefined,
5342
+ averageEntryPrice: item.averageEntryPrice !== undefined ? {
5343
+ set: item.averageEntryPrice
5344
+ } : undefined,
5345
+ qty: item.qty !== undefined ? {
5346
+ set: item.qty
5347
+ } : undefined,
5348
+ qtyAvailable: item.qtyAvailable !== undefined ? {
5349
+ set: item.qtyAvailable
5350
+ } : undefined,
5351
+ marketValue: item.marketValue !== undefined ? {
5352
+ set: item.marketValue
5353
+ } : undefined,
5354
+ costBasis: item.costBasis !== undefined ? {
5355
+ set: item.costBasis
5356
+ } : undefined,
5357
+ unrealizedPL: item.unrealizedPL !== undefined ? {
5358
+ set: item.unrealizedPL
5359
+ } : undefined,
5360
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? {
5361
+ set: item.unrealizedPLPC
5362
+ } : undefined,
5363
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? {
5364
+ set: item.unrealisedIntradayPL
5365
+ } : undefined,
5366
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? {
5367
+ set: item.unrealisedIntradayPLPC
5368
+ } : undefined,
5369
+ currentPrice: item.currentPrice !== undefined ? {
5370
+ set: item.currentPrice
5371
+ } : undefined,
5372
+ lastTradePrice: item.lastTradePrice !== undefined ? {
5373
+ set: item.lastTradePrice
5374
+ } : undefined,
5375
+ changeToday: item.changeToday !== undefined ? {
5376
+ set: item.changeToday
5377
+ } : undefined,
5378
+ assetMarginable: item.assetMarginable !== undefined ? {
5379
+ set: item.assetMarginable
5380
+ } : undefined,
5381
+ },
5382
+ create: {
5383
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
5384
+ qty: item.qty !== undefined ? item.qty : undefined,
5385
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
5386
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
5387
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
5388
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
5389
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
5390
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
5391
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
5392
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
5393
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
5394
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
5395
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
5396
+ },
5397
+ }))
5398
+ } : undefined,
5399
+ newsMentions: prop.order.asset.newsMentions ? {
5400
+ upsert: prop.order.asset.newsMentions.map((item) => ({
5401
+ where: {
5402
+ id: item.id !== undefined ? item.id : undefined,
5403
+ url: item.url !== undefined ? item.url : undefined,
5404
+ },
5405
+ update: {
5406
+ id: item.id !== undefined ? {
5407
+ set: item.id
5408
+ } : undefined,
5409
+ url: item.url !== undefined ? {
5410
+ set: item.url
5411
+ } : undefined,
5412
+ relevancyScore: item.relevancyScore !== undefined ? {
5413
+ set: item.relevancyScore
5414
+ } : undefined,
5415
+ sentimentScore: item.sentimentScore !== undefined ? {
5416
+ set: item.sentimentScore
5417
+ } : undefined,
5418
+ sentimentLabel: item.sentimentLabel !== undefined ? {
5419
+ set: item.sentimentLabel
5420
+ } : undefined,
5421
+ },
5422
+ create: {
5423
+ url: item.url !== undefined ? item.url : undefined,
5424
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
5425
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
5426
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
5427
+ },
5428
+ }))
5429
+ } : undefined,
2439
5430
  },
2440
5431
  create: {
2441
5432
  symbol: prop.order.asset.symbol !== undefined ? prop.order.asset.symbol : undefined,
@@ -2493,6 +5484,76 @@ export const Action = {
2493
5484
  exDividendDate: prop.order.asset.exDividendDate !== undefined ? prop.order.asset.exDividendDate : undefined,
2494
5485
  sellPrice: prop.order.asset.sellPrice !== undefined ? prop.order.asset.sellPrice : undefined,
2495
5486
  buyPrice: prop.order.asset.buyPrice !== undefined ? prop.order.asset.buyPrice : undefined,
5487
+ trades: prop.order.asset.trades ?
5488
+ Array.isArray(prop.order.asset.trades) && prop.order.asset.trades.length > 0 && prop.order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5489
+ connect: prop.order.asset.trades.map((item) => ({
5490
+ id: item.id
5491
+ }))
5492
+ }
5493
+ : { connectOrCreate: prop.order.asset.trades.map((item) => ({
5494
+ where: {
5495
+ id: item.id !== undefined ? item.id : undefined,
5496
+ },
5497
+ create: {
5498
+ qty: item.qty !== undefined ? item.qty : undefined,
5499
+ price: item.price !== undefined ? item.price : undefined,
5500
+ total: item.total !== undefined ? item.total : undefined,
5501
+ signal: item.signal !== undefined ? item.signal : undefined,
5502
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5503
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5504
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5505
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5506
+ status: item.status !== undefined ? item.status : undefined,
5507
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5508
+ },
5509
+ }))
5510
+ } : undefined,
5511
+ positions: prop.order.asset.positions ?
5512
+ Array.isArray(prop.order.asset.positions) && prop.order.asset.positions.length > 0 && prop.order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5513
+ connect: prop.order.asset.positions.map((item) => ({
5514
+ id: item.id
5515
+ }))
5516
+ }
5517
+ : { connectOrCreate: prop.order.asset.positions.map((item) => ({
5518
+ where: {
5519
+ id: item.id !== undefined ? item.id : undefined,
5520
+ },
5521
+ create: {
5522
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
5523
+ qty: item.qty !== undefined ? item.qty : undefined,
5524
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
5525
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
5526
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
5527
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
5528
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
5529
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
5530
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
5531
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
5532
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
5533
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
5534
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
5535
+ },
5536
+ }))
5537
+ } : undefined,
5538
+ newsMentions: prop.order.asset.newsMentions ?
5539
+ Array.isArray(prop.order.asset.newsMentions) && prop.order.asset.newsMentions.length > 0 && prop.order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5540
+ connect: prop.order.asset.newsMentions.map((item) => ({
5541
+ id: item.id
5542
+ }))
5543
+ }
5544
+ : { connectOrCreate: prop.order.asset.newsMentions.map((item) => ({
5545
+ where: {
5546
+ id: item.id !== undefined ? item.id : undefined,
5547
+ url: item.url !== undefined ? item.url : undefined,
5548
+ },
5549
+ create: {
5550
+ url: item.url !== undefined ? item.url : undefined,
5551
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
5552
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
5553
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
5554
+ },
5555
+ }))
5556
+ } : undefined,
2496
5557
  },
2497
5558
  }
2498
5559
  } : undefined,
@@ -2530,6 +5591,101 @@ export const Action = {
2530
5591
  APISecret: prop.order.alpacaAccount.APISecret !== undefined ? prop.order.alpacaAccount.APISecret : undefined,
2531
5592
  configuration: prop.order.alpacaAccount.configuration !== undefined ? prop.order.alpacaAccount.configuration : undefined,
2532
5593
  marketOpen: prop.order.alpacaAccount.marketOpen !== undefined ? prop.order.alpacaAccount.marketOpen : undefined,
5594
+ user: prop.order.alpacaAccount.user ?
5595
+ typeof prop.order.alpacaAccount.user === 'object' && Object.keys(prop.order.alpacaAccount.user).length === 1 && Object.keys(prop.order.alpacaAccount.user)[0] === 'id'
5596
+ ? { connect: {
5597
+ id: prop.order.alpacaAccount.user.id
5598
+ }
5599
+ }
5600
+ : { connectOrCreate: {
5601
+ where: {
5602
+ id: prop.order.alpacaAccount.user.id !== undefined ? prop.order.alpacaAccount.user.id : undefined,
5603
+ email: prop.order.alpacaAccount.user.email !== undefined ? prop.order.alpacaAccount.user.email : undefined,
5604
+ name: prop.order.alpacaAccount.user.name !== undefined ? {
5605
+ equals: prop.order.alpacaAccount.user.name
5606
+ } : undefined,
5607
+ },
5608
+ create: {
5609
+ name: prop.order.alpacaAccount.user.name !== undefined ? prop.order.alpacaAccount.user.name : undefined,
5610
+ email: prop.order.alpacaAccount.user.email !== undefined ? prop.order.alpacaAccount.user.email : undefined,
5611
+ emailVerified: prop.order.alpacaAccount.user.emailVerified !== undefined ? prop.order.alpacaAccount.user.emailVerified : undefined,
5612
+ image: prop.order.alpacaAccount.user.image !== undefined ? prop.order.alpacaAccount.user.image : undefined,
5613
+ role: prop.order.alpacaAccount.user.role !== undefined ? prop.order.alpacaAccount.user.role : undefined,
5614
+ bio: prop.order.alpacaAccount.user.bio !== undefined ? prop.order.alpacaAccount.user.bio : undefined,
5615
+ jobTitle: prop.order.alpacaAccount.user.jobTitle !== undefined ? prop.order.alpacaAccount.user.jobTitle : undefined,
5616
+ currentAccount: prop.order.alpacaAccount.user.currentAccount !== undefined ? prop.order.alpacaAccount.user.currentAccount : undefined,
5617
+ plan: prop.order.alpacaAccount.user.plan !== undefined ? prop.order.alpacaAccount.user.plan : undefined,
5618
+ },
5619
+ }
5620
+ } : undefined,
5621
+ trades: prop.order.alpacaAccount.trades ?
5622
+ Array.isArray(prop.order.alpacaAccount.trades) && prop.order.alpacaAccount.trades.length > 0 && prop.order.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5623
+ connect: prop.order.alpacaAccount.trades.map((item) => ({
5624
+ id: item.id
5625
+ }))
5626
+ }
5627
+ : { connectOrCreate: prop.order.alpacaAccount.trades.map((item) => ({
5628
+ where: {
5629
+ id: item.id !== undefined ? item.id : undefined,
5630
+ },
5631
+ create: {
5632
+ qty: item.qty !== undefined ? item.qty : undefined,
5633
+ price: item.price !== undefined ? item.price : undefined,
5634
+ total: item.total !== undefined ? item.total : undefined,
5635
+ signal: item.signal !== undefined ? item.signal : undefined,
5636
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5637
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5638
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5639
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5640
+ status: item.status !== undefined ? item.status : undefined,
5641
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5642
+ },
5643
+ }))
5644
+ } : undefined,
5645
+ positions: prop.order.alpacaAccount.positions ?
5646
+ Array.isArray(prop.order.alpacaAccount.positions) && prop.order.alpacaAccount.positions.length > 0 && prop.order.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5647
+ connect: prop.order.alpacaAccount.positions.map((item) => ({
5648
+ id: item.id
5649
+ }))
5650
+ }
5651
+ : { connectOrCreate: prop.order.alpacaAccount.positions.map((item) => ({
5652
+ where: {
5653
+ id: item.id !== undefined ? item.id : undefined,
5654
+ },
5655
+ create: {
5656
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
5657
+ qty: item.qty !== undefined ? item.qty : undefined,
5658
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
5659
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
5660
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
5661
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
5662
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
5663
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
5664
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
5665
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
5666
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
5667
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
5668
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
5669
+ },
5670
+ }))
5671
+ } : undefined,
5672
+ alerts: prop.order.alpacaAccount.alerts ?
5673
+ Array.isArray(prop.order.alpacaAccount.alerts) && prop.order.alpacaAccount.alerts.length > 0 && prop.order.alpacaAccount.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5674
+ connect: prop.order.alpacaAccount.alerts.map((item) => ({
5675
+ id: item.id
5676
+ }))
5677
+ }
5678
+ : { connectOrCreate: prop.order.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,
2533
5689
  },
2534
5690
  }
2535
5691
  } : undefined,
@@ -2601,6 +5757,76 @@ export const Action = {
2601
5757
  exDividendDate: prop.order.asset.exDividendDate !== undefined ? prop.order.asset.exDividendDate : undefined,
2602
5758
  sellPrice: prop.order.asset.sellPrice !== undefined ? prop.order.asset.sellPrice : undefined,
2603
5759
  buyPrice: prop.order.asset.buyPrice !== undefined ? prop.order.asset.buyPrice : undefined,
5760
+ trades: prop.order.asset.trades ?
5761
+ Array.isArray(prop.order.asset.trades) && prop.order.asset.trades.length > 0 && prop.order.asset.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5762
+ connect: prop.order.asset.trades.map((item) => ({
5763
+ id: item.id
5764
+ }))
5765
+ }
5766
+ : { connectOrCreate: prop.order.asset.trades.map((item) => ({
5767
+ where: {
5768
+ id: item.id !== undefined ? item.id : undefined,
5769
+ },
5770
+ create: {
5771
+ qty: item.qty !== undefined ? item.qty : undefined,
5772
+ price: item.price !== undefined ? item.price : undefined,
5773
+ total: item.total !== undefined ? item.total : undefined,
5774
+ signal: item.signal !== undefined ? item.signal : undefined,
5775
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
5776
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
5777
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
5778
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
5779
+ status: item.status !== undefined ? item.status : undefined,
5780
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
5781
+ },
5782
+ }))
5783
+ } : undefined,
5784
+ positions: prop.order.asset.positions ?
5785
+ Array.isArray(prop.order.asset.positions) && prop.order.asset.positions.length > 0 && prop.order.asset.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5786
+ connect: prop.order.asset.positions.map((item) => ({
5787
+ id: item.id
5788
+ }))
5789
+ }
5790
+ : { connectOrCreate: prop.order.asset.positions.map((item) => ({
5791
+ where: {
5792
+ id: item.id !== undefined ? item.id : undefined,
5793
+ },
5794
+ create: {
5795
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
5796
+ qty: item.qty !== undefined ? item.qty : undefined,
5797
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
5798
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
5799
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
5800
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
5801
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
5802
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
5803
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
5804
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
5805
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
5806
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
5807
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
5808
+ },
5809
+ }))
5810
+ } : undefined,
5811
+ newsMentions: prop.order.asset.newsMentions ?
5812
+ Array.isArray(prop.order.asset.newsMentions) && prop.order.asset.newsMentions.length > 0 && prop.order.asset.newsMentions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
5813
+ connect: prop.order.asset.newsMentions.map((item) => ({
5814
+ id: item.id
5815
+ }))
5816
+ }
5817
+ : { connectOrCreate: prop.order.asset.newsMentions.map((item) => ({
5818
+ where: {
5819
+ id: item.id !== undefined ? item.id : undefined,
5820
+ url: item.url !== undefined ? item.url : undefined,
5821
+ },
5822
+ create: {
5823
+ url: item.url !== undefined ? item.url : undefined,
5824
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
5825
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
5826
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
5827
+ },
5828
+ }))
5829
+ } : undefined,
2604
5830
  },
2605
5831
  }
2606
5832
  } : undefined,