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
@@ -354,6 +354,44 @@ export const NewsArticleAssetSentiment = {
354
354
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
355
355
  status: item.status !== undefined ? item.status : undefined,
356
356
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
357
+ alpacaAccount: item.alpacaAccount ?
358
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
359
+ ? { connect: {
360
+ id: item.alpacaAccount.id
361
+ }
362
+ }
363
+ : { connectOrCreate: {
364
+ where: {
365
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
366
+ },
367
+ create: {
368
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
369
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
370
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
371
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
372
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
373
+ },
374
+ }
375
+ } : undefined,
376
+ actions: item.actions ?
377
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
378
+ connect: item.actions.map((item) => ({
379
+ id: item.id
380
+ }))
381
+ }
382
+ : { connectOrCreate: item.actions.map((item) => ({
383
+ where: {
384
+ id: item.id !== undefined ? item.id : undefined,
385
+ },
386
+ create: {
387
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
388
+ type: item.type !== undefined ? item.type : undefined,
389
+ note: item.note !== undefined ? item.note : undefined,
390
+ status: item.status !== undefined ? item.status : undefined,
391
+ fee: item.fee !== undefined ? item.fee : undefined,
392
+ },
393
+ }))
394
+ } : undefined,
357
395
  },
358
396
  }))
359
397
  } : undefined,
@@ -384,6 +422,44 @@ export const NewsArticleAssetSentiment = {
384
422
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
385
423
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
386
424
  fee: item.fee !== undefined ? item.fee : undefined,
425
+ alpacaAccount: item.alpacaAccount ?
426
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
427
+ ? { connect: {
428
+ id: item.alpacaAccount.id
429
+ }
430
+ }
431
+ : { connectOrCreate: {
432
+ where: {
433
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
434
+ },
435
+ create: {
436
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
437
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
438
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
439
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
440
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
441
+ },
442
+ }
443
+ } : undefined,
444
+ action: item.action ?
445
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
446
+ ? { connect: {
447
+ id: item.action.id
448
+ }
449
+ }
450
+ : { connectOrCreate: {
451
+ where: {
452
+ id: item.action.id !== undefined ? item.action.id : undefined,
453
+ },
454
+ create: {
455
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
456
+ type: item.action.type !== undefined ? item.action.type : undefined,
457
+ note: item.action.note !== undefined ? item.action.note : undefined,
458
+ status: item.action.status !== undefined ? item.action.status : undefined,
459
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
460
+ },
461
+ }
462
+ } : undefined,
387
463
  },
388
464
  }))
389
465
  } : undefined,
@@ -411,6 +487,25 @@ export const NewsArticleAssetSentiment = {
411
487
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
412
488
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
413
489
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
490
+ alpacaAccount: item.alpacaAccount ?
491
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
492
+ ? { connect: {
493
+ id: item.alpacaAccount.id
494
+ }
495
+ }
496
+ : { connectOrCreate: {
497
+ where: {
498
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
499
+ },
500
+ create: {
501
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
502
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
503
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
504
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
505
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
506
+ },
507
+ }
508
+ } : undefined,
414
509
  },
415
510
  }))
416
511
  } : undefined,
