adaptic-backend 1.0.75 → 1.0.76

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 +255 -190
  2. package/Action.cjs +594 -524
  3. package/Alert.cjs +343 -278
  4. package/AlpacaAccount.cjs +1181 -1021
  5. package/Asset.cjs +478 -368
  6. package/Authenticator.cjs +276 -211
  7. package/Customer.cjs +255 -190
  8. package/NewsArticle.cjs +232 -212
  9. package/NewsArticleAssetSentiment.cjs +345 -290
  10. package/Order.cjs +676 -541
  11. package/Position.cjs +603 -488
  12. package/Session.cjs +279 -214
  13. package/Trade.cjs +748 -613
  14. package/User.cjs +394 -309
  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 +255 -190
  19. package/server/Action.d.ts.map +1 -1
  20. package/server/Action.js.map +1 -1
  21. package/server/Action.mjs +594 -524
  22. package/server/Alert.d.ts.map +1 -1
  23. package/server/Alert.js.map +1 -1
  24. package/server/Alert.mjs +343 -278
  25. package/server/AlpacaAccount.d.ts.map +1 -1
  26. package/server/AlpacaAccount.js.map +1 -1
  27. package/server/AlpacaAccount.mjs +1181 -1021
  28. package/server/Asset.d.ts.map +1 -1
  29. package/server/Asset.js.map +1 -1
  30. package/server/Asset.mjs +478 -368
  31. package/server/Authenticator.d.ts.map +1 -1
  32. package/server/Authenticator.js.map +1 -1
  33. package/server/Authenticator.mjs +276 -211
  34. package/server/Customer.d.ts.map +1 -1
  35. package/server/Customer.js.map +1 -1
  36. package/server/Customer.mjs +255 -190
  37. package/server/NewsArticle.d.ts.map +1 -1
  38. package/server/NewsArticle.js.map +1 -1
  39. package/server/NewsArticle.mjs +232 -212
  40. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  41. package/server/NewsArticleAssetSentiment.js.map +1 -1
  42. package/server/NewsArticleAssetSentiment.mjs +345 -290
  43. package/server/Order.d.ts.map +1 -1
  44. package/server/Order.js.map +1 -1
  45. package/server/Order.mjs +676 -541
  46. package/server/Position.d.ts.map +1 -1
  47. package/server/Position.js.map +1 -1
  48. package/server/Position.mjs +603 -488
  49. package/server/Session.d.ts.map +1 -1
  50. package/server/Session.js.map +1 -1
  51. package/server/Session.mjs +279 -214
  52. package/server/Trade.d.ts.map +1 -1
  53. package/server/Trade.js.map +1 -1
  54. package/server/Trade.mjs +748 -613
  55. package/server/User.d.ts.map +1 -1
  56. package/server/User.js.map +1 -1
  57. package/server/User.mjs +394 -309
