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