@@ -1013,6 +1108,76 @@ export const NewsArticleAssetSentiment = {
1013
1108
  optionContractType: item.optionContractType !== undefined ? {
1014
1109
  set: item.optionContractType
1015
1110
  } : undefined,
1111
+ alpacaAccount: item.alpacaAccount ? {
1112
+ upsert: {
1113
+ where: {
1114
+ id: item.alpacaAccount.id !== undefined ? {
1115
+ equals: item.alpacaAccount.id
1116
+ } : undefined,
1117
+ },
1118
+ update: {
1119
+ id: item.alpacaAccount.id !== undefined ? {
1120
+ set: item.alpacaAccount.id
1121
+ } : undefined,
1122
+ type: item.alpacaAccount.type !== undefined ? {
1123
+ set: item.alpacaAccount.type
1124
+ } : undefined,
1125
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1126
+ set: item.alpacaAccount.APIKey
1127
+ } : undefined,
1128
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1129
+ set: item.alpacaAccount.APISecret
1130
+ } : undefined,
1131
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1132
+ set: item.alpacaAccount.configuration
1133
+ } : undefined,
1134
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1135
+ set: item.alpacaAccount.marketOpen
1136
+ } : undefined,
1137
+ },
1138
+ create: {
1139
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1140
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1141
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1142
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1143
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1144
+ },
1145
+ }
1146
+ } : undefined,
1147
+ actions: item.actions ? {
1148
+ upsert: item.actions.map((item) => ({
1149
+ where: {
1150
+ id: item.id !== undefined ? item.id : undefined,
1151
+ },
1152
+ update: {
1153
+ id: item.id !== undefined ? {
1154
+ set: item.id
1155
+ } : undefined,
1156
+ sequence: item.sequence !== undefined ? {
1157
+ set: item.sequence
1158
+ } : undefined,
1159
+ type: item.type !== undefined ? {
1160
+ set: item.type
1161
+ } : undefined,
1162
+ note: item.note !== undefined ? {
1163
+ set: item.note
1164
+ } : undefined,
1165
+ status: item.status !== undefined ? {
1166
+ set: item.status
1167
+ } : undefined,
1168
+ fee: item.fee !== undefined ? {
1169
+ set: item.fee
1170
+ } : undefined,
1171
+ },
1172
+ create: {
1173
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1174
+ type: item.type !== undefined ? item.type : undefined,
1175
+ note: item.note !== undefined ? item.note : undefined,
1176
+ status: item.status !== undefined ? item.status : undefined,
1177
+ fee: item.fee !== undefined ? item.fee : undefined,
1178
+ },
1179
+ }))
1180
+ } : undefined,
1016
1181
  },
1017
1182
  create: {
1018
1183
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1025,6 +1190,44 @@ export const NewsArticleAssetSentiment = {
1025
1190
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1026
1191
  status: item.status !== undefined ? item.status : undefined,
1027
1192
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1193
+ alpacaAccount: item.alpacaAccount ?
1194
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1195
+ ? { connect: {
1196
+ id: item.alpacaAccount.id
1197
+ }
1198
+ }
1199
+ : { connectOrCreate: {
1200
+ where: {
1201
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1202
+ },
1203
+ create: {
1204
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1205
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1206
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1207
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1208
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1209
+ },
1210
+ }
1211
+ } : undefined,
1212
+ actions: item.actions ?
1213
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1214
+ connect: item.actions.map((item) => ({
1215
+ id: item.id
1216
+ }))
1217
+ }
1218
+ : { connectOrCreate: item.actions.map((item) => ({
1219
+ where: {
1220
+ id: item.id !== undefined ? item.id : undefined,
1221
+ },
1222
+ create: {
1223
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1224
+ type: item.type !== undefined ? item.type : undefined,
1225
+ note: item.note !== undefined ? item.note : undefined,
1226
+ status: item.status !== undefined ? item.status : undefined,
1227
+ fee: item.fee !== undefined ? item.fee : undefined,
1228
+ },
1229
+ }))
1230
+ } : undefined,
1028
1231
  },
1029
1232
  }))
1030
1233
  } : undefined,