package/server/Asset.mjs CHANGED
@@ -321,182 +321,232 @@ export const Asset = {
321
321
  exDividendDate: props.exDividendDate !== undefined ? props.exDividendDate : undefined,
322
322
  sellPrice: props.sellPrice !== undefined ? props.sellPrice : undefined,
323
323
  buyPrice: props.buyPrice !== undefined ? props.buyPrice : undefined,
324
- trades: props.trades ? {
325
- connectOrCreate: props.trades.map((item) => ({
326
- where: {
327
- id: item.id !== undefined ? item.id : undefined,
328
- },
329
- create: {
330
- qty: item.qty !== undefined ? item.qty : undefined,
331
- price: item.price !== undefined ? item.price : undefined,
332
- total: item.total !== undefined ? item.total : undefined,
333
- signal: item.signal !== undefined ? item.signal : undefined,
334
- strategy: item.strategy !== undefined ? item.strategy : undefined,
335
- analysis: item.analysis !== undefined ? item.analysis : undefined,
336
- confidence: item.confidence !== undefined ? item.confidence : undefined,
337
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
338
- status: item.status !== undefined ? item.status : undefined,
339
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
340
- alpacaAccount: item.alpacaAccount ? {
341
- connectOrCreate: {
342
- where: {
343
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
344
- },
345
- create: {
346
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
347
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
348
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
349
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
350
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
351
- },
352
- }
353
- } : undefined,
354
- actions: item.actions ? {
355
- connectOrCreate: item.actions.map((item) => ({
356
- where: {
357
- id: item.id !== undefined ? item.id : undefined,
358
- },
359
- create: {
360
- sequence: item.sequence !== undefined ? item.sequence : undefined,
361
- type: item.type !== undefined ? item.type : undefined,
362
- note: item.note !== undefined ? item.note : undefined,
363
- status: item.status !== undefined ? item.status : undefined,
364
- fee: item.fee !== undefined ? item.fee : undefined,
365
- },
366
- }))
367
- } : undefined,
368
- },
369
- }))
370
- } : undefined,
371
- orders: props.orders ? {
372
- connectOrCreate: props.orders.map((item) => ({
373
- where: {
374
- id: item.id !== undefined ? item.id : undefined,
375
- },
376
- create: {
377
- qty: item.qty !== undefined ? item.qty : undefined,
378
- notional: item.notional !== undefined ? item.notional : undefined,
379
- side: item.side !== undefined ? item.side : undefined,
380
- type: item.type !== undefined ? item.type : undefined,
381
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
382
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
383
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
384
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
385
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
386
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
387
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
388
- status: item.status !== undefined ? item.status : undefined,
389
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
390
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
391
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
392
- fee: item.fee !== undefined ? item.fee : undefined,
393
- alpacaAccount: item.alpacaAccount ? {
394
- connectOrCreate: {
395
- where: {
396
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
397
- },
398
- create: {
399
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
400
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
401
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
402
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
403
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
404
- },
405
- }
406
- } : undefined,
407
- action: item.action ? {
408
- connectOrCreate: {
409
- where: {
410
- id: item.action.id !== undefined ? item.action.id : undefined,
411
- },
412
- create: {
413
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
414
- type: item.action.type !== undefined ? item.action.type : undefined,
415
- note: item.action.note !== undefined ? item.action.note : undefined,
416
- status: item.action.status !== undefined ? item.action.status : undefined,
417
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
418
- },
419
- }
420
- } : undefined,
421
- },
422
- }))
423
- } : undefined,
424
- positions: props.positions ? {
425
- connectOrCreate: props.positions.map((item) => ({
426
- where: {
427
- id: item.id !== undefined ? item.id : undefined,
428
- },
429
- create: {
430
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
431
- qty: item.qty !== undefined ? item.qty : undefined,
432
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
433
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
434
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
435
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
436
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
437
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
438
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
439
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
440
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
441
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
442
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
443
- alpacaAccount: item.alpacaAccount ? {
444
- connectOrCreate: {
445
- where: {
446
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
447
- },
448
- create: {
449
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
450
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
451
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
452
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
453
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
454
- },
455
- }
456
- } : undefined,
457
- },
458
- }))
459
- } : undefined,
460
- newsMentions: props.newsMentions ? {
461
- connectOrCreate: props.newsMentions.map((item) => ({
462
- where: {
463
- id: item.id !== undefined ? item.id : undefined,
464
- url: item.url !== undefined ? item.url : undefined,
465
- },
466
- create: {
467
- url: item.url !== undefined ? item.url : undefined,
468
- relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
469
- sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
470
- sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
471
- news: item.news ? {
472
- connectOrCreate: {
473
- where: {
474
- id: item.news.id !== undefined ? item.news.id : undefined,
475
- url: item.news.url !== undefined ? item.news.url : undefined,
476
- title: item.news.title !== undefined ? {
477
- equals: item.news.title
478
- } : undefined,
479
- },
480
- create: {
481
- title: item.news.title !== undefined ? item.news.title : undefined,
482
- content: item.news.content !== undefined ? item.news.content : undefined,
483
- source: item.news.source !== undefined ? item.news.source : undefined,
484
- sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
485
- url: item.news.url !== undefined ? item.news.url : undefined,
486
- sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
487
- authors: item.news.authors !== undefined ? item.news.authors : undefined,
488
- summary: item.news.summary !== undefined ? item.news.summary : undefined,
489
- bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
490
- timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
491
- category: item.news.category !== undefined ? item.news.category : undefined,
492
- topics: item.news.topics !== undefined ? item.news.topics : undefined,
493
- logo: item.news.logo !== undefined ? item.news.logo : undefined,
494
- },
495
- }
496
- } : undefined,
497
- },
498
- }))
499
- } : undefined,
324
+ trades: props.trades ?
325
+ typeof props.trades[0] === 'object' && Object.keys(props.trades).length === 1 && Object.keys(props.trades)[0] === 'id'
326
+ ? { connect: props.trades.map((item) => ({
327
+ id: item.id
328
+ }))
329
+ }
330
+ : { connectOrCreate: props.trades.map((item) => ({
331
+ where: {
332
+ id: item.id !== undefined ? item.id : undefined,
333
+ },
334
+ create: {
335
+ qty: item.qty !== undefined ? item.qty : undefined,
336
+ price: item.price !== undefined ? item.price : undefined,
337
+ total: item.total !== undefined ? item.total : undefined,
338
+ signal: item.signal !== undefined ? item.signal : undefined,
339
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
340
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
341
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
342
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
343
+ status: item.status !== undefined ? item.status : undefined,
344
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
345
+ alpacaAccount: item.alpacaAccount ?
346
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
347
+ ? { connect: {
348
+ id: item.alpacaAccount.id
349
+ }
350
+ }
351
+ : { connectOrCreate: {
352
+ where: {
353
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
354
+ },
355
+ create: {
356
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
357
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
358
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
359
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
360
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
361
+ },
362
+ }
363
+ } : undefined,
364
+ actions: item.actions ?
365
+ typeof item.actions[0] === 'object' && Object.keys(item.actions).length === 1 && Object.keys(item.actions)[0] === 'id'
366
+ ? { connect: item.actions.map((item) => ({
367
+ id: item.id
368
+ }))
369
+ }
370
+ : { connectOrCreate: item.actions.map((item) => ({
371
+ where: {
372
+ id: item.id !== undefined ? item.id : undefined,
373
+ },
374
+ create: {
375
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
376
+ type: item.type !== undefined ? item.type : undefined,
377
+ note: item.note !== undefined ? item.note : undefined,
378
+ status: item.status !== undefined ? item.status : undefined,
379
+ fee: item.fee !== undefined ? item.fee : undefined,
380
+ },
381
+ }))
382
+ } : undefined,
383
+ },
384
+ }))
385
+ } : undefined,
386
+ orders: props.orders ?
387
+ typeof props.orders[0] === 'object' && Object.keys(props.orders).length === 1 && Object.keys(props.orders)[0] === 'id'
388
+ ? { connect: props.orders.map((item) => ({
389
+ id: item.id
390
+ }))
391
+ }
392
+ : { connectOrCreate: props.orders.map((item) => ({
393
+ where: {
394
+ id: item.id !== undefined ? item.id : undefined,
395
+ },
396
+ create: {
397
+ qty: item.qty !== undefined ? item.qty : undefined,
398
+ notional: item.notional !== undefined ? item.notional : undefined,
399
+ side: item.side !== undefined ? item.side : undefined,
400
+ type: item.type !== undefined ? item.type : undefined,
401
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
402
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
403
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
404
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
405
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
406
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
407
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
408
+ status: item.status !== undefined ? item.status : undefined,
409
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
410
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
411
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
412
+ fee: item.fee !== undefined ? item.fee : undefined,
413
+ alpacaAccount: item.alpacaAccount ?
414
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
415
+ ? { connect: {
416
+ id: item.alpacaAccount.id
417
+ }
418
+ }
419
+ : { connectOrCreate: {
420
+ where: {
421
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
422
+ },
423
+ create: {
424
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
425
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
426
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
427
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
428
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
429
+ },
430
+ }
431
+ } : undefined,
432
+ action: item.action ?
433
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
434
+ ? { connect: {
435
+ id: item.action.id
436
+ }
437
+ }
438
+ : { connectOrCreate: {
439
+ where: {
440
+ id: item.action.id !== undefined ? item.action.id : undefined,
441
+ },
442
+ create: {
443
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
444
+ type: item.action.type !== undefined ? item.action.type : undefined,
445
+ note: item.action.note !== undefined ? item.action.note : undefined,
446
+ status: item.action.status !== undefined ? item.action.status : undefined,
447
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
448
+ },
449
+ }
450
+ } : undefined,
451
+ },
452
+ }))
453
+ } : undefined,
454
+ positions: props.positions ?
455
+ typeof props.positions[0] === 'object' && Object.keys(props.positions).length === 1 && Object.keys(props.positions)[0] === 'id'
456
+ ? { connect: props.positions.map((item) => ({
457
+ id: item.id
458
+ }))
459
+ }
460
+ : { connectOrCreate: props.positions.map((item) => ({
461
+ where: {
462
+ id: item.id !== undefined ? item.id : undefined,
463
+ },
464
+ create: {
465
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
466
+ qty: item.qty !== undefined ? item.qty : undefined,
467
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
468
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
469
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
470
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
471
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
472
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
473
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
474
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
475
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
476
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
477
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
478
+ alpacaAccount: item.alpacaAccount ?
479
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
480
+ ? { connect: {
481
+ id: item.alpacaAccount.id
482
+ }
483
+ }
484
+ : { connectOrCreate: {
485
+ where: {
486
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
487
+ },
488
+ create: {
489
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
490
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
491
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
492
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
493
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
494
+ },
495
+ }
496
+ } : undefined,
497
+ },
498
+ }))
499
+ } : undefined,
500
+ newsMentions: props.newsMentions ?
501
+ typeof props.newsMentions[0] === 'object' && Object.keys(props.newsMentions).length === 1 && Object.keys(props.newsMentions)[0] === 'id'
502
+ ? { connect: props.newsMentions.map((item) => ({
503
+ id: item.id
504
+ }))
505
+ }
506
+ : { connectOrCreate: props.newsMentions.map((item) => ({
507
+ where: {
508
+ id: item.id !== undefined ? item.id : undefined,
509
+ url: item.url !== undefined ? item.url : undefined,
510
+ },
511
+ create: {
512
+ url: item.url !== undefined ? item.url : undefined,
513
+ relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
514
+ sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
515
+ sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
516
+ news: item.news ?
517
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
518
+ ? { connect: {
519
+ id: item.news.id
520
+ }
521
+ }
522
+ : { connectOrCreate: {
523
+ where: {
524
+ id: item.news.id !== undefined ? item.news.id : undefined,
525
+ url: item.news.url !== undefined ? item.news.url : undefined,
526
+ title: item.news.title !== undefined ? {
527
+ equals: item.news.title
528
+ } : undefined,
529
+ },
530
+ create: {
531
+ title: item.news.title !== undefined ? item.news.title : undefined,
532
+ content: item.news.content !== undefined ? item.news.content : undefined,
533
+ source: item.news.source !== undefined ? item.news.source : undefined,
534
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
535
+ url: item.news.url !== undefined ? item.news.url : undefined,
536
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
537
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
538
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
539
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
540
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
541
+ category: item.news.category !== undefined ? item.news.category : undefined,
542
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
543
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
544
+ },
545
+ }
546
+ } : undefined,
547
+ },
548
+ }))
549
+ } : undefined,
500
550
  },
