adaptic-backend 1.0.159 → 1.0.161

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 (65) hide show
  1. package/Account.cjs +285 -8
  2. package/Action.cjs +615 -4
  3. package/Alert.cjs +338 -4
  4. package/AlpacaAccount.cjs +771 -4
  5. package/Asset.cjs +642 -0
  6. package/Authenticator.cjs +288 -4
  7. package/Customer.cjs +273 -10
  8. package/NewsArticle.cjs +165 -0
  9. package/NewsArticleAssetSentiment.cjs +256 -8
  10. package/Order.cjs +510 -10
  11. package/Position.cjs +546 -8
  12. package/Session.cjs +288 -4
  13. package/StopLoss.cjs +348 -1
  14. package/TakeProfit.cjs +348 -1
  15. package/Trade.cjs +607 -8
  16. package/User.cjs +261 -0
  17. package/package.json +1 -1
  18. package/server/Account.d.ts.map +1 -1
  19. package/server/Account.js.map +1 -1
  20. package/server/Account.mjs +285 -8
  21. package/server/Action.d.ts.map +1 -1
  22. package/server/Action.js.map +1 -1
  23. package/server/Action.mjs +615 -4
  24. package/server/Alert.d.ts.map +1 -1
  25. package/server/Alert.js.map +1 -1
  26. package/server/Alert.mjs +338 -4
  27. package/server/AlpacaAccount.d.ts.map +1 -1
  28. package/server/AlpacaAccount.js.map +1 -1
  29. package/server/AlpacaAccount.mjs +771 -4
  30. package/server/Asset.d.ts.map +1 -1
  31. package/server/Asset.js.map +1 -1
  32. package/server/Asset.mjs +642 -0
  33. package/server/Authenticator.d.ts.map +1 -1
  34. package/server/Authenticator.js.map +1 -1
  35. package/server/Authenticator.mjs +288 -4
  36. package/server/Customer.d.ts.map +1 -1
  37. package/server/Customer.js.map +1 -1
  38. package/server/Customer.mjs +273 -10
  39. package/server/NewsArticle.d.ts.map +1 -1
  40. package/server/NewsArticle.js.map +1 -1
  41. package/server/NewsArticle.mjs +165 -0
  42. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  43. package/server/NewsArticleAssetSentiment.js.map +1 -1
  44. package/server/NewsArticleAssetSentiment.mjs +256 -8
  45. package/server/Order.d.ts.map +1 -1
  46. package/server/Order.js.map +1 -1
  47. package/server/Order.mjs +510 -10
  48. package/server/Position.d.ts.map +1 -1
  49. package/server/Position.js.map +1 -1
  50. package/server/Position.mjs +546 -8
  51. package/server/Session.d.ts.map +1 -1
  52. package/server/Session.js.map +1 -1
  53. package/server/Session.mjs +288 -4
  54. package/server/StopLoss.d.ts.map +1 -1
  55. package/server/StopLoss.js.map +1 -1
  56. package/server/StopLoss.mjs +348 -1
  57. package/server/TakeProfit.d.ts.map +1 -1
  58. package/server/TakeProfit.js.map +1 -1
  59. package/server/TakeProfit.mjs +348 -1
  60. package/server/Trade.d.ts.map +1 -1
  61. package/server/Trade.js.map +1 -1
  62. package/server/Trade.mjs +607 -8
  63. package/server/User.d.ts.map +1 -1
  64. package/server/User.js.map +1 -1
  65. package/server/User.mjs +261 -0