@@ -1085,6 +1288,78 @@ export const NewsArticleAssetSentiment = {
1085
1288
  fee: item.fee !== undefined ? {
1086
1289
  set: item.fee
1087
1290
  } : undefined,
1291
+ alpacaAccount: item.alpacaAccount ? {
1292
+ upsert: {
1293
+ where: {
1294
+ id: item.alpacaAccount.id !== undefined ? {
1295
+ equals: item.alpacaAccount.id
1296
+ } : undefined,
1297
+ },
1298
+ update: {
1299
+ id: item.alpacaAccount.id !== undefined ? {
1300
+ set: item.alpacaAccount.id
1301
+ } : undefined,
1302
+ type: item.alpacaAccount.type !== undefined ? {
1303
+ set: item.alpacaAccount.type
1304
+ } : undefined,
1305
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1306
+ set: item.alpacaAccount.APIKey
1307
+ } : undefined,
1308
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1309
+ set: item.alpacaAccount.APISecret
1310
+ } : undefined,
1311
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1312
+ set: item.alpacaAccount.configuration
1313
+ } : undefined,
1314
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1315
+ set: item.alpacaAccount.marketOpen
1316
+ } : undefined,
1317
+ },
1318
+ create: {
1319
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1320
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1321
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1322
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1323
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1324
+ },
1325
+ }
1326
+ } : undefined,
1327
+ action: item.action ? {
1328
+ upsert: {
1329
+ where: {
1330
+ id: item.action.id !== undefined ? {
1331
+ equals: item.action.id
1332
+ } : undefined,
1333
+ },
1334
+ update: {
1335
+ id: item.action.id !== undefined ? {
1336
+ set: item.action.id
1337
+ } : undefined,
1338
+ sequence: item.action.sequence !== undefined ? {
1339
+ set: item.action.sequence
1340
+ } : undefined,
1341
+ type: item.action.type !== undefined ? {
1342
+ set: item.action.type
1343
+ } : undefined,
1344
+ note: item.action.note !== undefined ? {
1345
+ set: item.action.note
1346
+ } : undefined,
1347
+ status: item.action.status !== undefined ? {
1348
+ set: item.action.status
1349
+ } : undefined,
1350
+ fee: item.action.fee !== undefined ? {
1351
+ set: item.action.fee
1352
+ } : undefined,
1353
+ },
1354
+ create: {
1355
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1356
+ type: item.action.type !== undefined ? item.action.type : undefined,
1357
+ note: item.action.note !== undefined ? item.action.note : undefined,
1358
+ status: item.action.status !== undefined ? item.action.status : undefined,
1359
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1360
+ },
1361
+ }
1362
+ } : undefined,
1088
1363
  },
1089
1364
  create: {
1090
1365
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1103,6 +1378,44 @@ export const NewsArticleAssetSentiment = {
1103
1378
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1104
1379
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1105
1380
  fee: item.fee !== undefined ? item.fee : undefined,
1381
+ alpacaAccount: item.alpacaAccount ?
1382
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1383
+ ? { connect: {
1384
+ id: item.alpacaAccount.id
1385
+ }
1386
+ }
1387
+ : { connectOrCreate: {
1388
+ where: {
1389
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1390
+ },
1391
+ create: {
1392
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1393
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1394
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1395
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1396
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1397
+ },
1398
+ }
1399
+ } : undefined,
1400
+ action: item.action ?
1401
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1402
+ ? { connect: {
1403
+ id: item.action.id
1404
+ }
1405
+ }
1406
+ : { connectOrCreate: {
1407
+ where: {
1408
+ id: item.action.id !== undefined ? item.action.id : undefined,
1409
+ },
1410
+ create: {
1411
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1412
+ type: item.action.type !== undefined ? item.action.type : undefined,
1413
+ note: item.action.note !== undefined ? item.action.note : undefined,
1414
+ status: item.action.status !== undefined ? item.action.status : undefined,
1415
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1416
+ },
1417
+ }
1418
+ } : undefined,
1106
1419
  },
1107
1420
  }))
1108
1421
  } : undefined,