501
551
  };
502
552
  const filteredVariables = removeUndefinedProps(variables);
@@ -1164,34 +1214,44 @@ export const Asset = {
1164
1214
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1165
1215
  status: item.status !== undefined ? item.status : undefined,
1166
1216
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1167
- alpacaAccount: item.alpacaAccount ? {
1168
- connectOrCreate: {
1169
- where: {
1170
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1171
- },
1172
- create: {
1173
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1174
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1175
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1176
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1177
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1178
- },
1179
- }
1180
- } : undefined,
1181
- actions: item.actions ? {
1182
- connectOrCreate: item.actions.map((item) => ({
1183
- where: {
1184
- id: item.id !== undefined ? item.id : undefined,
1185
- },
1186
- create: {
1187
- sequence: item.sequence !== undefined ? item.sequence : undefined,
1188
- type: item.type !== undefined ? item.type : undefined,
1189
- note: item.note !== undefined ? item.note : undefined,
1190
- status: item.status !== undefined ? item.status : undefined,
1191
- fee: item.fee !== undefined ? item.fee : undefined,
1192
- },
1193
- }))
1194
- } : undefined,
1217
+ alpacaAccount: item.alpacaAccount ?
1218
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1219
+ ? { connect: {
1220
+ id: item.alpacaAccount.id
1221
+ }
1222
+ }
1223
+ : { connectOrCreate: {
1224
+ where: {
1225
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1226
+ },
1227
+ create: {
1228
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1229
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1230
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1231
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1232
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1233
+ },
1234
+ }
1235
+ } : undefined,
1236
+ actions: item.actions ?
1237
+ typeof item.actions[0] === 'object' && Object.keys(item.actions).length === 1 && Object.keys(item.actions)[0] === 'id'
1238
+ ? { connect: item.actions.map((item) => ({
1239
+ id: item.id
1240
+ }))
1241
+ }
1242
+ : { connectOrCreate: item.actions.map((item) => ({
1243
+ where: {
1244
+ id: item.id !== undefined ? item.id : undefined,
1245
+ },
1246
+ create: {
1247
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1248
+ type: item.type !== undefined ? item.type : undefined,
1249
+ note: item.note !== undefined ? item.note : undefined,
1250
+ status: item.status !== undefined ? item.status : undefined,
1251
+ fee: item.fee !== undefined ? item.fee : undefined,
1252
+ },
1253
+ }))
1254
+ } : undefined,
1195
1255
  },