package/Position.cjs CHANGED
@@ -297,6 +297,12 @@ exports.Position = {
297
297
  : { connectOrCreate: props.asset.trades.map((item) => ({
298
298
  where: {
299
299
  id: item.id !== undefined ? item.id : undefined,
300
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
301
+ equals: item.alpacaAccountId
302
+ } : undefined,
303
+ assetId: item.assetId !== undefined ? {
304
+ equals: item.assetId
305
+ } : undefined,
300
306
  },
301
307
  create: {
302
308
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -319,6 +325,9 @@ exports.Position = {
319
325
  : { connectOrCreate: {
320
326
  where: {
321
327
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
328
+ userId: item.alpacaAccount.userId !== undefined ? {
329
+ equals: item.alpacaAccount.userId
330
+ } : undefined,
322
331
  },
323
332
  create: {
324
333
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -342,6 +351,9 @@ exports.Position = {
342
351
  : { connectOrCreate: item.actions.map((item) => ({
343
352
  where: {
344
353
  id: item.id !== undefined ? item.id : undefined,
354
+ tradeId: item.tradeId !== undefined ? {
355
+ equals: item.tradeId
356
+ } : undefined,
345
357
  },
346
358
  create: {
347
359
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -364,6 +376,15 @@ exports.Position = {
364
376
  : { connectOrCreate: props.asset.orders.map((item) => ({
365
377
  where: {
366
378
  id: item.id !== undefined ? item.id : undefined,
379
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
380
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
381
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
382
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
383
+ equals: item.alpacaAccountId
384
+ } : undefined,
385
+ assetId: item.assetId !== undefined ? {
386
+ equals: item.assetId
387
+ } : undefined,
367
388
  },
368
389
  create: {
369
390
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -397,6 +418,7 @@ exports.Position = {
397
418
  : { connectOrCreate: {
398
419
  where: {
399
420
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
421
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
400
422
  },
401
423
  create: {
402
424
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -413,6 +435,7 @@ exports.Position = {
413
435
  : { connectOrCreate: {
414
436
  where: {
415
437
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
438
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
416
439
  },
417
440
  create: {
418
441
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -429,6 +452,9 @@ exports.Position = {
429
452
  : { connectOrCreate: {
430
453
  where: {
431
454
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
455
+ userId: item.alpacaAccount.userId !== undefined ? {
456
+ equals: item.alpacaAccount.userId
457
+ } : undefined,
432
458
  },
433
459
  create: {
434
460
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -452,6 +478,9 @@ exports.Position = {
452
478
  : { connectOrCreate: {
453
479
  where: {
454
480
  id: item.action.id !== undefined ? item.action.id : undefined,
481
+ tradeId: item.action.tradeId !== undefined ? {
482
+ equals: item.action.tradeId
483
+ } : undefined,
455
484
  },
456
485
  create: {
457
486
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -475,6 +504,12 @@ exports.Position = {
475
504
  where: {
476
505
  id: item.id !== undefined ? item.id : undefined,
477
506
  url: item.url !== undefined ? item.url : undefined,
507
+ assetId: item.assetId !== undefined ? {
508
+ equals: item.assetId
509
+ } : undefined,
510
+ newsArticleId: item.newsArticleId !== undefined ? {
511
+ equals: item.newsArticleId
512
+ } : undefined,
478
513
  },
479
514
  create: {
480
515
  url: item.url !== undefined ? item.url : undefined,
@@ -527,6 +562,9 @@ exports.Position = {
527
562
  : { connectOrCreate: {
528
563
  where: {
529
564
  id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
565
+ userId: props.alpacaAccount.userId !== undefined ? {
566
+ equals: props.alpacaAccount.userId
567
+ } : undefined,
530
568
  },
531
569
  create: {
532
570
  type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
@@ -573,9 +611,17 @@ exports.Position = {
573
611
  : { connectOrCreate: {
574
612
  where: {
575
613
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
614
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
615
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
616
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
617
+ equals: props.alpacaAccount.user.customer.authUserId
618
+ } : undefined,
576
619
  name: props.alpacaAccount.user.customer.name !== undefined ? {
577
620
  equals: props.alpacaAccount.user.customer.name
578
621
  } : undefined,
622
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
623
+ equals: props.alpacaAccount.user.customer.stripePriceId
624
+ } : undefined,
579
625
  },
580
626
  create: {
581
627
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -597,6 +643,12 @@ exports.Position = {
597
643
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
598
644
  where: {
599
645
  id: item.id !== undefined ? item.id : undefined,
646
+ userId: item.userId !== undefined ? {
647
+ equals: item.userId
648
+ } : undefined,
649
+ providerAccountId: item.providerAccountId !== undefined ? {
650
+ equals: item.providerAccountId
651
+ } : undefined,
600
652
  },
601
653
  create: {
602
654
  type: item.type !== undefined ? item.type : undefined,
@@ -621,6 +673,9 @@ exports.Position = {
621
673
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
622
674
  where: {
623
675
  id: item.id !== undefined ? item.id : undefined,
676
+ userId: item.userId !== undefined ? {
677
+ equals: item.userId
678
+ } : undefined,
624
679
  },
625
680
  create: {
626
681
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -637,6 +692,9 @@ exports.Position = {
637
692
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
638
693
  where: {
639
694
  id: item.id !== undefined ? item.id : undefined,
695
+ userId: item.userId !== undefined ? {
696
+ equals: item.userId
697
+ } : undefined,
640
698
  },
641
699
  create: {
642
700
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -657,6 +715,12 @@ exports.Position = {
657
715
  : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
658
716
  where: {
659
717
  id: item.id !== undefined ? item.id : undefined,
718
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
719
+ equals: item.alpacaAccountId
720
+ } : undefined,
721
+ assetId: item.assetId !== undefined ? {
722
+ equals: item.assetId
723
+ } : undefined,
660
724
  },
661
725
  create: {
662
726
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -750,6 +814,9 @@ exports.Position = {
750
814
  : { connectOrCreate: item.actions.map((item) => ({
751
815
  where: {
752
816
  id: item.id !== undefined ? item.id : undefined,
817
+ tradeId: item.tradeId !== undefined ? {
818
+ equals: item.tradeId
819
+ } : undefined,
753
820
  },
754
821
  create: {
755
822
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -772,6 +839,15 @@ exports.Position = {
772
839
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
773
840
  where: {
774
841
  id: item.id !== undefined ? item.id : undefined,
842
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
843
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
844
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
845
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
846
+ equals: item.alpacaAccountId
847
+ } : undefined,
848
+ assetId: item.assetId !== undefined ? {
849
+ equals: item.assetId
850
+ } : undefined,
775
851
  },
776
852
  create: {
777
853
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -805,6 +881,7 @@ exports.Position = {
805
881
  : { connectOrCreate: {
806
882
  where: {
807
883
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
884
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
808
885
  },
809
886
  create: {
810
887
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -821,6 +898,7 @@ exports.Position = {
821
898
  : { connectOrCreate: {
822
899
  where: {
823
900
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
901
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
824
902
  },
825
903
  create: {
826
904
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -837,6 +915,9 @@ exports.Position = {
837
915
  : { connectOrCreate: {
838
916
  where: {
839
917
  id: item.action.id !== undefined ? item.action.id : undefined,
918
+ tradeId: item.action.tradeId !== undefined ? {
919
+ equals: item.action.tradeId
920
+ } : undefined,
840
921
  },
841
922
  create: {
842
923
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -930,6 +1011,9 @@ exports.Position = {
930
1011
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
931
1012
  where: {
932
1013
  id: item.id !== undefined ? item.id : undefined,
1014
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1015
+ equals: item.alpacaAccountId
1016
+ } : undefined,
933
1017
  },
934
1018
  create: {
935
1019
  message: item.message !== undefined ? item.message : undefined,
@@ -1025,7 +1109,9 @@ exports.Position = {
1025
1109
  const variables = {
1026
1110
  where: {
1027
1111
  id: props.id !== undefined ? props.id : undefined,
1028
- assetId: props.assetId !== undefined ? props.assetId : undefined,
1112
+ assetId: props.assetId !== undefined ? {
1113
+ equals: props.assetId
1114
+ } : undefined,
1029
1115
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
1030
1116
  qty: props.qty !== undefined ? props.qty : undefined,
1031
1117
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -1038,7 +1124,9 @@ exports.Position = {
1038
1124
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
1039
1125
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
1040
1126
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
1041
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
1127
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
1128
+ equals: props.alpacaAccountId
1129
+ } : undefined,
1042
1130
  },
1043
1131
  data: {
1044
1132
  id: props.id !== undefined ? {
@@ -1269,6 +1357,12 @@ exports.Position = {
1269
1357
  upsert: props.asset.trades.map((item) => ({
1270
1358
  where: {
1271
1359
  id: item.id !== undefined ? item.id : undefined,
1360
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1361
+ equals: item.alpacaAccountId
1362
+ } : undefined,
1363
+ assetId: item.assetId !== undefined ? {
1364
+ equals: item.assetId
1365
+ } : undefined,
1272
1366
  },
1273
1367
  update: {
1274
1368
  id: item.id !== undefined ? {
@@ -1313,6 +1407,9 @@ exports.Position = {
1313
1407
  id: item.alpacaAccount.id !== undefined ? {
1314
1408
  equals: item.alpacaAccount.id
1315
1409
  } : undefined,
1410
+ userId: item.alpacaAccount.userId !== undefined ? {
1411
+ equals: item.alpacaAccount.userId
1412
+ } : undefined,
1316
1413
  },
1317
1414
  update: {
1318
1415
  id: item.alpacaAccount.id !== undefined ? {
@@ -1363,6 +1460,9 @@ exports.Position = {
1363
1460
  upsert: item.actions.map((item) => ({
1364
1461
  where: {
1365
1462
  id: item.id !== undefined ? item.id : undefined,
1463
+ tradeId: item.tradeId !== undefined ? {
1464
+ equals: item.tradeId
1465
+ } : undefined,
1366
1466
  },
1367
1467
  update: {
1368
1468
  id: item.id !== undefined ? {
@@ -1415,6 +1515,9 @@ exports.Position = {
1415
1515
  : { connectOrCreate: {
1416
1516
  where: {
1417
1517
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1518
+ userId: item.alpacaAccount.userId !== undefined ? {
1519
+ equals: item.alpacaAccount.userId
1520
+ } : undefined,
1418
1521
  },
1419
1522
  create: {
1420
1523
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1438,6 +1541,9 @@ exports.Position = {
1438
1541
  : { connectOrCreate: item.actions.map((item) => ({
1439
1542
  where: {
1440
1543
  id: item.id !== undefined ? item.id : undefined,
1544
+ tradeId: item.tradeId !== undefined ? {
1545
+ equals: item.tradeId
1546
+ } : undefined,
1441
1547
  },
1442
1548
  create: {
1443
1549
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -1455,6 +1561,15 @@ exports.Position = {
1455
1561
  upsert: props.asset.orders.map((item) => ({
1456
1562
  where: {
1457
1563
  id: item.id !== undefined ? item.id : undefined,
1564
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1565
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
1566
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
1567
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
1568
+ equals: item.alpacaAccountId
1569
+ } : undefined,
1570
+ assetId: item.assetId !== undefined ? {
1571
+ equals: item.assetId
1572
+ } : undefined,
1458
1573
  },
1459
1574
  update: {
1460
1575
  id: item.id !== undefined ? {
@@ -1532,6 +1647,9 @@ exports.Position = {
1532
1647
  id: item.stopLoss.id !== undefined ? {
1533
1648
  equals: item.stopLoss.id
1534
1649
  } : undefined,
1650
+ orderId: item.stopLoss.orderId !== undefined ? {
1651
+ equals: item.stopLoss.orderId
1652
+ } : undefined,
1535
1653
  },
1536
1654
  update: {
1537
1655
  id: item.stopLoss.id !== undefined ? {
@@ -1556,6 +1674,9 @@ exports.Position = {
1556
1674
  id: item.takeProfit.id !== undefined ? {
1557
1675
  equals: item.takeProfit.id
1558
1676
  } : undefined,
1677
+ orderId: item.takeProfit.orderId !== undefined ? {
1678
+ equals: item.takeProfit.orderId
1679
+ } : undefined,
1559
1680
  },
1560
1681
  update: {
1561
1682
  id: item.takeProfit.id !== undefined ? {
@@ -1580,6 +1701,9 @@ exports.Position = {
1580
1701
  id: item.alpacaAccount.id !== undefined ? {
1581
1702
  equals: item.alpacaAccount.id
1582
1703
  } : undefined,
1704
+ userId: item.alpacaAccount.userId !== undefined ? {
1705
+ equals: item.alpacaAccount.userId
1706
+ } : undefined,
1583
1707
  },
1584
1708
  update: {
1585
1709
  id: item.alpacaAccount.id !== undefined ? {
@@ -1632,6 +1756,9 @@ exports.Position = {
1632
1756
  id: item.action.id !== undefined ? {
1633
1757
  equals: item.action.id
1634
1758
  } : undefined,
1759
+ tradeId: item.action.tradeId !== undefined ? {
1760
+ equals: item.action.tradeId
1761
+ } : undefined,
1635
1762
  },
1636
1763
  update: {
1637
1764
  id: item.action.id !== undefined ? {
@@ -1695,6 +1822,7 @@ exports.Position = {
1695
1822
  : { connectOrCreate: {
1696
1823
  where: {
1697
1824
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
1825
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
1698
1826
  },
1699
1827
  create: {
1700
1828
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -1711,6 +1839,7 @@ exports.Position = {
1711
1839
  : { connectOrCreate: {
1712
1840
  where: {
1713
1841
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
1842
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
1714
1843
  },
1715
1844
  create: {
1716
1845
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -1727,6 +1856,9 @@ exports.Position = {
1727
1856
  : { connectOrCreate: {
1728
1857
  where: {
1729
1858
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1859
+ userId: item.alpacaAccount.userId !== undefined ? {
1860
+ equals: item.alpacaAccount.userId
1861
+ } : undefined,
1730
1862
  },
1731
1863
  create: {
1732
1864
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -1750,6 +1882,9 @@ exports.Position = {
1750
1882
  : { connectOrCreate: {
1751
1883
  where: {
1752
1884
  id: item.action.id !== undefined ? item.action.id : undefined,
1885
+ tradeId: item.action.tradeId !== undefined ? {
1886
+ equals: item.action.tradeId
1887
+ } : undefined,
1753
1888
  },
1754
1889
  create: {
1755
1890
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -1768,6 +1903,12 @@ exports.Position = {
1768
1903
  where: {
1769
1904
  id: item.id !== undefined ? item.id : undefined,
1770
1905
  url: item.url !== undefined ? item.url : undefined,
1906
+ assetId: item.assetId !== undefined ? {
1907
+ equals: item.assetId
1908
+ } : undefined,
1909
+ newsArticleId: item.newsArticleId !== undefined ? {
1910
+ equals: item.newsArticleId
1911
+ } : undefined,
1771
1912
  },
1772
1913
  update: {
1773
1914
  id: item.id !== undefined ? {
@@ -1965,6 +2106,12 @@ exports.Position = {
1965
2106
  : { connectOrCreate: props.asset.trades.map((item) => ({
1966
2107
  where: {
1967
2108
  id: item.id !== undefined ? item.id : undefined,
2109
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2110
+ equals: item.alpacaAccountId
2111
+ } : undefined,
2112
+ assetId: item.assetId !== undefined ? {
2113
+ equals: item.assetId
2114
+ } : undefined,
1968
2115
  },
1969
2116
  create: {
1970
2117
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1987,6 +2134,9 @@ exports.Position = {
1987
2134
  : { connectOrCreate: {
1988
2135
  where: {
1989
2136
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2137
+ userId: item.alpacaAccount.userId !== undefined ? {
2138
+ equals: item.alpacaAccount.userId
2139
+ } : undefined,
1990
2140
  },
1991
2141
  create: {
1992
2142
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2010,6 +2160,9 @@ exports.Position = {
2010
2160
  : { connectOrCreate: item.actions.map((item) => ({
2011
2161
  where: {
2012
2162
  id: item.id !== undefined ? item.id : undefined,
2163
+ tradeId: item.tradeId !== undefined ? {
2164
+ equals: item.tradeId
2165
+ } : undefined,
2013
2166
  },
2014
2167
  create: {
2015
2168
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2032,6 +2185,15 @@ exports.Position = {
2032
2185
  : { connectOrCreate: props.asset.orders.map((item) => ({
2033
2186
  where: {
2034
2187
  id: item.id !== undefined ? item.id : undefined,
2188
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
2189
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
2190
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
2191
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2192
+ equals: item.alpacaAccountId
2193
+ } : undefined,
2194
+ assetId: item.assetId !== undefined ? {
2195
+ equals: item.assetId
2196
+ } : undefined,
2035
2197
  },
2036
2198
  create: {
2037
2199
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -2065,6 +2227,7 @@ exports.Position = {
2065
2227
  : { connectOrCreate: {
2066
2228
  where: {
2067
2229
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
2230
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
2068
2231
  },
2069
2232
  create: {
2070
2233
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -2081,6 +2244,7 @@ exports.Position = {
2081
2244
  : { connectOrCreate: {
2082
2245
  where: {
2083
2246
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
2247
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
2084
2248
  },
2085
2249
  create: {
2086
2250
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -2097,6 +2261,9 @@ exports.Position = {
2097
2261
  : { connectOrCreate: {
2098
2262
  where: {
2099
2263
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2264
+ userId: item.alpacaAccount.userId !== undefined ? {
2265
+ equals: item.alpacaAccount.userId
2266
+ } : undefined,
2100
2267
  },
2101
2268
  create: {
2102
2269
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -2120,6 +2287,9 @@ exports.Position = {
2120
2287
  : { connectOrCreate: {
2121
2288
  where: {
2122
2289
  id: item.action.id !== undefined ? item.action.id : undefined,
2290
+ tradeId: item.action.tradeId !== undefined ? {
2291
+ equals: item.action.tradeId
2292
+ } : undefined,
2123
2293
  },
2124
2294
  create: {
2125
2295
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -2143,6 +2313,12 @@ exports.Position = {
2143
2313
  where: {
2144
2314
  id: item.id !== undefined ? item.id : undefined,
2145
2315
  url: item.url !== undefined ? item.url : undefined,
2316
+ assetId: item.assetId !== undefined ? {
2317
+ equals: item.assetId
2318
+ } : undefined,
2319
+ newsArticleId: item.newsArticleId !== undefined ? {
2320
+ equals: item.newsArticleId
2321
+ } : undefined,
2146
2322
  },
2147
2323
  create: {
2148
2324
  url: item.url !== undefined ? item.url : undefined,
@@ -2192,6 +2368,9 @@ exports.Position = {
2192
2368
  id: props.alpacaAccount.id !== undefined ? {
2193
2369
  equals: props.alpacaAccount.id
2194
2370
  } : undefined,
2371
+ userId: props.alpacaAccount.userId !== undefined ? {
2372
+ equals: props.alpacaAccount.userId
2373
+ } : undefined,
2195
2374
  },
2196
2375
  update: {
2197
2376
  id: props.alpacaAccount.id !== undefined ? {
@@ -2280,9 +2459,21 @@ exports.Position = {
2280
2459
  id: props.alpacaAccount.user.customer.id !== undefined ? {
2281
2460
  equals: props.alpacaAccount.user.customer.id
2282
2461
  } : undefined,
2462
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2463
+ equals: props.alpacaAccount.user.customer.authUserId
2464
+ } : undefined,
2283
2465
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2284
2466
  equals: props.alpacaAccount.user.customer.name
2285
2467
  } : undefined,
2468
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
2469
+ equals: props.alpacaAccount.user.customer.stripeCustomerId
2470
+ } : undefined,
2471
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
2472
+ equals: props.alpacaAccount.user.customer.stripeSubscriptionId
2473
+ } : undefined,
2474
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2475
+ equals: props.alpacaAccount.user.customer.stripePriceId
2476
+ } : undefined,
2286
2477
  },
2287
2478
  update: {
2288
2479
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -2322,6 +2513,12 @@ exports.Position = {
2322
2513
  upsert: props.alpacaAccount.user.accounts.map((item) => ({
2323
2514
  where: {
2324
2515
  id: item.id !== undefined ? item.id : undefined,
2516
+ userId: item.userId !== undefined ? {
2517
+ equals: item.userId
2518
+ } : undefined,
2519
+ providerAccountId: item.providerAccountId !== undefined ? {
2520
+ equals: item.providerAccountId
2521
+ } : undefined,
2325
2522
  },
2326
2523
  update: {
2327
2524
  id: item.id !== undefined ? {
@@ -2376,6 +2573,9 @@ exports.Position = {
2376
2573
  upsert: props.alpacaAccount.user.sessions.map((item) => ({
2377
2574
  where: {
2378
2575
  id: item.id !== undefined ? item.id : undefined,
2576
+ userId: item.userId !== undefined ? {
2577
+ equals: item.userId
2578
+ } : undefined,
2379
2579
  },
2380
2580
  update: {
2381
2581
  id: item.id !== undefined ? {
@@ -2398,6 +2598,9 @@ exports.Position = {
2398
2598
  upsert: props.alpacaAccount.user.authenticators.map((item) => ({
2399
2599
  where: {
2400
2600
  id: item.id !== undefined ? item.id : undefined,
2601
+ userId: item.userId !== undefined ? {
2602
+ equals: item.userId
2603
+ } : undefined,
2401
2604
  },
2402
2605
  update: {
2403
2606
  id: item.id !== undefined ? {
@@ -2442,9 +2645,17 @@ exports.Position = {
2442
2645
  : { connectOrCreate: {
2443
2646
  where: {
2444
2647
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
2648
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
2649
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
2650
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
2651
+ equals: props.alpacaAccount.user.customer.authUserId
2652
+ } : undefined,
2445
2653
  name: props.alpacaAccount.user.customer.name !== undefined ? {
2446
2654
  equals: props.alpacaAccount.user.customer.name
2447
2655
  } : undefined,
2656
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
2657
+ equals: props.alpacaAccount.user.customer.stripePriceId
2658
+ } : undefined,
2448
2659
  },
2449
2660
  create: {
2450
2661
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -2466,6 +2677,12 @@ exports.Position = {
2466
2677
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
2467
2678
  where: {
2468
2679
  id: item.id !== undefined ? item.id : undefined,
2680
+ userId: item.userId !== undefined ? {
2681
+ equals: item.userId
2682
+ } : undefined,
2683
+ providerAccountId: item.providerAccountId !== undefined ? {
2684
+ equals: item.providerAccountId
2685
+ } : undefined,
2469
2686
  },
2470
2687
  create: {
2471
2688
  type: item.type !== undefined ? item.type : undefined,
@@ -2490,6 +2707,9 @@ exports.Position = {
2490
2707
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
2491
2708
  where: {
2492
2709
  id: item.id !== undefined ? item.id : undefined,
2710
+ userId: item.userId !== undefined ? {
2711
+ equals: item.userId
2712
+ } : undefined,
2493
2713
  },
2494
2714
  create: {
2495
2715
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -2506,6 +2726,9 @@ exports.Position = {
2506
2726
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
2507
2727
  where: {
2508
2728
  id: item.id !== undefined ? item.id : undefined,
2729
+ userId: item.userId !== undefined ? {
2730
+ equals: item.userId
2731
+ } : undefined,
2509
2732
  },
2510
2733
  create: {
2511
2734
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -2521,6 +2744,12 @@ exports.Position = {
2521
2744
  upsert: props.alpacaAccount.trades.map((item) => ({
2522
2745
  where: {
2523
2746
  id: item.id !== undefined ? item.id : undefined,
2747
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
2748
+ equals: item.alpacaAccountId
2749
+ } : undefined,
2750
+ assetId: item.assetId !== undefined ? {
2751
+ equals: item.assetId
2752
+ } : undefined,
2524
2753
  },
2525
2754
  update: {
2526
2755
  id: item.id !== undefined ? {
@@ -2805,6 +3034,9 @@ exports.Position = {
2805
3034
  upsert: item.actions.map((item) => ({
2806
3035
  where: {
2807
3036
  id: item.id !== undefined ? item.id : undefined,
3037
+ tradeId: item.tradeId !== undefined ? {
3038
+ equals: item.tradeId
3039
+ } : undefined,
2808
3040
  },
2809
3041
  update: {
2810
3042
  id: item.id !== undefined ? {
@@ -2928,6 +3160,9 @@ exports.Position = {
2928
3160
  : { connectOrCreate: item.actions.map((item) => ({
2929
3161
  where: {
2930
3162
  id: item.id !== undefined ? item.id : undefined,
3163
+ tradeId: item.tradeId !== undefined ? {
3164
+ equals: item.tradeId
3165
+ } : undefined,
2931
3166
  },
2932
3167
  create: {
2933
3168
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -2945,6 +3180,15 @@ exports.Position = {
2945
3180
  upsert: props.alpacaAccount.orders.map((item) => ({
2946
3181
  where: {
2947
3182
  id: item.id !== undefined ? item.id : undefined,
3183
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
3184
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
3185
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
3186
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3187
+ equals: item.alpacaAccountId
3188
+ } : undefined,
3189
+ assetId: item.assetId !== undefined ? {
3190
+ equals: item.assetId
3191
+ } : undefined,
2948
3192
  },
2949
3193
  update: {
2950
3194
  id: item.id !== undefined ? {
@@ -3022,6 +3266,9 @@ exports.Position = {
3022
3266
  id: item.stopLoss.id !== undefined ? {
3023
3267
  equals: item.stopLoss.id
3024
3268
  } : undefined,
3269
+ orderId: item.stopLoss.orderId !== undefined ? {
3270
+ equals: item.stopLoss.orderId
3271
+ } : undefined,
3025
3272
  },
3026
3273
  update: {
3027
3274
  id: item.stopLoss.id !== undefined ? {
@@ -3046,6 +3293,9 @@ exports.Position = {
3046
3293
  id: item.takeProfit.id !== undefined ? {
3047
3294
  equals: item.takeProfit.id
3048
3295
  } : undefined,
3296
+ orderId: item.takeProfit.orderId !== undefined ? {
3297
+ equals: item.takeProfit.orderId
3298
+ } : undefined,
3049
3299
  },
3050
3300
  update: {
3051
3301
  id: item.takeProfit.id !== undefined ? {
@@ -3070,6 +3320,9 @@ exports.Position = {
3070
3320
  id: item.action.id !== undefined ? {
3071
3321
  equals: item.action.id
3072
3322
  } : undefined,
3323
+ tradeId: item.action.tradeId !== undefined ? {
3324
+ equals: item.action.tradeId
3325
+ } : undefined,
3073
3326
  },
3074
3327
  update: {
3075
3328
  id: item.action.id !== undefined ? {
@@ -3375,6 +3628,7 @@ exports.Position = {
3375
3628
  : { connectOrCreate: {
3376
3629
  where: {
3377
3630
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
3631
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3378
3632
  },
3379
3633
  create: {
3380
3634
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3391,6 +3645,7 @@ exports.Position = {
3391
3645
  : { connectOrCreate: {
3392
3646
  where: {
3393
3647
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
3648
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3394
3649
  },
3395
3650
  create: {
3396
3651
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3407,6 +3662,9 @@ exports.Position = {
3407
3662
  : { connectOrCreate: {
3408
3663
  where: {
3409
3664
  id: item.action.id !== undefined ? item.action.id : undefined,
3665
+ tradeId: item.action.tradeId !== undefined ? {
3666
+ equals: item.action.tradeId
3667
+ } : undefined,
3410
3668
  },
3411
3669
  create: {
3412
3670
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3495,6 +3753,9 @@ exports.Position = {
3495
3753
  upsert: props.alpacaAccount.alerts.map((item) => ({
3496
3754
  where: {
3497
3755
  id: item.id !== undefined ? item.id : undefined,
3756
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3757
+ equals: item.alpacaAccountId
3758
+ } : undefined,
3498
3759
  },
3499
3760
  update: {
3500
3761
  id: item.id !== undefined ? {
@@ -3563,9 +3824,17 @@ exports.Position = {
3563
3824
  : { connectOrCreate: {
3564
3825
  where: {
3565
3826
  id: props.alpacaAccount.user.customer.id !== undefined ? props.alpacaAccount.user.customer.id : undefined,
3827
+ stripeCustomerId: props.alpacaAccount.user.customer.stripeCustomerId !== undefined ? props.alpacaAccount.user.customer.stripeCustomerId : undefined,
3828
+ stripeSubscriptionId: props.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? props.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
3829
+ authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? {
3830
+ equals: props.alpacaAccount.user.customer.authUserId
3831
+ } : undefined,
3566
3832
  name: props.alpacaAccount.user.customer.name !== undefined ? {
3567
3833
  equals: props.alpacaAccount.user.customer.name
3568
3834
  } : undefined,
3835
+ stripePriceId: props.alpacaAccount.user.customer.stripePriceId !== undefined ? {
3836
+ equals: props.alpacaAccount.user.customer.stripePriceId
3837
+ } : undefined,
3569
3838
  },
3570
3839
  create: {
3571
3840
  authUserId: props.alpacaAccount.user.customer.authUserId !== undefined ? props.alpacaAccount.user.customer.authUserId : undefined,
@@ -3587,6 +3856,12 @@ exports.Position = {
3587
3856
  : { connectOrCreate: props.alpacaAccount.user.accounts.map((item) => ({
3588
3857
  where: {
3589
3858
  id: item.id !== undefined ? item.id : undefined,
3859
+ userId: item.userId !== undefined ? {
3860
+ equals: item.userId
3861
+ } : undefined,
3862
+ providerAccountId: item.providerAccountId !== undefined ? {
3863
+ equals: item.providerAccountId
3864
+ } : undefined,
3590
3865
  },
3591
3866
  create: {
3592
3867
  type: item.type !== undefined ? item.type : undefined,
@@ -3611,6 +3886,9 @@ exports.Position = {
3611
3886
  : { connectOrCreate: props.alpacaAccount.user.sessions.map((item) => ({
3612
3887
  where: {
3613
3888
  id: item.id !== undefined ? item.id : undefined,
3889
+ userId: item.userId !== undefined ? {
3890
+ equals: item.userId
3891
+ } : undefined,
3614
3892
  },
3615
3893
  create: {
3616
3894
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -3627,6 +3905,9 @@ exports.Position = {
3627
3905
  : { connectOrCreate: props.alpacaAccount.user.authenticators.map((item) => ({
3628
3906
  where: {
3629
3907
  id: item.id !== undefined ? item.id : undefined,
3908
+ userId: item.userId !== undefined ? {
3909
+ equals: item.userId
3910
+ } : undefined,
3630
3911
  },
3631
3912
  create: {
3632
3913
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -3647,6 +3928,12 @@ exports.Position = {
3647
3928
  : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
3648
3929
  where: {
3649
3930
  id: item.id !== undefined ? item.id : undefined,
3931
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
3932
+ equals: item.alpacaAccountId
3933
+ } : undefined,
3934
+ assetId: item.assetId !== undefined ? {
3935
+ equals: item.assetId
3936
+ } : undefined,
3650
3937
  },
3651
3938
  create: {
3652
3939
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -3740,6 +4027,9 @@ exports.Position = {
3740
4027
  : { connectOrCreate: item.actions.map((item) => ({
3741
4028
  where: {
3742
4029
  id: item.id !== undefined ? item.id : undefined,
4030
+ tradeId: item.tradeId !== undefined ? {
4031
+ equals: item.tradeId
4032
+ } : undefined,
3743
4033
  },
3744
4034
  create: {
3745
4035
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -3762,6 +4052,15 @@ exports.Position = {
3762
4052
  : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
3763
4053
  where: {
3764
4054
  id: item.id !== undefined ? item.id : undefined,
4055
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4056
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4057
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4058
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4059
+ equals: item.alpacaAccountId
4060
+ } : undefined,
4061
+ assetId: item.assetId !== undefined ? {
4062
+ equals: item.assetId
4063
+ } : undefined,
3765
4064
  },
3766
4065
  create: {
3767
4066
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -3795,6 +4094,7 @@ exports.Position = {
3795
4094
  : { connectOrCreate: {
3796
4095
  where: {
3797
4096
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
4097
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
3798
4098
  },
3799
4099
  create: {
3800
4100
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -3811,6 +4111,7 @@ exports.Position = {
3811
4111
  : { connectOrCreate: {
3812
4112
  where: {
3813
4113
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
4114
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
3814
4115
  },
3815
4116
  create: {
3816
4117
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -3827,6 +4128,9 @@ exports.Position = {
3827
4128
  : { connectOrCreate: {
3828
4129
  where: {
3829
4130
  id: item.action.id !== undefined ? item.action.id : undefined,
4131
+ tradeId: item.action.tradeId !== undefined ? {
4132
+ equals: item.action.tradeId
4133
+ } : undefined,
3830
4134
  },
3831
4135
  create: {
3832
4136
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -3920,6 +4224,9 @@ exports.Position = {
3920
4224
  : { connectOrCreate: props.alpacaAccount.alerts.map((item) => ({
3921
4225
  where: {
3922
4226
  id: item.id !== undefined ? item.id : undefined,
4227
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4228
+ equals: item.alpacaAccountId
4229
+ } : undefined,
3923
4230
  },
3924
4231
  create: {
3925
4232
  message: item.message !== undefined ? item.message : undefined,
@@ -3966,7 +4273,9 @@ exports.Position = {
3966
4273
  const variables = props.map(prop => ({
3967
4274
  where: {
3968
4275
  id: prop.id !== undefined ? prop.id : undefined,
3969
- assetId: prop.assetId !== undefined ? prop.assetId : undefined,
4276
+ assetId: prop.assetId !== undefined ? {
4277
+ equals: prop.assetId
4278
+ } : undefined,
3970
4279
  averageEntryPrice: prop.averageEntryPrice !== undefined ? prop.averageEntryPrice : undefined,
3971
4280
  qty: prop.qty !== undefined ? prop.qty : undefined,
3972
4281
  qtyAvailable: prop.qtyAvailable !== undefined ? prop.qtyAvailable : undefined,
@@ -3979,7 +4288,9 @@ exports.Position = {
3979
4288
  currentPrice: prop.currentPrice !== undefined ? prop.currentPrice : undefined,
3980
4289
  lastTradePrice: prop.lastTradePrice !== undefined ? prop.lastTradePrice : undefined,
3981
4290
  changeToday: prop.changeToday !== undefined ? prop.changeToday : undefined,
3982
- alpacaAccountId: prop.alpacaAccountId !== undefined ? prop.alpacaAccountId : undefined,
4291
+ alpacaAccountId: prop.alpacaAccountId !== undefined ? {
4292
+ equals: prop.alpacaAccountId
4293
+ } : undefined,
3983
4294
  },
3984
4295
  data: {
3985
4296
  id: prop.id !== undefined ? {
@@ -4210,6 +4521,12 @@ exports.Position = {
4210
4521
  upsert: prop.asset.trades.map((item) => ({
4211
4522
  where: {
4212
4523
  id: item.id !== undefined ? item.id : undefined,
4524
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4525
+ equals: item.alpacaAccountId
4526
+ } : undefined,
4527
+ assetId: item.assetId !== undefined ? {
4528
+ equals: item.assetId
4529
+ } : undefined,
4213
4530
  },
4214
4531
  update: {
4215
4532
  id: item.id !== undefined ? {
@@ -4254,6 +4571,9 @@ exports.Position = {
4254
4571
  id: item.alpacaAccount.id !== undefined ? {
4255
4572
  equals: item.alpacaAccount.id
4256
4573
  } : undefined,
4574
+ userId: item.alpacaAccount.userId !== undefined ? {
4575
+ equals: item.alpacaAccount.userId
4576
+ } : undefined,
4257
4577
  },
4258
4578
  update: {
4259
4579
  id: item.alpacaAccount.id !== undefined ? {
@@ -4304,6 +4624,9 @@ exports.Position = {
4304
4624
  upsert: item.actions.map((item) => ({
4305
4625
  where: {
4306
4626
  id: item.id !== undefined ? item.id : undefined,
4627
+ tradeId: item.tradeId !== undefined ? {
4628
+ equals: item.tradeId
4629
+ } : undefined,
4307
4630
  },
4308
4631
  update: {
4309
4632
  id: item.id !== undefined ? {
@@ -4356,6 +4679,9 @@ exports.Position = {
4356
4679
  : { connectOrCreate: {
4357
4680
  where: {
4358
4681
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
4682
+ userId: item.alpacaAccount.userId !== undefined ? {
4683
+ equals: item.alpacaAccount.userId
4684
+ } : undefined,
4359
4685
  },
4360
4686
  create: {
4361
4687
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4379,6 +4705,9 @@ exports.Position = {
4379
4705
  : { connectOrCreate: item.actions.map((item) => ({
4380
4706
  where: {
4381
4707
  id: item.id !== undefined ? item.id : undefined,
4708
+ tradeId: item.tradeId !== undefined ? {
4709
+ equals: item.tradeId
4710
+ } : undefined,
4382
4711
  },
4383
4712
  create: {
4384
4713
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -4396,6 +4725,15 @@ exports.Position = {
4396
4725
  upsert: prop.asset.orders.map((item) => ({
4397
4726
  where: {
4398
4727
  id: item.id !== undefined ? item.id : undefined,
4728
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
4729
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
4730
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
4731
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
4732
+ equals: item.alpacaAccountId
4733
+ } : undefined,
4734
+ assetId: item.assetId !== undefined ? {
4735
+ equals: item.assetId
4736
+ } : undefined,
4399
4737
  },
4400
4738
  update: {
4401
4739
  id: item.id !== undefined ? {
@@ -4473,6 +4811,9 @@ exports.Position = {
4473
4811
  id: item.stopLoss.id !== undefined ? {
4474
4812
  equals: item.stopLoss.id
4475
4813
  } : undefined,
4814
+ orderId: item.stopLoss.orderId !== undefined ? {
4815
+ equals: item.stopLoss.orderId
4816
+ } : undefined,
4476
4817
  },
4477
4818
  update: {
4478
4819
  id: item.stopLoss.id !== undefined ? {
@@ -4497,6 +4838,9 @@ exports.Position = {
4497
4838
  id: item.takeProfit.id !== undefined ? {
4498
4839
  equals: item.takeProfit.id
4499
4840
  } : undefined,
4841
+ orderId: item.takeProfit.orderId !== undefined ? {
4842
+ equals: item.takeProfit.orderId
4843
+ } : undefined,
4500
4844
  },
4501
4845
  update: {
4502
4846
  id: item.takeProfit.id !== undefined ? {
@@ -4521,6 +4865,9 @@ exports.Position = {
4521
4865
  id: item.alpacaAccount.id !== undefined ? {
4522
4866
  equals: item.alpacaAccount.id
4523
4867
  } : undefined,
4868
+ userId: item.alpacaAccount.userId !== undefined ? {
4869
+ equals: item.alpacaAccount.userId
4870
+ } : undefined,
4524
4871
  },
4525
4872
  update: {
4526
4873
  id: item.alpacaAccount.id !== undefined ? {
@@ -4573,6 +4920,9 @@ exports.Position = {
4573
4920
  id: item.action.id !== undefined ? {
4574
4921
  equals: item.action.id
4575
4922
  } : undefined,
4923
+ tradeId: item.action.tradeId !== undefined ? {
4924
+ equals: item.action.tradeId
4925
+ } : undefined,
4576
4926
  },
4577
4927
  update: {
4578
4928
  id: item.action.id !== undefined ? {
@@ -4636,6 +4986,7 @@ exports.Position = {
4636
4986
  : { connectOrCreate: {
4637
4987
  where: {
4638
4988
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
4989
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
4639
4990
  },
4640
4991
  create: {
4641
4992
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -4652,6 +5003,7 @@ exports.Position = {
4652
5003
  : { connectOrCreate: {
4653
5004
  where: {
4654
5005
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
5006
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
4655
5007
  },
4656
5008
  create: {
4657
5009
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -4668,6 +5020,9 @@ exports.Position = {
4668
5020
  : { connectOrCreate: {
4669
5021
  where: {
4670
5022
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5023
+ userId: item.alpacaAccount.userId !== undefined ? {
5024
+ equals: item.alpacaAccount.userId
5025
+ } : undefined,
4671
5026
  },
4672
5027
  create: {
4673
5028
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4691,6 +5046,9 @@ exports.Position = {
4691
5046
  : { connectOrCreate: {
4692
5047
  where: {
4693
5048
  id: item.action.id !== undefined ? item.action.id : undefined,
5049
+ tradeId: item.action.tradeId !== undefined ? {
5050
+ equals: item.action.tradeId
5051
+ } : undefined,
4694
5052
  },
4695
5053
  create: {
4696
5054
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -4709,6 +5067,12 @@ exports.Position = {
4709
5067
  where: {
4710
5068
  id: item.id !== undefined ? item.id : undefined,
4711
5069
  url: item.url !== undefined ? item.url : undefined,
5070
+ assetId: item.assetId !== undefined ? {
5071
+ equals: item.assetId
5072
+ } : undefined,
5073
+ newsArticleId: item.newsArticleId !== undefined ? {
5074
+ equals: item.newsArticleId
5075
+ } : undefined,
4712
5076
  },
4713
5077
  update: {
4714
5078
  id: item.id !== undefined ? {
@@ -4906,6 +5270,12 @@ exports.Position = {
4906
5270
  : { connectOrCreate: prop.asset.trades.map((item) => ({
4907
5271
  where: {
4908
5272
  id: item.id !== undefined ? item.id : undefined,
5273
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5274
+ equals: item.alpacaAccountId
5275
+ } : undefined,
5276
+ assetId: item.assetId !== undefined ? {
5277
+ equals: item.assetId
5278
+ } : undefined,
4909
5279
  },
4910
5280
  create: {
4911
5281
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -4928,6 +5298,9 @@ exports.Position = {
4928
5298
  : { connectOrCreate: {
4929
5299
  where: {
4930
5300
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5301
+ userId: item.alpacaAccount.userId !== undefined ? {
5302
+ equals: item.alpacaAccount.userId
5303
+ } : undefined,
4931
5304
  },
4932
5305
  create: {
4933
5306
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -4951,6 +5324,9 @@ exports.Position = {
4951
5324
  : { connectOrCreate: item.actions.map((item) => ({
4952
5325
  where: {
4953
5326
  id: item.id !== undefined ? item.id : undefined,
5327
+ tradeId: item.tradeId !== undefined ? {
5328
+ equals: item.tradeId
5329
+ } : undefined,
4954
5330
  },
4955
5331
  create: {
4956
5332
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -4973,6 +5349,15 @@ exports.Position = {
4973
5349
  : { connectOrCreate: prop.asset.orders.map((item) => ({
4974
5350
  where: {
4975
5351
  id: item.id !== undefined ? item.id : undefined,
5352
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
5353
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
5354
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
5355
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5356
+ equals: item.alpacaAccountId
5357
+ } : undefined,
5358
+ assetId: item.assetId !== undefined ? {
5359
+ equals: item.assetId
5360
+ } : undefined,
4976
5361
  },
4977
5362
  create: {
4978
5363
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -5006,6 +5391,7 @@ exports.Position = {
5006
5391
  : { connectOrCreate: {
5007
5392
  where: {
5008
5393
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
5394
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
5009
5395
  },
5010
5396
  create: {
5011
5397
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -5022,6 +5408,7 @@ exports.Position = {
5022
5408
  : { connectOrCreate: {
5023
5409
  where: {
5024
5410
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
5411
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
5025
5412
  },
5026
5413
  create: {
5027
5414
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -5038,6 +5425,9 @@ exports.Position = {
5038
5425
  : { connectOrCreate: {
5039
5426
  where: {
5040
5427
  id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
5428
+ userId: item.alpacaAccount.userId !== undefined ? {
5429
+ equals: item.alpacaAccount.userId
5430
+ } : undefined,
5041
5431
  },
5042
5432
  create: {
5043
5433
  type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
@@ -5061,6 +5451,9 @@ exports.Position = {
5061
5451
  : { connectOrCreate: {
5062
5452
  where: {
5063
5453
  id: item.action.id !== undefined ? item.action.id : undefined,
5454
+ tradeId: item.action.tradeId !== undefined ? {
5455
+ equals: item.action.tradeId
5456
+ } : undefined,
5064
5457
  },
5065
5458
  create: {
5066
5459
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -5084,6 +5477,12 @@ exports.Position = {
5084
5477
  where: {
5085
5478
  id: item.id !== undefined ? item.id : undefined,
5086
5479
  url: item.url !== undefined ? item.url : undefined,
5480
+ assetId: item.assetId !== undefined ? {
5481
+ equals: item.assetId
5482
+ } : undefined,
5483
+ newsArticleId: item.newsArticleId !== undefined ? {
5484
+ equals: item.newsArticleId
5485
+ } : undefined,
5087
5486
  },
5088
5487
  create: {
5089
5488
  url: item.url !== undefined ? item.url : undefined,
@@ -5133,6 +5532,9 @@ exports.Position = {
5133
5532
  id: prop.alpacaAccount.id !== undefined ? {
5134
5533
  equals: prop.alpacaAccount.id
5135
5534
  } : undefined,
5535
+ userId: prop.alpacaAccount.userId !== undefined ? {
5536
+ equals: prop.alpacaAccount.userId
5537
+ } : undefined,
5136
5538
  },
5137
5539
  update: {
5138
5540
  id: prop.alpacaAccount.id !== undefined ? {
@@ -5221,9 +5623,21 @@ exports.Position = {
5221
5623
  id: prop.alpacaAccount.user.customer.id !== undefined ? {
5222
5624
  equals: prop.alpacaAccount.user.customer.id
5223
5625
  } : undefined,
5626
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5627
+ equals: prop.alpacaAccount.user.customer.authUserId
5628
+ } : undefined,
5224
5629
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5225
5630
  equals: prop.alpacaAccount.user.customer.name
5226
5631
  } : undefined,
5632
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? {
5633
+ equals: prop.alpacaAccount.user.customer.stripeCustomerId
5634
+ } : undefined,
5635
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? {
5636
+ equals: prop.alpacaAccount.user.customer.stripeSubscriptionId
5637
+ } : undefined,
5638
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5639
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5640
+ } : undefined,
5227
5641
  },
5228
5642
  update: {
5229
5643
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
@@ -5263,6 +5677,12 @@ exports.Position = {
5263
5677
  upsert: prop.alpacaAccount.user.accounts.map((item) => ({
5264
5678
  where: {
5265
5679
  id: item.id !== undefined ? item.id : undefined,
5680
+ userId: item.userId !== undefined ? {
5681
+ equals: item.userId
5682
+ } : undefined,
5683
+ providerAccountId: item.providerAccountId !== undefined ? {
5684
+ equals: item.providerAccountId
5685
+ } : undefined,
5266
5686
  },
5267
5687
  update: {
5268
5688
  id: item.id !== undefined ? {
@@ -5317,6 +5737,9 @@ exports.Position = {
5317
5737
  upsert: prop.alpacaAccount.user.sessions.map((item) => ({
5318
5738
  where: {
5319
5739
  id: item.id !== undefined ? item.id : undefined,
5740
+ userId: item.userId !== undefined ? {
5741
+ equals: item.userId
5742
+ } : undefined,
5320
5743
  },
5321
5744
  update: {
5322
5745
  id: item.id !== undefined ? {
@@ -5339,6 +5762,9 @@ exports.Position = {
5339
5762
  upsert: prop.alpacaAccount.user.authenticators.map((item) => ({
5340
5763
  where: {
5341
5764
  id: item.id !== undefined ? item.id : undefined,
5765
+ userId: item.userId !== undefined ? {
5766
+ equals: item.userId
5767
+ } : undefined,
5342
5768
  },
5343
5769
  update: {
5344
5770
  id: item.id !== undefined ? {
@@ -5383,9 +5809,17 @@ exports.Position = {
5383
5809
  : { connectOrCreate: {
5384
5810
  where: {
5385
5811
  id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
5812
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
5813
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
5814
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
5815
+ equals: prop.alpacaAccount.user.customer.authUserId
5816
+ } : undefined,
5386
5817
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
5387
5818
  equals: prop.alpacaAccount.user.customer.name
5388
5819
  } : undefined,
5820
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
5821
+ equals: prop.alpacaAccount.user.customer.stripePriceId
5822
+ } : undefined,
5389
5823
  },
5390
5824
  create: {
5391
5825
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -5407,6 +5841,12 @@ exports.Position = {
5407
5841
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
5408
5842
  where: {
5409
5843
  id: item.id !== undefined ? item.id : undefined,
5844
+ userId: item.userId !== undefined ? {
5845
+ equals: item.userId
5846
+ } : undefined,
5847
+ providerAccountId: item.providerAccountId !== undefined ? {
5848
+ equals: item.providerAccountId
5849
+ } : undefined,
5410
5850
  },
5411
5851
  create: {
5412
5852
  type: item.type !== undefined ? item.type : undefined,
@@ -5431,6 +5871,9 @@ exports.Position = {
5431
5871
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
5432
5872
  where: {
5433
5873
  id: item.id !== undefined ? item.id : undefined,
5874
+ userId: item.userId !== undefined ? {
5875
+ equals: item.userId
5876
+ } : undefined,
5434
5877
  },
5435
5878
  create: {
5436
5879
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -5447,6 +5890,9 @@ exports.Position = {
5447
5890
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
5448
5891
  where: {
5449
5892
  id: item.id !== undefined ? item.id : undefined,
5893
+ userId: item.userId !== undefined ? {
5894
+ equals: item.userId
5895
+ } : undefined,
5450
5896
  },
5451
5897
  create: {
5452
5898
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -5462,6 +5908,12 @@ exports.Position = {
5462
5908
  upsert: prop.alpacaAccount.trades.map((item) => ({
5463
5909
  where: {
5464
5910
  id: item.id !== undefined ? item.id : undefined,
5911
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
5912
+ equals: item.alpacaAccountId
5913
+ } : undefined,
5914
+ assetId: item.assetId !== undefined ? {
5915
+ equals: item.assetId
5916
+ } : undefined,
5465
5917
  },
5466
5918
  update: {
5467
5919
  id: item.id !== undefined ? {
@@ -5746,6 +6198,9 @@ exports.Position = {
5746
6198
  upsert: item.actions.map((item) => ({
5747
6199
  where: {
5748
6200
  id: item.id !== undefined ? item.id : undefined,
6201
+ tradeId: item.tradeId !== undefined ? {
6202
+ equals: item.tradeId
6203
+ } : undefined,
5749
6204
  },
5750
6205
  update: {
5751
6206
  id: item.id !== undefined ? {
@@ -5869,6 +6324,9 @@ exports.Position = {
5869
6324
  : { connectOrCreate: item.actions.map((item) => ({
5870
6325
  where: {
5871
6326
  id: item.id !== undefined ? item.id : undefined,
6327
+ tradeId: item.tradeId !== undefined ? {
6328
+ equals: item.tradeId
6329
+ } : undefined,
5872
6330
  },
5873
6331
  create: {
5874
6332
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -5886,6 +6344,15 @@ exports.Position = {
5886
6344
  upsert: prop.alpacaAccount.orders.map((item) => ({
5887
6345
  where: {
5888
6346
  id: item.id !== undefined ? item.id : undefined,
6347
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
6348
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
6349
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
6350
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6351
+ equals: item.alpacaAccountId
6352
+ } : undefined,
6353
+ assetId: item.assetId !== undefined ? {
6354
+ equals: item.assetId
6355
+ } : undefined,
5889
6356
  },
5890
6357
  update: {
5891
6358
  id: item.id !== undefined ? {
@@ -5963,6 +6430,9 @@ exports.Position = {
5963
6430
  id: item.stopLoss.id !== undefined ? {
5964
6431
  equals: item.stopLoss.id
5965
6432
  } : undefined,
6433
+ orderId: item.stopLoss.orderId !== undefined ? {
6434
+ equals: item.stopLoss.orderId
6435
+ } : undefined,
5966
6436
  },
5967
6437
  update: {
5968
6438
  id: item.stopLoss.id !== undefined ? {
@@ -5987,6 +6457,9 @@ exports.Position = {
5987
6457
  id: item.takeProfit.id !== undefined ? {
5988
6458
  equals: item.takeProfit.id
5989
6459
  } : undefined,
6460
+ orderId: item.takeProfit.orderId !== undefined ? {
6461
+ equals: item.takeProfit.orderId
6462
+ } : undefined,
5990
6463
  },
5991
6464
  update: {
5992
6465
  id: item.takeProfit.id !== undefined ? {
@@ -6011,6 +6484,9 @@ exports.Position = {
6011
6484
  id: item.action.id !== undefined ? {
6012
6485
  equals: item.action.id
6013
6486
  } : undefined,
6487
+ tradeId: item.action.tradeId !== undefined ? {
6488
+ equals: item.action.tradeId
6489
+ } : undefined,
6014
6490
  },
6015
6491
  update: {
6016
6492
  id: item.action.id !== undefined ? {
@@ -6316,6 +6792,7 @@ exports.Position = {
6316
6792
  : { connectOrCreate: {
6317
6793
  where: {
6318
6794
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
6795
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6319
6796
  },
6320
6797
  create: {
6321
6798
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6332,6 +6809,7 @@ exports.Position = {
6332
6809
  : { connectOrCreate: {
6333
6810
  where: {
6334
6811
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
6812
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6335
6813
  },
6336
6814
  create: {
6337
6815
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6348,6 +6826,9 @@ exports.Position = {
6348
6826
  : { connectOrCreate: {
6349
6827
  where: {
6350
6828
  id: item.action.id !== undefined ? item.action.id : undefined,
6829
+ tradeId: item.action.tradeId !== undefined ? {
6830
+ equals: item.action.tradeId
6831
+ } : undefined,
6351
6832
  },
6352
6833
  create: {
6353
6834
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6436,6 +6917,9 @@ exports.Position = {
6436
6917
  upsert: prop.alpacaAccount.alerts.map((item) => ({
6437
6918
  where: {
6438
6919
  id: item.id !== undefined ? item.id : undefined,
6920
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
6921
+ equals: item.alpacaAccountId
6922
+ } : undefined,
6439
6923
  },
6440
6924
  update: {
6441
6925
  id: item.id !== undefined ? {
@@ -6504,9 +6988,17 @@ exports.Position = {
6504
6988
  : { connectOrCreate: {
6505
6989
  where: {
6506
6990
  id: prop.alpacaAccount.user.customer.id !== undefined ? prop.alpacaAccount.user.customer.id : undefined,
6991
+ stripeCustomerId: prop.alpacaAccount.user.customer.stripeCustomerId !== undefined ? prop.alpacaAccount.user.customer.stripeCustomerId : undefined,
6992
+ stripeSubscriptionId: prop.alpacaAccount.user.customer.stripeSubscriptionId !== undefined ? prop.alpacaAccount.user.customer.stripeSubscriptionId : undefined,
6993
+ authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? {
6994
+ equals: prop.alpacaAccount.user.customer.authUserId
6995
+ } : undefined,
6507
6996
  name: prop.alpacaAccount.user.customer.name !== undefined ? {
6508
6997
  equals: prop.alpacaAccount.user.customer.name
6509
6998
  } : undefined,
6999
+ stripePriceId: prop.alpacaAccount.user.customer.stripePriceId !== undefined ? {
7000
+ equals: prop.alpacaAccount.user.customer.stripePriceId
7001
+ } : undefined,
6510
7002
  },
6511
7003
  create: {
6512
7004
  authUserId: prop.alpacaAccount.user.customer.authUserId !== undefined ? prop.alpacaAccount.user.customer.authUserId : undefined,
@@ -6528,6 +7020,12 @@ exports.Position = {
6528
7020
  : { connectOrCreate: prop.alpacaAccount.user.accounts.map((item) => ({
6529
7021
  where: {
6530
7022
  id: item.id !== undefined ? item.id : undefined,
7023
+ userId: item.userId !== undefined ? {
7024
+ equals: item.userId
7025
+ } : undefined,
7026
+ providerAccountId: item.providerAccountId !== undefined ? {
7027
+ equals: item.providerAccountId
7028
+ } : undefined,
6531
7029
  },
6532
7030
  create: {
6533
7031
  type: item.type !== undefined ? item.type : undefined,
@@ -6552,6 +7050,9 @@ exports.Position = {
6552
7050
  : { connectOrCreate: prop.alpacaAccount.user.sessions.map((item) => ({
6553
7051
  where: {
6554
7052
  id: item.id !== undefined ? item.id : undefined,
7053
+ userId: item.userId !== undefined ? {
7054
+ equals: item.userId
7055
+ } : undefined,
6555
7056
  },
6556
7057
  create: {
6557
7058
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
@@ -6568,6 +7069,9 @@ exports.Position = {
6568
7069
  : { connectOrCreate: prop.alpacaAccount.user.authenticators.map((item) => ({
6569
7070
  where: {
6570
7071
  id: item.id !== undefined ? item.id : undefined,
7072
+ userId: item.userId !== undefined ? {
7073
+ equals: item.userId
7074
+ } : undefined,
6571
7075
  },
6572
7076
  create: {
6573
7077
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
@@ -6588,6 +7092,12 @@ exports.Position = {
6588
7092
  : { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
6589
7093
  where: {
6590
7094
  id: item.id !== undefined ? item.id : undefined,
7095
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7096
+ equals: item.alpacaAccountId
7097
+ } : undefined,
7098
+ assetId: item.assetId !== undefined ? {
7099
+ equals: item.assetId
7100
+ } : undefined,
6591
7101
  },
6592
7102
  create: {
6593
7103
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -6681,6 +7191,9 @@ exports.Position = {
6681
7191
  : { connectOrCreate: item.actions.map((item) => ({
6682
7192
  where: {
6683
7193
  id: item.id !== undefined ? item.id : undefined,
7194
+ tradeId: item.tradeId !== undefined ? {
7195
+ equals: item.tradeId
7196
+ } : undefined,
6684
7197
  },
6685
7198
  create: {
6686
7199
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -6703,6 +7216,15 @@ exports.Position = {
6703
7216
  : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
6704
7217
  where: {
6705
7218
  id: item.id !== undefined ? item.id : undefined,
7219
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
7220
+ actionId: item.actionId !== undefined ? item.actionId : undefined,
7221
+ stopLossId: item.stopLossId !== undefined ? item.stopLossId : undefined,
7222
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7223
+ equals: item.alpacaAccountId
7224
+ } : undefined,
7225
+ assetId: item.assetId !== undefined ? {
7226
+ equals: item.assetId
7227
+ } : undefined,
6706
7228
  },
6707
7229
  create: {
6708
7230
  clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
@@ -6736,6 +7258,7 @@ exports.Position = {
6736
7258
  : { connectOrCreate: {
6737
7259
  where: {
6738
7260
  id: item.stopLoss.id !== undefined ? item.stopLoss.id : undefined,
7261
+ orderId: item.stopLoss.orderId !== undefined ? item.stopLoss.orderId : undefined,
6739
7262
  },
6740
7263
  create: {
6741
7264
  stopPrice: item.stopLoss.stopPrice !== undefined ? item.stopLoss.stopPrice : undefined,
@@ -6752,6 +7275,7 @@ exports.Position = {
6752
7275
  : { connectOrCreate: {
6753
7276
  where: {
6754
7277
  id: item.takeProfit.id !== undefined ? item.takeProfit.id : undefined,
7278
+ orderId: item.takeProfit.orderId !== undefined ? item.takeProfit.orderId : undefined,
6755
7279
  },
6756
7280
  create: {
6757
7281
  limitPrice: item.takeProfit.limitPrice !== undefined ? item.takeProfit.limitPrice : undefined,
@@ -6768,6 +7292,9 @@ exports.Position = {
6768
7292
  : { connectOrCreate: {
6769
7293
  where: {
6770
7294
  id: item.action.id !== undefined ? item.action.id : undefined,
7295
+ tradeId: item.action.tradeId !== undefined ? {
7296
+ equals: item.action.tradeId
7297
+ } : undefined,
6771
7298
  },
6772
7299
  create: {
6773
7300
  sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
@@ -6861,6 +7388,9 @@ exports.Position = {
6861
7388
  : { connectOrCreate: prop.alpacaAccount.alerts.map((item) => ({
6862
7389
  where: {
6863
7390
  id: item.id !== undefined ? item.id : undefined,
7391
+ alpacaAccountId: item.alpacaAccountId !== undefined ? {
7392
+ equals: item.alpacaAccountId
7393
+ } : undefined,
6864
7394
  },
6865
7395
  create: {
6866
7396
  message: item.message !== undefined ? item.message : undefined,
@@ -6943,7 +7473,9 @@ exports.Position = {
6943
7473
  const variables = {
6944
7474
  where: {
6945
7475
  id: props.id !== undefined ? props.id : undefined,
6946
- assetId: props.assetId !== undefined ? props.assetId : undefined,
7476
+ assetId: props.assetId !== undefined ? {
7477
+ equals: props.assetId
7478
+ } : undefined,
6947
7479
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
6948
7480
  qty: props.qty !== undefined ? props.qty : undefined,
6949
7481
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -6956,7 +7488,9 @@ exports.Position = {
6956
7488
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
6957
7489
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
6958
7490
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
6959
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
7491
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
7492
+ equals: props.alpacaAccountId
7493
+ } : undefined,
6960
7494
  },
6961
7495
  };
6962
7496
  const filteredVariables = (0, utils_1.removeUndefinedProps)(variables);
@@ -7023,7 +7557,9 @@ exports.Position = {
7023
7557
  id: props.id !== undefined ? {
7024
7558
  equals: props.id
7025
7559
  } : undefined,
7026
- assetId: props.assetId !== undefined ? props.assetId : undefined,
7560
+ assetId: props.assetId !== undefined ? {
7561
+ equals: props.assetId
7562
+ } : undefined,
7027
7563
  averageEntryPrice: props.averageEntryPrice !== undefined ? props.averageEntryPrice : undefined,
7028
7564
  qty: props.qty !== undefined ? props.qty : undefined,
7029
7565
  qtyAvailable: props.qtyAvailable !== undefined ? props.qtyAvailable : undefined,
@@ -7036,7 +7572,9 @@ exports.Position = {
7036
7572
  currentPrice: props.currentPrice !== undefined ? props.currentPrice : undefined,
7037
7573
  lastTradePrice: props.lastTradePrice !== undefined ? props.lastTradePrice : undefined,
7038
7574
  changeToday: props.changeToday !== undefined ? props.changeToday : undefined,
7039
- alpacaAccountId: props.alpacaAccountId !== undefined ? props.alpacaAccountId : undefined,
7575
+ alpacaAccountId: props.alpacaAccountId !== undefined ? {
7576
+ equals: props.alpacaAccountId
7577
+ } : undefined,
7040
7578
  },
7041
7579
  };
7042
7580
  const filteredVariables = (0, utils_1.removeUndefinedProps)(variables);