@@ -1154,6 +1467,42 @@ export const NewsArticleAssetSentiment = {
1154
1467
  assetMarginable: item.assetMarginable !== undefined ? {
1155
1468
  set: item.assetMarginable
1156
1469
  } : undefined,
1470
+ alpacaAccount: item.alpacaAccount ? {
1471
+ upsert: {
1472
+ where: {
1473
+ id: item.alpacaAccount.id !== undefined ? {
1474
+ equals: item.alpacaAccount.id
1475
+ } : undefined,
1476
+ },
1477
+ update: {
1478
+ id: item.alpacaAccount.id !== undefined ? {
1479
+ set: item.alpacaAccount.id
1480
+ } : undefined,
1481
+ type: item.alpacaAccount.type !== undefined ? {
1482
+ set: item.alpacaAccount.type
1483
+ } : undefined,
1484
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
1485
+ set: item.alpacaAccount.APIKey
1486
+ } : undefined,
1487
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
1488
+ set: item.alpacaAccount.APISecret
1489
+ } : undefined,
1490
+ configuration: item.alpacaAccount.configuration !== undefined ? {
1491
+ set: item.alpacaAccount.configuration
1492
+ } : undefined,
1493
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
1494
+ set: item.alpacaAccount.marketOpen
1495
+ } : undefined,
1496
+ },
1497
+ create: {
1498
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1499
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1500
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1501
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1502
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1503
+ },
1504
+ }
1505
+ } : undefined,
1157
1506
  },
1158
1507
  create: {
1159
1508
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -1169,6 +1518,25 @@ export const NewsArticleAssetSentiment = {
1169
1518
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1170
1519
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1171
1520
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1521
+ alpacaAccount: item.alpacaAccount ?
1522
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1523
+ ? { connect: {
1524
+ id: item.alpacaAccount.id
1525
+ }
1526
+ }
1527
+ : { connectOrCreate: {
1528
+ where: {
1529
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1530
+ },
1531
+ create: {
1532
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1533
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1534
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1535
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1536
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1537
+ },
1538
+ }
1539
+ } : undefined,
1172
1540
  },
1173
1541
  }))
1174
1542
  } : undefined,
@@ -1250,6 +1618,44 @@ export const NewsArticleAssetSentiment = {
1250
1618
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1251
1619
  status: item.status !== undefined ? item.status : undefined,
1252
1620
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1621
+ alpacaAccount: item.alpacaAccount ?
1622
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1623
+ ? { connect: {
1624
+ id: item.alpacaAccount.id
1625
+ }
1626
+ }
1627
+ : { connectOrCreate: {
1628
+ where: {
1629
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1630
+ },
1631
+ create: {
1632
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1633
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1634
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1635
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1636
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1637
+ },
1638
+ }
1639
+ } : undefined,
1640
+ actions: item.actions ?
1641
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
1642
+ connect: item.actions.map((item) => ({
1643
+ id: item.id
1644
+ }))
1645
+ }
1646
+ : { connectOrCreate: item.actions.map((item) => ({
1647
+ where: {
1648
+ id: item.id !== undefined ? item.id : undefined,
1649
+ },
1650
+ create: {
1651
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1652
+ type: item.type !== undefined ? item.type : undefined,
1653
+ note: item.note !== undefined ? item.note : undefined,
1654
+ status: item.status !== undefined ? item.status : undefined,
1655
+ fee: item.fee !== undefined ? item.fee : undefined,
1656
+ },
1657
+ }))
1658
+ } : undefined,
1253
1659
  },
1254
1660
  }))
1255
1661
  } : undefined,