1196
1256
  }))
1197
1257
  } : undefined,
@@ -1342,34 +1402,44 @@ export const Asset = {
1342
1402
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1343
1403
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1344
1404
  fee: item.fee !== undefined ? item.fee : undefined,
1345
- alpacaAccount: item.alpacaAccount ? {
1346
- connectOrCreate: {
1347
- where: {
1348
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1349
- },
1350
- create: {
1351
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1352
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1353
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1354
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1355
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1356
- },
1357
- }
1358
- } : undefined,
1359
- action: item.action ? {
1360
- connectOrCreate: {
1361
- where: {
1362
- id: item.action.id !== undefined ? item.action.id : undefined,
1363
- },
1364
- create: {
1365
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1366
- type: item.action.type !== undefined ? item.action.type : undefined,
1367
- note: item.action.note !== undefined ? item.action.note : undefined,
1368
- status: item.action.status !== undefined ? item.action.status : undefined,
1369
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
1370
- },
1371
- }
1372
- } : undefined,
1405
+ alpacaAccount: item.alpacaAccount ?
1406
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1407
+ ? { connect: {
1408
+ id: item.alpacaAccount.id
1409
+ }
1410
+ }
1411
+ : { connectOrCreate: {
1412
+ where: {
1413
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1414
+ },
1415
+ create: {
1416
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1417
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1418
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1419
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1420
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1421
+ },
1422
+ }
1423
+ } : undefined,
1424
+ action: item.action ?
1425
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
1426
+ ? { connect: {
1427
+ id: item.action.id
1428
+ }
1429
+ }
1430
+ : { connectOrCreate: {
1431
+ where: {
1432
+ id: item.action.id !== undefined ? item.action.id : undefined,
1433
+ },
1434
+ create: {
1435
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
1436
+ type: item.action.type !== undefined ? item.action.type : undefined,
1437
+ note: item.action.note !== undefined ? item.action.note : undefined,
1438
+ status: item.action.status !== undefined ? item.action.status : undefined,
1439
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
1440
+ },
1441
+ }
1442
+ } : undefined,
1373
1443
  },