@@ -1280,6 +1686,44 @@ export const NewsArticleAssetSentiment = {
1280
1686
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1281
1687
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1282
1688
  fee: item.fee !== undefined ? item.fee : undefined,
1689
+ alpacaAccount: item.alpacaAccount ?
1690
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1691
+ ? { connect: {
1692
+ id: item.alpacaAccount.id
1693
+ }
1694
+ }
1695
+ : { connectOrCreate: {
1696
+ where: {
1697
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1698
+ },
1699
+ create: {
1700
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1701
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1702
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1703
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1704
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1705
+ },
1706
+ }
1707
+ } : undefined,
1708
+ action: item.action ?
1709
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1710
+ ? { connect: {
1711
+ id: item.action.id
1712
+ }
1713
+ }
1714
+ : { connectOrCreate: {
1715
+ where: {
1716
+ id: item.action.id !== undefined ? item.action.id : undefined,
1717
+ },
1718
+ create: {
1719
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1720
+ type: item.action.type !== undefined ? item.action.type : undefined,
1721
+ note: item.action.note !== undefined ? item.action.note : undefined,
1722
+ status: item.action.status !== undefined ? item.action.status : undefined,
1723
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1724
+ },
1725
+ }
1726
+ } : undefined,
1283
1727
  },
1284
1728
  }))
1285
1729
  } : undefined,
@@ -1307,6 +1751,25 @@ export const NewsArticleAssetSentiment = {
1307
1751
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1308
1752
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1309
1753
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1754
+ alpacaAccount: item.alpacaAccount ?
1755
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1756
+ ? { connect: {
1757
+ id: item.alpacaAccount.id
1758
+ }
1759
+ }
1760
+ : { connectOrCreate: {
1761
+ where: {
1762
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1763
+ },
1764
+ create: {
1765
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1766
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1767
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1768
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1769
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1770
+ },
1771
+ }
1772
+ } : undefined,
1310
1773
  },
1311
1774
  }))
1312
1775
  } : undefined,
@@ -1661,6 +2124,76 @@ export const NewsArticleAssetSentiment = {
1661
2124
  optionContractType: item.optionContractType !== undefined ? {
1662
2125
  set: item.optionContractType
1663
2126
  } : undefined,
2127
+ alpacaAccount: item.alpacaAccount ? {
2128
+ upsert: {
2129
+ where: {
2130
+ id: item.alpacaAccount.id !== undefined ? {
2131
+ equals: item.alpacaAccount.id
2132
+ } : undefined,
2133
+ },
2134
+ update: {
2135
+ id: item.alpacaAccount.id !== undefined ? {
2136
+ set: item.alpacaAccount.id
2137
+ } : undefined,
2138
+ type: item.alpacaAccount.type !== undefined ? {
2139
+ set: item.alpacaAccount.type
2140
+ } : undefined,
2141
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2142
+ set: item.alpacaAccount.APIKey
2143
+ } : undefined,
2144
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2145
+ set: item.alpacaAccount.APISecret
2146
+ } : undefined,
2147
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2148
+ set: item.alpacaAccount.configuration
2149
+ } : undefined,
2150
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2151
+ set: item.alpacaAccount.marketOpen
2152
+ } : undefined,
2153
+ },
2154
+ create: {
2155
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2156
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2157
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2158
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2159
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2160
+ },
2161
+ }
2162
+ } : undefined,
2163
+ actions: item.actions ? {
2164
+ upsert: item.actions.map((item) => ({
2165
+ where: {
2166
+ id: item.id !== undefined ? item.id : undefined,
2167
+ },
2168
+ update: {
2169
+ id: item.id !== undefined ? {
2170
+ set: item.id
2171
+ } : undefined,
2172
+ sequence: item.sequence !== undefined ? {
2173
+ set: item.sequence
2174
+ } : undefined,
2175
+ type: item.type !== undefined ? {
2176
+ set: item.type
2177
+ } : undefined,
2178
+ note: item.note !== undefined ? {
2179
+ set: item.note
2180
+ } : undefined,
2181
+ status: item.status !== undefined ? {
2182
+ set: item.status
2183
+ } : undefined,
2184
+ fee: item.fee !== undefined ? {
2185
+ set: item.fee
2186
+ } : undefined,
2187
+ },
2188
+ create: {
2189
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2190
+ type: item.type !== undefined ? item.type : undefined,
2191
+ note: item.note !== undefined ? item.note : undefined,
2192
+ status: item.status !== undefined ? item.status : undefined,
2193
+ fee: item.fee !== undefined ? item.fee : undefined,
2194
+ },
2195
+ }))
2196
+ } : undefined,
1664
2197
  },
1665
2198
  create: {
1666
2199
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1673,6 +2206,44 @@ export const NewsArticleAssetSentiment = {
1673
2206
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1674
2207
  status: item.status !== undefined ? item.status : undefined,
1675
2208
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2209
+ alpacaAccount: item.alpacaAccount ?
2210
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2211
+ ? { connect: {
2212
+ id: item.alpacaAccount.id
2213
+ }
2214
+ }
2215
+ : { connectOrCreate: {
2216
+ where: {
2217
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2218
+ },
2219
+ create: {
2220
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2221
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2222
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2223
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2224
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2225
+ },
2226
+ }
2227
+ } : undefined,
2228
+ actions: item.actions ?
2229
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2230
+ connect: item.actions.map((item) => ({
2231
+ id: item.id
2232
+ }))
2233
+ }
2234
+ : { connectOrCreate: item.actions.map((item) => ({
2235
+ where: {
2236
+ id: item.id !== undefined ? item.id : undefined,
2237
+ },
2238
+ create: {
2239
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2240
+ type: item.type !== undefined ? item.type : undefined,
2241
+ note: item.note !== undefined ? item.note : undefined,
2242
+ status: item.status !== undefined ? item.status : undefined,
2243
+ fee: item.fee !== undefined ? item.fee : undefined,
2244
+ },
2245
+ }))
2246
+ } : undefined,
1676
2247
  },
1677
2248
  }))
1678
2249
  } : undefined,
@@ -1733,6 +2304,78 @@ export const NewsArticleAssetSentiment = {
1733
2304
  fee: item.fee !== undefined ? {
1734
2305
  set: item.fee
1735
2306
  } : undefined,
2307
+ alpacaAccount: item.alpacaAccount ? {
2308
+ upsert: {
2309
+ where: {
2310
+ id: item.alpacaAccount.id !== undefined ? {
2311
+ equals: item.alpacaAccount.id
2312
+ } : undefined,
2313
+ },
2314
+ update: {
2315
+ id: item.alpacaAccount.id !== undefined ? {
2316
+ set: item.alpacaAccount.id
2317
+ } : undefined,
2318
+ type: item.alpacaAccount.type !== undefined ? {
2319
+ set: item.alpacaAccount.type
2320
+ } : undefined,
2321
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2322
+ set: item.alpacaAccount.APIKey
2323
+ } : undefined,
2324
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2325
+ set: item.alpacaAccount.APISecret
2326
+ } : undefined,
2327
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2328
+ set: item.alpacaAccount.configuration
2329
+ } : undefined,
2330
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2331
+ set: item.alpacaAccount.marketOpen
2332
+ } : undefined,
2333
+ },
2334
+ create: {
2335
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2336
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2337
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2338
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2339
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2340
+ },
2341
+ }
2342
+ } : undefined,
2343
+ action: item.action ? {
2344
+ upsert: {
2345
+ where: {
2346
+ id: item.action.id !== undefined ? {
2347
+ equals: item.action.id
2348
+ } : undefined,
2349
+ },
2350
+ update: {
2351
+ id: item.action.id !== undefined ? {
2352
+ set: item.action.id
2353
+ } : undefined,
2354
+ sequence: item.action.sequence !== undefined ? {
2355
+ set: item.action.sequence
2356
+ } : undefined,
2357
+ type: item.action.type !== undefined ? {
2358
+ set: item.action.type
2359
+ } : undefined,
2360
+ note: item.action.note !== undefined ? {
2361
+ set: item.action.note
2362
+ } : undefined,
2363
+ status: item.action.status !== undefined ? {
2364
+ set: item.action.status
2365
+ } : undefined,
2366
+ fee: item.action.fee !== undefined ? {
2367
+ set: item.action.fee
2368
+ } : undefined,
2369
+ },
2370
+ create: {
2371
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2372
+ type: item.action.type !== undefined ? item.action.type : undefined,
2373
+ note: item.action.note !== undefined ? item.action.note : undefined,
2374
+ status: item.action.status !== undefined ? item.action.status : undefined,
2375
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2376
+ },
2377
+ }
2378
+ } : undefined,
1736
2379
  },