1374
1444
  }))
1375
1445
  } : undefined,
@@ -1472,20 +1542,25 @@ export const Asset = {
1472
1542
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1473
1543
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1474
1544
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1475
- alpacaAccount: item.alpacaAccount ? {
1476
- connectOrCreate: {
1477
- where: {
1478
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1479
- },
1480
- create: {
1481
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1482
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1483
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1484
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1485
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1486
- },
1487
- }
1488
- } : undefined,
1545
+ alpacaAccount: item.alpacaAccount ?
1546
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
1547
+ ? { connect: {
1548
+ id: item.alpacaAccount.id
1549
+ }
1550
+ }
1551
+ : { connectOrCreate: {
1552
+ where: {
1553
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1554
+ },
1555
+ create: {
1556
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1557
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1558
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1559
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1560
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1561
+ },
1562
+ }
1563
+ } : undefined,
1489
1564
  },
1490
1565
  }))
1491
1566
  } : undefined,
@@ -1591,32 +1666,37 @@ export const Asset = {
1591
1666
  relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
1592
1667
  sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
1593
1668
  sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
1594
- news: item.news ? {
1595
- connectOrCreate: {
1596
- where: {
1597
- id: item.news.id !== undefined ? item.news.id : undefined,
1598
- url: item.news.url !== undefined ? item.news.url : undefined,
1599
- title: item.news.title !== undefined ? {
1600
- equals: item.news.title
1601
- } : undefined,
1602
- },
1603
- create: {
1604
- title: item.news.title !== undefined ? item.news.title : undefined,
1605
- content: item.news.content !== undefined ? item.news.content : undefined,
1606
- source: item.news.source !== undefined ? item.news.source : undefined,
1607
- sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
1608
- url: item.news.url !== undefined ? item.news.url : undefined,
1609
- sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
1610
- authors: item.news.authors !== undefined ? item.news.authors : undefined,
1611
- summary: item.news.summary !== undefined ? item.news.summary : undefined,
1612
- bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
1613
- timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
1614
- category: item.news.category !== undefined ? item.news.category : undefined,
1615
- topics: item.news.topics !== undefined ? item.news.topics : undefined,
1616
- logo: item.news.logo !== undefined ? item.news.logo : undefined,
1617
- },
1618
- }
1619
- } : undefined,
1669
+ news: item.news ?
1670
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
1671
+ ? { connect: {
1672
+ id: item.news.id
1673
+ }
1674
+ }
1675
+ : { connectOrCreate: {
1676
+ where: {
1677
+ id: item.news.id !== undefined ? item.news.id : undefined,
1678
+ url: item.news.url !== undefined ? item.news.url : undefined,
1679
+ title: item.news.title !== undefined ? {
1680
+ equals: item.news.title
1681
+ } : undefined,
1682
+ },
1683
+ create: {
1684
+ title: item.news.title !== undefined ? item.news.title : undefined,
1685
+ content: item.news.content !== undefined ? item.news.content : undefined,
1686
+ source: item.news.source !== undefined ? item.news.source : undefined,
1687
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
1688
+ url: item.news.url !== undefined ? item.news.url : undefined,
1689
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
1690
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
1691
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
1692
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
1693
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
1694
+ category: item.news.category !== undefined ? item.news.category : undefined,
1695
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
1696
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
1697
+ },
1698
+ }
1699
+ } : undefined,
1620
1700
  },