1737
2380
  create: {
1738
2381
  qty: item.qty !== undefined ? item.qty : undefined,
@@ -1751,6 +2394,44 @@ export const NewsArticleAssetSentiment = {
1751
2394
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1752
2395
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1753
2396
  fee: item.fee !== undefined ? item.fee : undefined,
2397
+ alpacaAccount: item.alpacaAccount ?
2398
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2399
+ ? { connect: {
2400
+ id: item.alpacaAccount.id
2401
+ }
2402
+ }
2403
+ : { connectOrCreate: {
2404
+ where: {
2405
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2406
+ },
2407
+ create: {
2408
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2409
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2410
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2411
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2412
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2413
+ },
2414
+ }
2415
+ } : undefined,
2416
+ action: item.action ?
2417
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2418
+ ? { connect: {
2419
+ id: item.action.id
2420
+ }
2421
+ }
2422
+ : { connectOrCreate: {
2423
+ where: {
2424
+ id: item.action.id !== undefined ? item.action.id : undefined,
2425
+ },
2426
+ create: {
2427
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2428
+ type: item.action.type !== undefined ? item.action.type : undefined,
2429
+ note: item.action.note !== undefined ? item.action.note : undefined,
2430
+ status: item.action.status !== undefined ? item.action.status : undefined,
2431
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2432
+ },
2433
+ }
2434
+ } : undefined,
1754
2435
  },
1755
2436
  }))
1756
2437
  } : undefined,
@@ -1802,6 +2483,42 @@ export const NewsArticleAssetSentiment = {
1802
2483
  assetMarginable: item.assetMarginable !== undefined ? {
1803
2484
  set: item.assetMarginable
1804
2485
  } : undefined,
2486
+ alpacaAccount: item.alpacaAccount ? {
2487
+ upsert: {
2488
+ where: {
2489
+ id: item.alpacaAccount.id !== undefined ? {
2490
+ equals: item.alpacaAccount.id
2491
+ } : undefined,
2492
+ },
2493
+ update: {
2494
+ id: item.alpacaAccount.id !== undefined ? {
2495
+ set: item.alpacaAccount.id
2496
+ } : undefined,
2497
+ type: item.alpacaAccount.type !== undefined ? {
2498
+ set: item.alpacaAccount.type
2499
+ } : undefined,
2500
+ APIKey: item.alpacaAccount.APIKey !== undefined ? {
2501
+ set: item.alpacaAccount.APIKey
2502
+ } : undefined,
2503
+ APISecret: item.alpacaAccount.APISecret !== undefined ? {
2504
+ set: item.alpacaAccount.APISecret
2505
+ } : undefined,
2506
+ configuration: item.alpacaAccount.configuration !== undefined ? {
2507
+ set: item.alpacaAccount.configuration
2508
+ } : undefined,
2509
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? {
2510
+ set: item.alpacaAccount.marketOpen
2511
+ } : undefined,
2512
+ },
2513
+ create: {
2514
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2515
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2516
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2517
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2518
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2519
+ },
2520
+ }
2521
+ } : undefined,
1805
2522
  },