1621
1701
  }))
1622
1702
  } : undefined,
@@ -1954,34 +2034,44 @@ export const Asset = {
1954
2034
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1955
2035
  status: item.status !== undefined ? item.status : undefined,
1956
2036
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1957
- alpacaAccount: item.alpacaAccount ? {
1958
- connectOrCreate: {
1959
- where: {
1960
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
1961
- },
1962
- create: {
1963
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
1964
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
1965
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
1966
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
1967
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
1968
- },
1969
- }
1970
- } : undefined,
1971
- actions: item.actions ? {
1972
- connectOrCreate: item.actions.map((item) => ({
1973
- where: {
1974
- id: item.id !== undefined ? item.id : undefined,
1975
- },
1976
- create: {
1977
- sequence: item.sequence !== undefined ? item.sequence : undefined,
1978
- type: item.type !== undefined ? item.type : undefined,
1979
- note: item.note !== undefined ? item.note : undefined,
1980
- status: item.status !== undefined ? item.status : undefined,
1981
- fee: item.fee !== undefined ? item.fee : undefined,
1982
- },
1983
- }))
1984
- } : undefined,
2037
+ alpacaAccount: item.alpacaAccount ?
2038
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2039
+ ? { connect: {
2040
+ id: item.alpacaAccount.id
2041
+ }
2042
+ }
2043
+ : { connectOrCreate: {
2044
+ where: {
2045
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2046
+ },
2047
+ create: {
2048
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2049
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2050
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2051
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2052
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2053
+ },
2054
+ }
2055
+ } : undefined,
2056
+ actions: item.actions ?
2057
+ typeof item.actions[0] === 'object' && Object.keys(item.actions).length === 1 && Object.keys(item.actions)[0] === 'id'
2058
+ ? { connect: item.actions.map((item) => ({
2059
+ id: item.id
2060
+ }))
2061
+ }
2062
+ : { connectOrCreate: item.actions.map((item) => ({
2063
+ where: {
2064
+ id: item.id !== undefined ? item.id : undefined,
2065
+ },
2066
+ create: {
2067
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
2068
+ type: item.type !== undefined ? item.type : undefined,
2069
+ note: item.note !== undefined ? item.note : undefined,
2070
+ status: item.status !== undefined ? item.status : undefined,
2071
+ fee: item.fee !== undefined ? item.fee : undefined,
2072
+ },
2073
+ }))
2074
+ } : undefined,
1985
2075
  },
1986
2076
  }))
1987
2077
  } : undefined,
@@ -2132,34 +2222,44 @@ export const Asset = {
2132
2222
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2133
2223
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2134
2224
  fee: item.fee !== undefined ? item.fee : undefined,
2135
- alpacaAccount: item.alpacaAccount ? {
2136
- connectOrCreate: {
2137
- where: {
2138
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2139
- },
2140
- create: {
2141
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2142
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2143
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2144
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2145
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2146
- },
2147
- }
2148
- } : undefined,
2149
- action: item.action ? {
2150
- connectOrCreate: {
2151
- where: {
2152
- id: item.action.id !== undefined ? item.action.id : undefined,
2153
- },
2154
- create: {
2155
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2156
- type: item.action.type !== undefined ? item.action.type : undefined,
2157
- note: item.action.note !== undefined ? item.action.note : undefined,
2158
- status: item.action.status !== undefined ? item.action.status : undefined,
2159
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
2160
- },
2161
- }
2162
- } : undefined,
2225
+ alpacaAccount: item.alpacaAccount ?
2226
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2227
+ ? { connect: {
2228
+ id: item.alpacaAccount.id
2229
+ }
2230
+ }
2231
+ : { connectOrCreate: {
2232
+ where: {
2233
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2234
+ },
2235
+ create: {
2236
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2237
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2238
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2239
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2240
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2241
+ },
2242
+ }
2243
+ } : undefined,
2244
+ action: item.action ?
2245
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2246
+ ? { connect: {
2247
+ id: item.action.id
2248
+ }
2249
+ }
2250
+ : { connectOrCreate: {
2251
+ where: {
2252
+ id: item.action.id !== undefined ? item.action.id : undefined,
2253
+ },
2254
+ create: {
2255
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2256
+ type: item.action.type !== undefined ? item.action.type : undefined,
2257
+ note: item.action.note !== undefined ? item.action.note : undefined,
2258
+ status: item.action.status !== undefined ? item.action.status : undefined,
2259
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2260
+ },
2261
+ }
2262
+ } : undefined,
2163
2263
  },
2164
2264
  }))
2165
2265
  } : undefined,
@@ -2262,20 +2362,25 @@ export const Asset = {
2262
2362
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2263
2363
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2264
2364
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2265
- alpacaAccount: item.alpacaAccount ? {
2266
- connectOrCreate: {
2267
- where: {
2268
- id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2269
- },
2270
- create: {
2271
- type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2272
- APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2273
- APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2274
- configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2275
- marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2276
- },
2277
- }
2278
- } : undefined,
2365
+ alpacaAccount: item.alpacaAccount ?
2366
+ typeof item.alpacaAccount === 'object' && Object.keys(item.alpacaAccount).length === 1 && Object.keys(item.alpacaAccount)[0] === 'id'
2367
+ ? { connect: {
2368
+ id: item.alpacaAccount.id
2369
+ }
2370
+ }
2371
+ : { connectOrCreate: {
2372
+ where: {
2373
+ id: item.alpacaAccount.id !== undefined ? item.alpacaAccount.id : undefined,
2374
+ },
2375
+ create: {
2376
+ type: item.alpacaAccount.type !== undefined ? item.alpacaAccount.type : undefined,
2377
+ APIKey: item.alpacaAccount.APIKey !== undefined ? item.alpacaAccount.APIKey : undefined,
2378
+ APISecret: item.alpacaAccount.APISecret !== undefined ? item.alpacaAccount.APISecret : undefined,
2379
+ configuration: item.alpacaAccount.configuration !== undefined ? item.alpacaAccount.configuration : undefined,
2380
+ marketOpen: item.alpacaAccount.marketOpen !== undefined ? item.alpacaAccount.marketOpen : undefined,
2381
+ },
2382
+ }
2383
+ } : undefined,
2279
2384
  },