1806
2523
  create: {
1807
2524
  averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
@@ -1817,6 +2534,25 @@ export const NewsArticleAssetSentiment = {
1817
2534
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1818
2535
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1819
2536
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2537
+ alpacaAccount: item.alpacaAccount ?
2538
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2539
+ ? { connect: {
2540
+ id: item.alpacaAccount.id
2541
+ }
2542
+ }
2543
+ : { connectOrCreate: {
2544
+ where: {
2545
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2546
+ },
2547
+ create: {
2548
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2549
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2550
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2551
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2552
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2553
+ },
2554
+ }
2555
+ } : undefined,
1820
2556
  },
1821
2557
  }))
1822
2558
  } : undefined,
@@ -1898,6 +2634,44 @@ export const NewsArticleAssetSentiment = {
1898
2634
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1899
2635
  status: item.status !== undefined ? item.status : undefined,
1900
2636
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
2637
+ alpacaAccount: item.alpacaAccount ?
2638
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2639
+ ? { connect: {
2640
+ id: item.alpacaAccount.id
2641
+ }
2642
+ }
2643
+ : { connectOrCreate: {
2644
+ where: {
2645
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2646
+ },
2647
+ create: {
2648
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2649
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2650
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2651
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2652
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2653
+ },
2654
+ }
2655
+ } : undefined,
2656
+ actions: item.actions ?
2657
+ Array.isArray(item.actions) && item.actions.length > 0 && item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) ? {
2658
+ connect: item.actions.map((item) => ({
2659
+ id: item.id
2660
+ }))
2661
+ }
2662
+ : { connectOrCreate: item.actions.map((item) => ({
2663
+ where: {
2664
+ id: item.id !== undefined ? item.id : undefined,
2665
+ },
2666
+ create: {
2667
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2668
+ type: item.type !== undefined ? item.type : undefined,
2669
+ note: item.note !== undefined ? item.note : undefined,
2670
+ status: item.status !== undefined ? item.status : undefined,
2671
+ fee: item.fee !== undefined ? item.fee : undefined,
2672
+ },
2673
+ }))
2674
+ } : undefined,
1901
2675
  },
1902
2676
  }))
1903
2677
  } : undefined,
@@ -1928,6 +2702,44 @@ export const NewsArticleAssetSentiment = {
1928
2702
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1929
2703
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1930
2704
  fee: item.fee !== undefined ? item.fee : undefined,
2705
+ alpacaAccount: item.alpacaAccount ?
2706
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2707
+ ? { connect: {
2708
+ id: item.alpacaAccount.id
2709
+ }
2710
+ }
2711
+ : { connectOrCreate: {
2712
+ where: {
2713
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2714
+ },
2715
+ create: {
2716
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2717
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2718
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2719
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2720
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2721
+ },
2722
+ }
2723
+ } : undefined,
2724
+ action: item.action ?
2725
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2726
+ ? { connect: {
2727
+ id: item.action.id
2728
+ }
2729
+ }
2730
+ : { connectOrCreate: {
2731
+ where: {
2732
+ id: item.action.id !== undefined ? item.action.id : undefined,
2733
+ },
2734
+ create: {
2735
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2736
+ type: item.action.type !== undefined ? item.action.type : undefined,
2737
+ note: item.action.note !== undefined ? item.action.note : undefined,
2738
+ status: item.action.status !== undefined ? item.action.status : undefined,
2739
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2740
+ },
2741
+ }
2742
+ } : undefined,
1931
2743
  },
1932
2744
  }))
1933
2745
  } : undefined,
@@ -1955,6 +2767,25 @@ export const NewsArticleAssetSentiment = {
1955
2767
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1956
2768
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1957
2769
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2770
+ alpacaAccount: item.alpacaAccount ?
2771
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2772
+ ? { connect: {
2773
+ id: item.alpacaAccount.id
2774
+ }
2775
+ }
2776
+ : { connectOrCreate: {
2777
+ where: {
2778
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2779
+ },
2780
+ create: {
2781
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2782
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2783
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2784
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2785
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2786
+ },
2787
+ }
2788
+ } : undefined,
1958
2789
  },
1959
2790
  }))
1960
2791
  } : undefined,