2280
2385
  }))
2281
2386
  } : undefined,
@@ -2381,32 +2486,37 @@ export const Asset = {
2381
2486
  relevancyScore: item.relevancyScore !== undefined ? item.relevancyScore : undefined,
2382
2487
  sentimentScore: item.sentimentScore !== undefined ? item.sentimentScore : undefined,
2383
2488
  sentimentLabel: item.sentimentLabel !== undefined ? item.sentimentLabel : undefined,
2384
- news: item.news ? {
2385
- connectOrCreate: {
2386
- where: {
2387
- id: item.news.id !== undefined ? item.news.id : undefined,
2388
- url: item.news.url !== undefined ? item.news.url : undefined,
2389
- title: item.news.title !== undefined ? {
2390
- equals: item.news.title
2391
- } : undefined,
2392
- },
2393
- create: {
2394
- title: item.news.title !== undefined ? item.news.title : undefined,
2395
- content: item.news.content !== undefined ? item.news.content : undefined,
2396
- source: item.news.source !== undefined ? item.news.source : undefined,
2397
- sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
2398
- url: item.news.url !== undefined ? item.news.url : undefined,
2399
- sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
2400
- authors: item.news.authors !== undefined ? item.news.authors : undefined,
2401
- summary: item.news.summary !== undefined ? item.news.summary : undefined,
2402
- bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
2403
- timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
2404
- category: item.news.category !== undefined ? item.news.category : undefined,
2405
- topics: item.news.topics !== undefined ? item.news.topics : undefined,
2406
- logo: item.news.logo !== undefined ? item.news.logo : undefined,
2407
- },
2408
- }
2409
- } : undefined,
2489
+ news: item.news ?
2490
+ typeof item.news === 'object' && Object.keys(item.news).length === 1 && Object.keys(item.news)[0] === 'id'
2491
+ ? { connect: {
2492
+ id: item.news.id
2493
+ }
2494
+ }
2495
+ : { connectOrCreate: {
2496
+ where: {
2497
+ id: item.news.id !== undefined ? item.news.id : undefined,
2498
+ url: item.news.url !== undefined ? item.news.url : undefined,
2499
+ title: item.news.title !== undefined ? {
2500
+ equals: item.news.title
2501
+ } : undefined,
2502
+ },
2503
+ create: {
2504
+ title: item.news.title !== undefined ? item.news.title : undefined,
2505
+ content: item.news.content !== undefined ? item.news.content : undefined,
2506
+ source: item.news.source !== undefined ? item.news.source : undefined,
2507
+ sourceDomain: item.news.sourceDomain !== undefined ? item.news.sourceDomain : undefined,
2508
+ url: item.news.url !== undefined ? item.news.url : undefined,
2509
+ sentiment: item.news.sentiment !== undefined ? item.news.sentiment : undefined,
2510
+ authors: item.news.authors !== undefined ? item.news.authors : undefined,
2511
+ summary: item.news.summary !== undefined ? item.news.summary : undefined,
2512
+ bannerImage: item.news.bannerImage !== undefined ? item.news.bannerImage : undefined,
2513
+ timePublished: item.news.timePublished !== undefined ? item.news.timePublished : undefined,
2514
+ category: item.news.category !== undefined ? item.news.category : undefined,
2515
+ topics: item.news.topics !== undefined ? item.news.topics : undefined,
2516
+ logo: item.news.logo !== undefined ? item.news.logo : undefined,
2517
+ },
2518
+ }
2519
+ } : undefined,
2410
2520
  },
2411
2521
  }))
2412
2522
  } : undefined,