adaptic-backend 1.0.75 → 1.0.77

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 +264 -190
  2. package/Action.cjs +594 -524
  3. package/Alert.cjs +352 -278
  4. package/AlpacaAccount.cjs +1197 -1021
  5. package/Asset.cjs +485 -368
  6. package/Authenticator.cjs +285 -211
  7. package/Customer.cjs +268 -190
  8. package/NewsArticle.cjs +233 -212
  9. package/NewsArticleAssetSentiment.cjs +354 -290
  10. package/Order.cjs +694 -541
  11. package/Position.cjs +621 -488
  12. package/Session.cjs +288 -214
  13. package/Trade.cjs +767 -613
  14. package/User.cjs +410 -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 +264 -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 +352 -278
  25. package/server/AlpacaAccount.d.ts.map +1 -1
  26. package/server/AlpacaAccount.js.map +1 -1
  27. package/server/AlpacaAccount.mjs +1197 -1021
  28. package/server/Asset.d.ts.map +1 -1
  29. package/server/Asset.js.map +1 -1
  30. package/server/Asset.mjs +485 -368
  31. package/server/Authenticator.d.ts.map +1 -1
  32. package/server/Authenticator.js.map +1 -1
  33. package/server/Authenticator.mjs +285 -211
  34. package/server/Customer.d.ts.map +1 -1
  35. package/server/Customer.js.map +1 -1
  36. package/server/Customer.mjs +268 -190
  37. package/server/NewsArticle.d.ts.map +1 -1
  38. package/server/NewsArticle.js.map +1 -1
  39. package/server/NewsArticle.mjs +233 -212
  40. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  41. package/server/NewsArticleAssetSentiment.js.map +1 -1
  42. package/server/NewsArticleAssetSentiment.mjs +354 -290
  43. package/server/Order.d.ts.map +1 -1
  44. package/server/Order.js.map +1 -1
  45. package/server/Order.mjs +694 -541
  46. package/server/Position.d.ts.map +1 -1
  47. package/server/Position.js.map +1 -1
  48. package/server/Position.mjs +621 -488
  49. package/server/Session.d.ts.map +1 -1
  50. package/server/Session.js.map +1 -1
  51. package/server/Session.mjs +288 -214
  52. package/server/Trade.d.ts.map +1 -1
  53. package/server/Trade.js.map +1 -1
  54. package/server/Trade.mjs +767 -613
  55. package/server/User.d.ts.map +1 -1
  56. package/server/User.js.map +1 -1
  57. package/server/User.mjs +410 -309
package/AlpacaAccount.cjs CHANGED
@@ -300,393 +300,471 @@ exports.AlpacaAccount = {
300
300
  APISecret: props.APISecret !== undefined ? props.APISecret : undefined,
301
301
  configuration: props.configuration !== undefined ? props.configuration : undefined,
302
302
  marketOpen: props.marketOpen !== undefined ? props.marketOpen : undefined,
303
- user: props.user ? {
304
- connectOrCreate: {
305
- where: {
306
- id: props.user.id !== undefined ? props.user.id : undefined,
307
- email: props.user.email !== undefined ? props.user.email : undefined,
308
- name: props.user.name !== undefined ? {
309
- equals: props.user.name
310
- } : undefined,
311
- },
312
- create: {
313
- name: props.user.name !== undefined ? props.user.name : undefined,
314
- email: props.user.email !== undefined ? props.user.email : undefined,
315
- emailVerified: props.user.emailVerified !== undefined ? props.user.emailVerified : undefined,
316
- image: props.user.image !== undefined ? props.user.image : undefined,
317
- role: props.user.role !== undefined ? props.user.role : undefined,
318
- bio: props.user.bio !== undefined ? props.user.bio : undefined,
319
- jobTitle: props.user.jobTitle !== undefined ? props.user.jobTitle : undefined,
320
- currentAccount: props.user.currentAccount !== undefined ? props.user.currentAccount : undefined,
321
- plan: props.user.plan !== undefined ? props.user.plan : undefined,
322
- customer: props.user.customer ? {
323
- connectOrCreate: {
324
- where: {
325
- id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
326
- name: props.user.customer.name !== undefined ? {
327
- equals: props.user.customer.name
328
- } : undefined,
329
- },
330
- create: {
331
- authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
332
- name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
333
- plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
334
- stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
335
- stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
336
- stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
337
- stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
338
- },
339
- }
340
- } : undefined,
341
- accounts: props.user.accounts ? {
342
- connectOrCreate: props.user.accounts.map((item) => ({
343
- where: {
344
- id: item.id !== undefined ? item.id : undefined,
345
- },
346
- create: {
347
- type: item.type !== undefined ? item.type : undefined,
348
- provider: item.provider !== undefined ? item.provider : undefined,
349
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
350
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
351
- access_token: item.access_token !== undefined ? item.access_token : undefined,
352
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
353
- token_type: item.token_type !== undefined ? item.token_type : undefined,
354
- scope: item.scope !== undefined ? item.scope : undefined,
355
- id_token: item.id_token !== undefined ? item.id_token : undefined,
356
- session_state: item.session_state !== undefined ? item.session_state : undefined,
357
- },
358
- }))
359
- } : undefined,
360
- sessions: props.user.sessions ? {
361
- connectOrCreate: props.user.sessions.map((item) => ({
362
- where: {
363
- id: item.id !== undefined ? item.id : undefined,
364
- },
365
- create: {
366
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
367
- expires: item.expires !== undefined ? item.expires : undefined,
368
- },
369
- }))
370
- } : undefined,
371
- authenticators: props.user.authenticators ? {
372
- connectOrCreate: props.user.authenticators.map((item) => ({
373
- where: {
374
- id: item.id !== undefined ? item.id : undefined,
375
- },
376
- create: {
377
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
378
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
379
- counter: item.counter !== undefined ? item.counter : undefined,
380
- },
381
- }))
382
- } : undefined,
383
- },
384
- }
385
- } : undefined,
386
- trades: props.trades ? {
387
- connectOrCreate: props.trades.map((item) => ({
388
- where: {
389
- id: item.id !== undefined ? item.id : undefined,
390
- },
391
- create: {
392
- qty: item.qty !== undefined ? item.qty : undefined,
393
- price: item.price !== undefined ? item.price : undefined,
394
- total: item.total !== undefined ? item.total : undefined,
395
- signal: item.signal !== undefined ? item.signal : undefined,
396
- strategy: item.strategy !== undefined ? item.strategy : undefined,
397
- analysis: item.analysis !== undefined ? item.analysis : undefined,
398
- confidence: item.confidence !== undefined ? item.confidence : undefined,
399
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
400
- status: item.status !== undefined ? item.status : undefined,
401
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
402
- asset: item.asset ? {
403
- connectOrCreate: {
404
- where: {
405
- id: item.asset.id !== undefined ? item.asset.id : undefined,
406
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
407
- name: item.asset.name !== undefined ? item.asset.name : undefined,
408
- },
409
- create: {
410
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
411
- name: item.asset.name !== undefined ? item.asset.name : undefined,
412
- type: item.asset.type !== undefined ? item.asset.type : undefined,
413
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
414
- description: item.asset.description !== undefined ? item.asset.description : undefined,
415
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
416
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
417
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
418
- country: item.asset.country !== undefined ? item.asset.country : undefined,
419
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
420
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
421
- address: item.asset.address !== undefined ? item.asset.address : undefined,
422
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
423
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
424
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
425
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
426
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
427
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
428
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
429
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
430
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
431
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
432
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
433
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
434
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
435
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
436
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
437
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
438
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
439
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
440
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
441
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
442
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
443
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
444
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
445
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
446
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
447
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
448
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
449
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
450
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
451
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
452
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
453
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
454
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
455
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
456
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
457
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
458
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
459
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
460
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
461
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
462
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
463
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
464
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
465
- },
466
- }
467
- } : undefined,
468
- actions: item.actions ? {
469
- connectOrCreate: item.actions.map((item) => ({
470
- where: {
471
- id: item.id !== undefined ? item.id : undefined,
472
- },
473
- create: {
474
- sequence: item.sequence !== undefined ? item.sequence : undefined,
475
- type: item.type !== undefined ? item.type : undefined,
476
- note: item.note !== undefined ? item.note : undefined,
477
- status: item.status !== undefined ? item.status : undefined,
478
- fee: item.fee !== undefined ? item.fee : undefined,
479
- },
480
- }))
481
- } : undefined,
482
- },
483
- }))
484
- } : undefined,
485
- orders: props.orders ? {
486
- connectOrCreate: props.orders.map((item) => ({
487
- where: {
488
- id: item.id !== undefined ? item.id : undefined,
489
- },
490
- create: {
491
- qty: item.qty !== undefined ? item.qty : undefined,
492
- notional: item.notional !== undefined ? item.notional : undefined,
493
- side: item.side !== undefined ? item.side : undefined,
494
- type: item.type !== undefined ? item.type : undefined,
495
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
496
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
497
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
498
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
499
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
500
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
501
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
502
- status: item.status !== undefined ? item.status : undefined,
503
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
504
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
505
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
506
- fee: item.fee !== undefined ? item.fee : undefined,
507
- action: item.action ? {
508
- connectOrCreate: {
509
- where: {
510
- id: item.action.id !== undefined ? item.action.id : undefined,
511
- },
512
- create: {
513
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
514
- type: item.action.type !== undefined ? item.action.type : undefined,
515
- note: item.action.note !== undefined ? item.action.note : undefined,
516
- status: item.action.status !== undefined ? item.action.status : undefined,
517
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
518
- },
519
- }
520
- } : undefined,
521
- asset: item.asset ? {
522
- connectOrCreate: {
523
- where: {
524
- id: item.asset.id !== undefined ? item.asset.id : undefined,
525
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
526
- name: item.asset.name !== undefined ? item.asset.name : undefined,
527
- },
528
- create: {
529
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
530
- name: item.asset.name !== undefined ? item.asset.name : undefined,
531
- type: item.asset.type !== undefined ? item.asset.type : undefined,
532
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
533
- description: item.asset.description !== undefined ? item.asset.description : undefined,
534
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
535
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
536
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
537
- country: item.asset.country !== undefined ? item.asset.country : undefined,
538
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
539
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
540
- address: item.asset.address !== undefined ? item.asset.address : undefined,
541
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
542
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
543
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
544
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
545
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
546
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
547
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
548
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
549
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
550
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
551
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
552
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
553
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
554
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
555
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
556
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
557
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
558
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
559
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
560
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
561
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
562
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
563
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
564
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
565
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
566
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
567
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
568
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
569
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
570
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
571
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
572
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
573
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
574
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
575
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
576
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
577
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
578
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
579
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
580
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
581
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
582
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
583
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
584
- },
585
- }
586
- } : undefined,
587
- },
588
- }))
589
- } : undefined,
590
- positions: props.positions ? {
591
- connectOrCreate: props.positions.map((item) => ({
592
- where: {
593
- id: item.id !== undefined ? item.id : undefined,
594
- },
595
- create: {
596
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
597
- qty: item.qty !== undefined ? item.qty : undefined,
598
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
599
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
600
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
601
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
602
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
603
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
604
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
605
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
606
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
607
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
608
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
609
- asset: item.asset ? {
610
- connectOrCreate: {
611
- where: {
612
- id: item.asset.id !== undefined ? item.asset.id : undefined,
613
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
614
- name: item.asset.name !== undefined ? item.asset.name : undefined,
615
- },
616
- create: {
617
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
618
- name: item.asset.name !== undefined ? item.asset.name : undefined,
619
- type: item.asset.type !== undefined ? item.asset.type : undefined,
620
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
621
- description: item.asset.description !== undefined ? item.asset.description : undefined,
622
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
623
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
624
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
625
- country: item.asset.country !== undefined ? item.asset.country : undefined,
626
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
627
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
628
- address: item.asset.address !== undefined ? item.asset.address : undefined,
629
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
630
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
631
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
632
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
633
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
634
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
635
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
636
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
637
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
638
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
639
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
640
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
641
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
642
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
643
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
644
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
645
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
646
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
647
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
648
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
649
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
650
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
651
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
652
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
653
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
654
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
655
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
656
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
657
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
658
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
659
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
660
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
661
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
662
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
663
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
664
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
665
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
666
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
667
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
668
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
669
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
670
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
671
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
672
- },
673
- }
674
- } : undefined,
675
- },
676
- }))
677
- } : undefined,
678
- alerts: props.alerts ? {
679
- connectOrCreate: props.alerts.map((item) => ({
680
- where: {
681
- id: item.id !== undefined ? item.id : undefined,
682
- },
683
- create: {
684
- message: item.message !== undefined ? item.message : undefined,
685
- type: item.type !== undefined ? item.type : undefined,
686
- isRead: item.isRead !== undefined ? item.isRead : undefined,
687
- },
688
- }))
689
- } : undefined,
303
+ user: props.user ?
304
+ typeof props.user === 'object' && Object.keys(props.user).length === 1 && Object.keys(props.user)[0] === 'id'
305
+ ? { connect: {
306
+ id: props.user.id
307
+ }
308
+ }
309
+ : { connectOrCreate: {
310
+ where: {
311
+ id: props.user.id !== undefined ? props.user.id : undefined,
312
+ email: props.user.email !== undefined ? props.user.email : undefined,
313
+ name: props.user.name !== undefined ? {
314
+ equals: props.user.name
315
+ } : undefined,
316
+ },
317
+ create: {
318
+ name: props.user.name !== undefined ? props.user.name : undefined,
319
+ email: props.user.email !== undefined ? props.user.email : undefined,
320
+ emailVerified: props.user.emailVerified !== undefined ? props.user.emailVerified : undefined,
321
+ image: props.user.image !== undefined ? props.user.image : undefined,
322
+ role: props.user.role !== undefined ? props.user.role : undefined,
323
+ bio: props.user.bio !== undefined ? props.user.bio : undefined,
324
+ jobTitle: props.user.jobTitle !== undefined ? props.user.jobTitle : undefined,
325
+ currentAccount: props.user.currentAccount !== undefined ? props.user.currentAccount : undefined,
326
+ plan: props.user.plan !== undefined ? props.user.plan : undefined,
327
+ customer: props.user.customer ?
328
+ typeof props.user.customer === 'object' && Object.keys(props.user.customer).length === 1 && Object.keys(props.user.customer)[0] === 'id'
329
+ ? { connect: {
330
+ id: props.user.customer.id
331
+ }
332
+ }
333
+ : { connectOrCreate: {
334
+ where: {
335
+ id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
336
+ name: props.user.customer.name !== undefined ? {
337
+ equals: props.user.customer.name
338
+ } : undefined,
339
+ },
340
+ create: {
341
+ authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
342
+ name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
343
+ plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
344
+ stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
345
+ stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
346
+ stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
347
+ stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
348
+ },
349
+ }
350
+ } : undefined,
351
+ accounts: props.user.accounts ?
352
+ Array.isArray(props.user.accounts) && props.user.accounts.length > 0
353
+ ? props.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
354
+ connect: props.user.accounts.map((item) => ({
355
+ id: item.id
356
+ }))
357
+ }
358
+ : { connectOrCreate: props.user.accounts.map((item) => ({
359
+ where: {
360
+ id: item.id !== undefined ? item.id : undefined,
361
+ },
362
+ create: {
363
+ type: item.type !== undefined ? item.type : undefined,
364
+ provider: item.provider !== undefined ? item.provider : undefined,
365
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
366
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
367
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
368
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
369
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
370
+ scope: item.scope !== undefined ? item.scope : undefined,
371
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
372
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
373
+ },
374
+ }))
375
+ } : undefined,
376
+ sessions: props.user.sessions ?
377
+ Array.isArray(props.user.sessions) && props.user.sessions.length > 0
378
+ ? props.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
379
+ connect: props.user.sessions.map((item) => ({
380
+ id: item.id
381
+ }))
382
+ }
383
+ : { connectOrCreate: props.user.sessions.map((item) => ({
384
+ where: {
385
+ id: item.id !== undefined ? item.id : undefined,
386
+ },
387
+ create: {
388
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
389
+ expires: item.expires !== undefined ? item.expires : undefined,
390
+ },
391
+ }))
392
+ } : undefined,
393
+ authenticators: props.user.authenticators ?
394
+ Array.isArray(props.user.authenticators) && props.user.authenticators.length > 0
395
+ ? props.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
396
+ connect: props.user.authenticators.map((item) => ({
397
+ id: item.id
398
+ }))
399
+ }
400
+ : { connectOrCreate: props.user.authenticators.map((item) => ({
401
+ where: {
402
+ id: item.id !== undefined ? item.id : undefined,
403
+ },
404
+ create: {
405
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
406
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
407
+ counter: item.counter !== undefined ? item.counter : undefined,
408
+ },
409
+ }))
410
+ } : undefined,
411
+ },
412
+ }
413
+ } : undefined,
414
+ trades: props.trades ?
415
+ Array.isArray(props.trades) && props.trades.length > 0
416
+ ? props.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
417
+ connect: props.trades.map((item) => ({
418
+ id: item.id
419
+ }))
420
+ }
421
+ : { connectOrCreate: props.trades.map((item) => ({
422
+ where: {
423
+ id: item.id !== undefined ? item.id : undefined,
424
+ },
425
+ create: {
426
+ qty: item.qty !== undefined ? item.qty : undefined,
427
+ price: item.price !== undefined ? item.price : undefined,
428
+ total: item.total !== undefined ? item.total : undefined,
429
+ signal: item.signal !== undefined ? item.signal : undefined,
430
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
431
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
432
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
433
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
434
+ status: item.status !== undefined ? item.status : undefined,
435
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
436
+ asset: item.asset ?
437
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
438
+ ? { connect: {
439
+ id: item.asset.id
440
+ }
441
+ }
442
+ : { connectOrCreate: {
443
+ where: {
444
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
445
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
446
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
447
+ },
448
+ create: {
449
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
450
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
451
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
452
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
453
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
454
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
455
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
456
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
457
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
458
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
459
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
460
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
461
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
462
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
463
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
464
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
465
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
466
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
467
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
468
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
469
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
470
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
471
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
472
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
473
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
474
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
475
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
476
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
477
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
478
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
479
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
480
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
481
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
482
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
483
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
484
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
485
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
486
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
487
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
488
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
489
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
490
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
491
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
492
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
493
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
494
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
495
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
496
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
497
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
498
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
499
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
500
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
501
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
502
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
503
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
504
+ },
505
+ }
506
+ } : undefined,
507
+ actions: item.actions ?
508
+ Array.isArray(item.actions) && item.actions.length > 0
509
+ ? item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
510
+ connect: item.actions.map((item) => ({
511
+ id: item.id
512
+ }))
513
+ }
514
+ : { connectOrCreate: item.actions.map((item) => ({
515
+ where: {
516
+ id: item.id !== undefined ? item.id : undefined,
517
+ },
518
+ create: {
519
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
520
+ type: item.type !== undefined ? item.type : undefined,
521
+ note: item.note !== undefined ? item.note : undefined,
522
+ status: item.status !== undefined ? item.status : undefined,
523
+ fee: item.fee !== undefined ? item.fee : undefined,
524
+ },
525
+ }))
526
+ } : undefined,
527
+ },
528
+ }))
529
+ } : undefined,
530
+ orders: props.orders ?
531
+ Array.isArray(props.orders) && props.orders.length > 0
532
+ ? props.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
533
+ connect: props.orders.map((item) => ({
534
+ id: item.id
535
+ }))
536
+ }
537
+ : { connectOrCreate: props.orders.map((item) => ({
538
+ where: {
539
+ id: item.id !== undefined ? item.id : undefined,
540
+ },
541
+ create: {
542
+ qty: item.qty !== undefined ? item.qty : undefined,
543
+ notional: item.notional !== undefined ? item.notional : undefined,
544
+ side: item.side !== undefined ? item.side : undefined,
545
+ type: item.type !== undefined ? item.type : undefined,
546
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
547
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
548
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
549
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
550
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
551
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
552
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
553
+ status: item.status !== undefined ? item.status : undefined,
554
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
555
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
556
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
557
+ fee: item.fee !== undefined ? item.fee : undefined,
558
+ action: item.action ?
559
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
560
+ ? { connect: {
561
+ id: item.action.id
562
+ }
563
+ }
564
+ : { connectOrCreate: {
565
+ where: {
566
+ id: item.action.id !== undefined ? item.action.id : undefined,
567
+ },
568
+ create: {
569
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
570
+ type: item.action.type !== undefined ? item.action.type : undefined,
571
+ note: item.action.note !== undefined ? item.action.note : undefined,
572
+ status: item.action.status !== undefined ? item.action.status : undefined,
573
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
574
+ },
575
+ }
576
+ } : undefined,
577
+ asset: item.asset ?
578
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
579
+ ? { connect: {
580
+ id: item.asset.id
581
+ }
582
+ }
583
+ : { connectOrCreate: {
584
+ where: {
585
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
586
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
587
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
588
+ },
589
+ create: {
590
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
591
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
592
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
593
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
594
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
595
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
596
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
597
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
598
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
599
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
600
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
601
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
602
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
603
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
604
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
605
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
606
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
607
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
608
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
609
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
610
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
611
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
612
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
613
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
614
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
615
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
616
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
617
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
618
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
619
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
620
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
621
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
622
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
623
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
624
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
625
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
626
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
627
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
628
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
629
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
630
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
631
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
632
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
633
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
634
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
635
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
636
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
637
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
638
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
639
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
640
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
641
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
642
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
643
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
644
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
645
+ },
646
+ }
647
+ } : undefined,
648
+ },
649
+ }))
650
+ } : undefined,
651
+ positions: props.positions ?
652
+ Array.isArray(props.positions) && props.positions.length > 0
653
+ ? props.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
654
+ connect: props.positions.map((item) => ({
655
+ id: item.id
656
+ }))
657
+ }
658
+ : { connectOrCreate: props.positions.map((item) => ({
659
+ where: {
660
+ id: item.id !== undefined ? item.id : undefined,
661
+ },
662
+ create: {
663
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
664
+ qty: item.qty !== undefined ? item.qty : undefined,
665
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
666
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
667
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
668
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
669
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
670
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
671
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
672
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
673
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
674
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
675
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
676
+ asset: item.asset ?
677
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
678
+ ? { connect: {
679
+ id: item.asset.id
680
+ }
681
+ }
682
+ : { connectOrCreate: {
683
+ where: {
684
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
685
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
686
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
687
+ },
688
+ create: {
689
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
690
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
691
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
692
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
693
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
694
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
695
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
696
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
697
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
698
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
699
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
700
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
701
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
702
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
703
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
704
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
705
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
706
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
707
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
708
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
709
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
710
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
711
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
712
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
713
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
714
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
715
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
716
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
717
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
718
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
719
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
720
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
721
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
722
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
723
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
724
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
725
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
726
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
727
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
728
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
729
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
730
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
731
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
732
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
733
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
734
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
735
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
736
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
737
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
738
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
739
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
740
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
741
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
742
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
743
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
744
+ },
745
+ }
746
+ } : undefined,
747
+ },
748
+ }))
749
+ } : undefined,
750
+ alerts: props.alerts ?
751
+ Array.isArray(props.alerts) && props.alerts.length > 0
752
+ ? props.alerts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
753
+ connect: props.alerts.map((item) => ({
754
+ id: item.id
755
+ }))
756
+ }
757
+ : { connectOrCreate: props.alerts.map((item) => ({
758
+ where: {
759
+ id: item.id !== undefined ? item.id : undefined,
760
+ },
761
+ create: {
762
+ message: item.message !== undefined ? item.message : undefined,
763
+ type: item.type !== undefined ? item.type : undefined,
764
+ isRead: item.isRead !== undefined ? item.isRead : undefined,
765
+ },
766
+ }))
767
+ } : undefined,
690
768
  },
691
769
  };
692
770
  const filteredVariables = (0, utils_1.removeUndefinedProps)(variables);
@@ -1260,67 +1338,90 @@ exports.AlpacaAccount = {
1260
1338
  jobTitle: props.user.jobTitle !== undefined ? props.user.jobTitle : undefined,
1261
1339
  currentAccount: props.user.currentAccount !== undefined ? props.user.currentAccount : undefined,
1262
1340
  plan: props.user.plan !== undefined ? props.user.plan : undefined,
1263
- customer: props.user.customer ? {
1264
- connectOrCreate: {
1265
- where: {
1266
- id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
1267
- name: props.user.customer.name !== undefined ? {
1268
- equals: props.user.customer.name
1269
- } : undefined,
1270
- },
1271
- create: {
1272
- authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
1273
- name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
1274
- plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
1275
- stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
1276
- stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
1277
- stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
1278
- stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
1279
- },
1280
- }
1281
- } : undefined,
1282
- accounts: props.user.accounts ? {
1283
- connectOrCreate: props.user.accounts.map((item) => ({
1284
- where: {
1285
- id: item.id !== undefined ? item.id : undefined,
1286
- },
1287
- create: {
1288
- type: item.type !== undefined ? item.type : undefined,
1289
- provider: item.provider !== undefined ? item.provider : undefined,
1290
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
1291
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
1292
- access_token: item.access_token !== undefined ? item.access_token : undefined,
1293
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
1294
- token_type: item.token_type !== undefined ? item.token_type : undefined,
1295
- scope: item.scope !== undefined ? item.scope : undefined,
1296
- id_token: item.id_token !== undefined ? item.id_token : undefined,
1297
- session_state: item.session_state !== undefined ? item.session_state : undefined,
1298
- },
1299
- }))
1300
- } : undefined,
1301
- sessions: props.user.sessions ? {
1302
- connectOrCreate: props.user.sessions.map((item) => ({
1303
- where: {
1304
- id: item.id !== undefined ? item.id : undefined,
1305
- },
1306
- create: {
1307
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
1308
- expires: item.expires !== undefined ? item.expires : undefined,
1309
- },
1310
- }))
1311
- } : undefined,
1312
- authenticators: props.user.authenticators ? {
1313
- connectOrCreate: props.user.authenticators.map((item) => ({
1314
- where: {
1315
- id: item.id !== undefined ? item.id : undefined,
1316
- },
1317
- create: {
1318
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
1319
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
1320
- counter: item.counter !== undefined ? item.counter : undefined,
1321
- },
1322
- }))
1323
- } : undefined,
1341
+ customer: props.user.customer ?
1342
+ typeof props.user.customer === 'object' && Object.keys(props.user.customer).length === 1 && Object.keys(props.user.customer)[0] === 'id'
1343
+ ? { connect: {
1344
+ id: props.user.customer.id
1345
+ }
1346
+ }
1347
+ : { connectOrCreate: {
1348
+ where: {
1349
+ id: props.user.customer.id !== undefined ? props.user.customer.id : undefined,
1350
+ name: props.user.customer.name !== undefined ? {
1351
+ equals: props.user.customer.name
1352
+ } : undefined,
1353
+ },
1354
+ create: {
1355
+ authUserId: props.user.customer.authUserId !== undefined ? props.user.customer.authUserId : undefined,
1356
+ name: props.user.customer.name !== undefined ? props.user.customer.name : undefined,
1357
+ plan: props.user.customer.plan !== undefined ? props.user.customer.plan : undefined,
1358
+ stripeCustomerId: props.user.customer.stripeCustomerId !== undefined ? props.user.customer.stripeCustomerId : undefined,
1359
+ stripeSubscriptionId: props.user.customer.stripeSubscriptionId !== undefined ? props.user.customer.stripeSubscriptionId : undefined,
1360
+ stripePriceId: props.user.customer.stripePriceId !== undefined ? props.user.customer.stripePriceId : undefined,
1361
+ stripeCurrentPeriodEnd: props.user.customer.stripeCurrentPeriodEnd !== undefined ? props.user.customer.stripeCurrentPeriodEnd : undefined,
1362
+ },
1363
+ }
1364
+ } : undefined,
1365
+ accounts: props.user.accounts ?
1366
+ Array.isArray(props.user.accounts) && props.user.accounts.length > 0
1367
+ ? props.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1368
+ connect: props.user.accounts.map((item) => ({
1369
+ id: item.id
1370
+ }))
1371
+ }
1372
+ : { connectOrCreate: props.user.accounts.map((item) => ({
1373
+ where: {
1374
+ id: item.id !== undefined ? item.id : undefined,
1375
+ },
1376
+ create: {
1377
+ type: item.type !== undefined ? item.type : undefined,
1378
+ provider: item.provider !== undefined ? item.provider : undefined,
1379
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
1380
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
1381
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
1382
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
1383
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
1384
+ scope: item.scope !== undefined ? item.scope : undefined,
1385
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
1386
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
1387
+ },
1388
+ }))
1389
+ } : undefined,
1390
+ sessions: props.user.sessions ?
1391
+ Array.isArray(props.user.sessions) && props.user.sessions.length > 0
1392
+ ? props.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1393
+ connect: props.user.sessions.map((item) => ({
1394
+ id: item.id
1395
+ }))
1396
+ }
1397
+ : { connectOrCreate: props.user.sessions.map((item) => ({
1398
+ where: {
1399
+ id: item.id !== undefined ? item.id : undefined,
1400
+ },
1401
+ create: {
1402
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
1403
+ expires: item.expires !== undefined ? item.expires : undefined,
1404
+ },
1405
+ }))
1406
+ } : undefined,
1407
+ authenticators: props.user.authenticators ?
1408
+ Array.isArray(props.user.authenticators) && props.user.authenticators.length > 0
1409
+ ? props.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1410
+ connect: props.user.authenticators.map((item) => ({
1411
+ id: item.id
1412
+ }))
1413
+ }
1414
+ : { connectOrCreate: props.user.authenticators.map((item) => ({
1415
+ where: {
1416
+ id: item.id !== undefined ? item.id : undefined,
1417
+ },
1418
+ create: {
1419
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
1420
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
1421
+ counter: item.counter !== undefined ? item.counter : undefined,
1422
+ },
1423
+ }))
1424
+ } : undefined,
1324
1425
  },
1325
1426
  }
1326
1427
  } : undefined,
@@ -1620,107 +1721,15 @@ exports.AlpacaAccount = {
1620
1721
  type: item.type !== undefined ? {
1621
1722
  set: item.type
1622
1723
  } : undefined,
1623
- note: item.note !== undefined ? {
1624
- set: item.note
1625
- } : undefined,
1626
- status: item.status !== undefined ? {
1627
- set: item.status
1628
- } : undefined,
1629
- fee: item.fee !== undefined ? {
1630
- set: item.fee
1631
- } : undefined,
1632
- },
1633
- create: {
1634
- sequence: item.sequence !== undefined ? item.sequence : undefined,
1635
- type: item.type !== undefined ? item.type : undefined,
1636
- note: item.note !== undefined ? item.note : undefined,
1637
- status: item.status !== undefined ? item.status : undefined,
1638
- fee: item.fee !== undefined ? item.fee : undefined,
1639
- },
1640
- }))
1641
- } : undefined,
1642
- },
1643
- create: {
1644
- qty: item.qty !== undefined ? item.qty : undefined,
1645
- price: item.price !== undefined ? item.price : undefined,
1646
- total: item.total !== undefined ? item.total : undefined,
1647
- signal: item.signal !== undefined ? item.signal : undefined,
1648
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1649
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1650
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1651
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1652
- status: item.status !== undefined ? item.status : undefined,
1653
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1654
- asset: item.asset ? {
1655
- connectOrCreate: {
1656
- where: {
1657
- id: item.asset.id !== undefined ? item.asset.id : undefined,
1658
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1659
- name: item.asset.name !== undefined ? item.asset.name : undefined,
1660
- },
1661
- create: {
1662
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1663
- name: item.asset.name !== undefined ? item.asset.name : undefined,
1664
- type: item.asset.type !== undefined ? item.asset.type : undefined,
1665
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
1666
- description: item.asset.description !== undefined ? item.asset.description : undefined,
1667
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
1668
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
1669
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
1670
- country: item.asset.country !== undefined ? item.asset.country : undefined,
1671
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
1672
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
1673
- address: item.asset.address !== undefined ? item.asset.address : undefined,
1674
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
1675
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
1676
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
1677
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
1678
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
1679
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
1680
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
1681
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
1682
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
1683
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
1684
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
1685
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
1686
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
1687
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
1688
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
1689
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
1690
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
1691
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
1692
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
1693
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
1694
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
1695
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
1696
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
1697
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
1698
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
1699
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
1700
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
1701
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
1702
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
1703
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
1704
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
1705
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
1706
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
1707
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
1708
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
1709
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
1710
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
1711
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
1712
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
1713
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
1714
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
1715
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
1716
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
1717
- },
1718
- }
1719
- } : undefined,
1720
- actions: item.actions ? {
1721
- connectOrCreate: item.actions.map((item) => ({
1722
- where: {
1723
- id: item.id !== undefined ? item.id : undefined,
1724
+ note: item.note !== undefined ? {
1725
+ set: item.note
1726
+ } : undefined,
1727
+ status: item.status !== undefined ? {
1728
+ set: item.status
1729
+ } : undefined,
1730
+ fee: item.fee !== undefined ? {
1731
+ set: item.fee
1732
+ } : undefined,
1724
1733
  },
1725
1734
  create: {
1726
1735
  sequence: item.sequence !== undefined ? item.sequence : undefined,
@@ -1732,6 +1741,109 @@ exports.AlpacaAccount = {
1732
1741
  }))
1733
1742
  } : undefined,
1734
1743
  },
1744
+ create: {
1745
+ qty: item.qty !== undefined ? item.qty : undefined,
1746
+ price: item.price !== undefined ? item.price : undefined,
1747
+ total: item.total !== undefined ? item.total : undefined,
1748
+ signal: item.signal !== undefined ? item.signal : undefined,
1749
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1750
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1751
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1752
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1753
+ status: item.status !== undefined ? item.status : undefined,
1754
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1755
+ asset: item.asset ?
1756
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
1757
+ ? { connect: {
1758
+ id: item.asset.id
1759
+ }
1760
+ }
1761
+ : { connectOrCreate: {
1762
+ where: {
1763
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
1764
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1765
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
1766
+ },
1767
+ create: {
1768
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
1769
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
1770
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
1771
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
1772
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
1773
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
1774
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
1775
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
1776
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
1777
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
1778
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
1779
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
1780
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
1781
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
1782
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
1783
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
1784
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
1785
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
1786
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
1787
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
1788
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
1789
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
1790
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
1791
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
1792
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
1793
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
1794
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
1795
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
1796
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
1797
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
1798
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
1799
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
1800
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
1801
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
1802
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
1803
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
1804
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
1805
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
1806
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
1807
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
1808
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
1809
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
1810
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
1811
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
1812
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
1813
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
1814
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
1815
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
1816
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
1817
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
1818
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
1819
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
1820
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
1821
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
1822
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
1823
+ },
1824
+ }
1825
+ } : undefined,
1826
+ actions: item.actions ?
1827
+ Array.isArray(item.actions) && item.actions.length > 0
1828
+ ? item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1829
+ connect: item.actions.map((item) => ({
1830
+ id: item.id
1831
+ }))
1832
+ }
1833
+ : { connectOrCreate: item.actions.map((item) => ({
1834
+ where: {
1835
+ id: item.id !== undefined ? item.id : undefined,
1836
+ },
1837
+ create: {
1838
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
1839
+ type: item.type !== undefined ? item.type : undefined,
1840
+ note: item.note !== undefined ? item.note : undefined,
1841
+ status: item.status !== undefined ? item.status : undefined,
1842
+ fee: item.fee !== undefined ? item.fee : undefined,
1843
+ },
1844
+ }))
1845
+ } : undefined,
1846
+ },
1735
1847
  }))
1736
1848
  } : undefined,
1737
1849
  orders: props.orders ? {
@@ -2087,86 +2199,96 @@ exports.AlpacaAccount = {
2087
2199
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
2088
2200
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
2089
2201
  fee: item.fee !== undefined ? item.fee : undefined,
2090
- action: item.action ? {
2091
- connectOrCreate: {
2092
- where: {
2093
- id: item.action.id !== undefined ? item.action.id : undefined,
2094
- },
2095
- create: {
2096
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2097
- type: item.action.type !== undefined ? item.action.type : undefined,
2098
- note: item.action.note !== undefined ? item.action.note : undefined,
2099
- status: item.action.status !== undefined ? item.action.status : undefined,
2100
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
2101
- },
2102
- }
2103
- } : undefined,
2104
- asset: item.asset ? {
2105
- connectOrCreate: {
2106
- where: {
2107
- id: item.asset.id !== undefined ? item.asset.id : undefined,
2108
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2109
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2110
- },
2111
- create: {
2112
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2113
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2114
- type: item.asset.type !== undefined ? item.asset.type : undefined,
2115
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2116
- description: item.asset.description !== undefined ? item.asset.description : undefined,
2117
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2118
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2119
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2120
- country: item.asset.country !== undefined ? item.asset.country : undefined,
2121
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2122
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2123
- address: item.asset.address !== undefined ? item.asset.address : undefined,
2124
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2125
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2126
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2127
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2128
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2129
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2130
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2131
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2132
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2133
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2134
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2135
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2136
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2137
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2138
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2139
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2140
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2141
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2142
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2143
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2144
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2145
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2146
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2147
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2148
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2149
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2150
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2151
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2152
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2153
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2154
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2155
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2156
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2157
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2158
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2159
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2160
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2161
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2162
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2163
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2164
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2165
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2166
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2167
- },
2168
- }
2169
- } : undefined,
2202
+ action: item.action ?
2203
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
2204
+ ? { connect: {
2205
+ id: item.action.id
2206
+ }
2207
+ }
2208
+ : { connectOrCreate: {
2209
+ where: {
2210
+ id: item.action.id !== undefined ? item.action.id : undefined,
2211
+ },
2212
+ create: {
2213
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
2214
+ type: item.action.type !== undefined ? item.action.type : undefined,
2215
+ note: item.action.note !== undefined ? item.action.note : undefined,
2216
+ status: item.action.status !== undefined ? item.action.status : undefined,
2217
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
2218
+ },
2219
+ }
2220
+ } : undefined,
2221
+ asset: item.asset ?
2222
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
2223
+ ? { connect: {
2224
+ id: item.asset.id
2225
+ }
2226
+ }
2227
+ : { connectOrCreate: {
2228
+ where: {
2229
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
2230
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2231
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2232
+ },
2233
+ create: {
2234
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2235
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2236
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
2237
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2238
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
2239
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2240
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2241
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2242
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
2243
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2244
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2245
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
2246
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2247
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2248
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2249
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2250
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2251
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2252
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2253
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2254
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2255
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2256
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2257
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2258
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2259
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2260
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2261
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2262
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2263
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2264
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2265
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2266
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2267
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2268
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2269
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2270
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2271
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2272
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2273
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2274
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2275
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2276
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2277
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2278
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2279
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2280
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2281
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2282
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2283
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2284
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2285
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2286
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2287
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2288
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2289
+ },
2290
+ }
2291
+ } : undefined,
2170
2292
  },
2171
2293
  }))
2172
2294
  } : undefined,
@@ -2475,72 +2597,77 @@ exports.AlpacaAccount = {
2475
2597
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
2476
2598
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
2477
2599
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
2478
- asset: item.asset ? {
2479
- connectOrCreate: {
2480
- where: {
2481
- id: item.asset.id !== undefined ? item.asset.id : undefined,
2482
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2483
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2484
- },
2485
- create: {
2486
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2487
- name: item.asset.name !== undefined ? item.asset.name : undefined,
2488
- type: item.asset.type !== undefined ? item.asset.type : undefined,
2489
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2490
- description: item.asset.description !== undefined ? item.asset.description : undefined,
2491
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2492
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2493
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2494
- country: item.asset.country !== undefined ? item.asset.country : undefined,
2495
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2496
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2497
- address: item.asset.address !== undefined ? item.asset.address : undefined,
2498
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2499
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2500
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2501
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2502
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2503
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2504
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2505
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2506
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2507
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2508
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2509
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2510
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2511
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2512
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2513
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2514
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2515
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2516
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2517
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2518
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2519
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2520
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2521
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2522
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2523
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2524
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2525
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2526
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2527
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2528
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2529
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2530
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2531
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2532
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2533
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2534
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2535
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2536
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2537
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2538
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2539
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2540
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2541
- },
2542
- }
2543
- } : undefined,
2600
+ asset: item.asset ?
2601
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
2602
+ ? { connect: {
2603
+ id: item.asset.id
2604
+ }
2605
+ }
2606
+ : { connectOrCreate: {
2607
+ where: {
2608
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
2609
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2610
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2611
+ },
2612
+ create: {
2613
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
2614
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
2615
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
2616
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
2617
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
2618
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
2619
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
2620
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
2621
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
2622
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
2623
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
2624
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
2625
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
2626
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
2627
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
2628
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
2629
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
2630
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
2631
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
2632
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
2633
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
2634
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
2635
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
2636
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
2637
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
2638
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
2639
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
2640
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
2641
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
2642
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
2643
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
2644
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
2645
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
2646
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
2647
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
2648
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
2649
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
2650
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
2651
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
2652
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
2653
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
2654
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
2655
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
2656
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
2657
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
2658
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
2659
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
2660
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
2661
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
2662
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
2663
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
2664
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
2665
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
2666
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
2667
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
2668
+ },
2669
+ }
2670
+ } : undefined,
2544
2671
  },
2545
2672
  }))
2546
2673
  } : undefined,
@@ -2757,104 +2884,7 @@ exports.AlpacaAccount = {
2757
2884
  } : undefined,
2758
2885
  session_state: item.session_state !== undefined ? {
2759
2886
  set: item.session_state
2760
- } : undefined,
2761
- },
2762
- create: {
2763
- type: item.type !== undefined ? item.type : undefined,
2764
- provider: item.provider !== undefined ? item.provider : undefined,
2765
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
2766
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
2767
- access_token: item.access_token !== undefined ? item.access_token : undefined,
2768
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
2769
- token_type: item.token_type !== undefined ? item.token_type : undefined,
2770
- scope: item.scope !== undefined ? item.scope : undefined,
2771
- id_token: item.id_token !== undefined ? item.id_token : undefined,
2772
- session_state: item.session_state !== undefined ? item.session_state : undefined,
2773
- },
2774
- }))
2775
- } : undefined,
2776
- sessions: prop.user.sessions ? {
2777
- upsert: prop.user.sessions.map((item) => ({
2778
- where: {
2779
- id: item.id !== undefined ? item.id : undefined,
2780
- },
2781
- update: {
2782
- id: item.id !== undefined ? {
2783
- set: item.id
2784
- } : undefined,
2785
- sessionToken: item.sessionToken !== undefined ? {
2786
- set: item.sessionToken
2787
- } : undefined,
2788
- expires: item.expires !== undefined ? {
2789
- set: item.expires
2790
- } : undefined,
2791
- },
2792
- create: {
2793
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
2794
- expires: item.expires !== undefined ? item.expires : undefined,
2795
- },
2796
- }))
2797
- } : undefined,
2798
- authenticators: prop.user.authenticators ? {
2799
- upsert: prop.user.authenticators.map((item) => ({
2800
- where: {
2801
- id: item.id !== undefined ? item.id : undefined,
2802
- },
2803
- update: {
2804
- id: item.id !== undefined ? {
2805
- set: item.id
2806
- } : undefined,
2807
- credentialID: item.credentialID !== undefined ? {
2808
- set: item.credentialID
2809
- } : undefined,
2810
- publicKey: item.publicKey !== undefined ? {
2811
- set: item.publicKey
2812
- } : undefined,
2813
- counter: item.counter !== undefined ? {
2814
- set: item.counter
2815
- } : undefined,
2816
- },
2817
- create: {
2818
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
2819
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
2820
- counter: item.counter !== undefined ? item.counter : undefined,
2821
- },
2822
- }))
2823
- } : undefined,
2824
- },
2825
- create: {
2826
- name: prop.user.name !== undefined ? prop.user.name : undefined,
2827
- email: prop.user.email !== undefined ? prop.user.email : undefined,
2828
- emailVerified: prop.user.emailVerified !== undefined ? prop.user.emailVerified : undefined,
2829
- image: prop.user.image !== undefined ? prop.user.image : undefined,
2830
- role: prop.user.role !== undefined ? prop.user.role : undefined,
2831
- bio: prop.user.bio !== undefined ? prop.user.bio : undefined,
2832
- jobTitle: prop.user.jobTitle !== undefined ? prop.user.jobTitle : undefined,
2833
- currentAccount: prop.user.currentAccount !== undefined ? prop.user.currentAccount : undefined,
2834
- plan: prop.user.plan !== undefined ? prop.user.plan : undefined,
2835
- customer: prop.user.customer ? {
2836
- connectOrCreate: {
2837
- where: {
2838
- id: prop.user.customer.id !== undefined ? prop.user.customer.id : undefined,
2839
- name: prop.user.customer.name !== undefined ? {
2840
- equals: prop.user.customer.name
2841
- } : undefined,
2842
- },
2843
- create: {
2844
- authUserId: prop.user.customer.authUserId !== undefined ? prop.user.customer.authUserId : undefined,
2845
- name: prop.user.customer.name !== undefined ? prop.user.customer.name : undefined,
2846
- plan: prop.user.customer.plan !== undefined ? prop.user.customer.plan : undefined,
2847
- stripeCustomerId: prop.user.customer.stripeCustomerId !== undefined ? prop.user.customer.stripeCustomerId : undefined,
2848
- stripeSubscriptionId: prop.user.customer.stripeSubscriptionId !== undefined ? prop.user.customer.stripeSubscriptionId : undefined,
2849
- stripePriceId: prop.user.customer.stripePriceId !== undefined ? prop.user.customer.stripePriceId : undefined,
2850
- stripeCurrentPeriodEnd: prop.user.customer.stripeCurrentPeriodEnd !== undefined ? prop.user.customer.stripeCurrentPeriodEnd : undefined,
2851
- },
2852
- }
2853
- } : undefined,
2854
- accounts: prop.user.accounts ? {
2855
- connectOrCreate: prop.user.accounts.map((item) => ({
2856
- where: {
2857
- id: item.id !== undefined ? item.id : undefined,
2887
+ } : undefined,
2858
2888
  },
2859
2889
  create: {
2860
2890
  type: item.type !== undefined ? item.type : undefined,
@@ -2871,10 +2901,21 @@ exports.AlpacaAccount = {
2871
2901
  }))
2872
2902
  } : undefined,
2873
2903
  sessions: prop.user.sessions ? {
2874
- connectOrCreate: prop.user.sessions.map((item) => ({
2904
+ upsert: prop.user.sessions.map((item) => ({
2875
2905
  where: {
2876
2906
  id: item.id !== undefined ? item.id : undefined,
2877
2907
  },
2908
+ update: {
2909
+ id: item.id !== undefined ? {
2910
+ set: item.id
2911
+ } : undefined,
2912
+ sessionToken: item.sessionToken !== undefined ? {
2913
+ set: item.sessionToken
2914
+ } : undefined,
2915
+ expires: item.expires !== undefined ? {
2916
+ set: item.expires
2917
+ } : undefined,
2918
+ },
2878
2919
  create: {
2879
2920
  sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
2880
2921
  expires: item.expires !== undefined ? item.expires : undefined,
@@ -2882,10 +2923,24 @@ exports.AlpacaAccount = {
2882
2923
  }))
2883
2924
  } : undefined,
2884
2925
  authenticators: prop.user.authenticators ? {
2885
- connectOrCreate: prop.user.authenticators.map((item) => ({
2926
+ upsert: prop.user.authenticators.map((item) => ({
2886
2927
  where: {
2887
2928
  id: item.id !== undefined ? item.id : undefined,
2888
2929
  },
2930
+ update: {
2931
+ id: item.id !== undefined ? {
2932
+ set: item.id
2933
+ } : undefined,
2934
+ credentialID: item.credentialID !== undefined ? {
2935
+ set: item.credentialID
2936
+ } : undefined,
2937
+ publicKey: item.publicKey !== undefined ? {
2938
+ set: item.publicKey
2939
+ } : undefined,
2940
+ counter: item.counter !== undefined ? {
2941
+ set: item.counter
2942
+ } : undefined,
2943
+ },
2889
2944
  create: {
2890
2945
  credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
2891
2946
  publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
@@ -2894,6 +2949,101 @@ exports.AlpacaAccount = {
2894
2949
  }))
2895
2950
  } : undefined,
2896
2951
  },
2952
+ create: {
2953
+ name: prop.user.name !== undefined ? prop.user.name : undefined,
2954
+ email: prop.user.email !== undefined ? prop.user.email : undefined,
2955
+ emailVerified: prop.user.emailVerified !== undefined ? prop.user.emailVerified : undefined,
2956
+ image: prop.user.image !== undefined ? prop.user.image : undefined,
2957
+ role: prop.user.role !== undefined ? prop.user.role : undefined,
2958
+ bio: prop.user.bio !== undefined ? prop.user.bio : undefined,
2959
+ jobTitle: prop.user.jobTitle !== undefined ? prop.user.jobTitle : undefined,
2960
+ currentAccount: prop.user.currentAccount !== undefined ? prop.user.currentAccount : undefined,
2961
+ plan: prop.user.plan !== undefined ? prop.user.plan : undefined,
2962
+ customer: prop.user.customer ?
2963
+ typeof prop.user.customer === 'object' && Object.keys(prop.user.customer).length === 1 && Object.keys(prop.user.customer)[0] === 'id'
2964
+ ? { connect: {
2965
+ id: prop.user.customer.id
2966
+ }
2967
+ }
2968
+ : { connectOrCreate: {
2969
+ where: {
2970
+ id: prop.user.customer.id !== undefined ? prop.user.customer.id : undefined,
2971
+ name: prop.user.customer.name !== undefined ? {
2972
+ equals: prop.user.customer.name
2973
+ } : undefined,
2974
+ },
2975
+ create: {
2976
+ authUserId: prop.user.customer.authUserId !== undefined ? prop.user.customer.authUserId : undefined,
2977
+ name: prop.user.customer.name !== undefined ? prop.user.customer.name : undefined,
2978
+ plan: prop.user.customer.plan !== undefined ? prop.user.customer.plan : undefined,
2979
+ stripeCustomerId: prop.user.customer.stripeCustomerId !== undefined ? prop.user.customer.stripeCustomerId : undefined,
2980
+ stripeSubscriptionId: prop.user.customer.stripeSubscriptionId !== undefined ? prop.user.customer.stripeSubscriptionId : undefined,
2981
+ stripePriceId: prop.user.customer.stripePriceId !== undefined ? prop.user.customer.stripePriceId : undefined,
2982
+ stripeCurrentPeriodEnd: prop.user.customer.stripeCurrentPeriodEnd !== undefined ? prop.user.customer.stripeCurrentPeriodEnd : undefined,
2983
+ },
2984
+ }
2985
+ } : undefined,
2986
+ accounts: prop.user.accounts ?
2987
+ Array.isArray(prop.user.accounts) && prop.user.accounts.length > 0
2988
+ ? prop.user.accounts.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
2989
+ connect: prop.user.accounts.map((item) => ({
2990
+ id: item.id
2991
+ }))
2992
+ }
2993
+ : { connectOrCreate: prop.user.accounts.map((item) => ({
2994
+ where: {
2995
+ id: item.id !== undefined ? item.id : undefined,
2996
+ },
2997
+ create: {
2998
+ type: item.type !== undefined ? item.type : undefined,
2999
+ provider: item.provider !== undefined ? item.provider : undefined,
3000
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
3001
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
3002
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
3003
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
3004
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
3005
+ scope: item.scope !== undefined ? item.scope : undefined,
3006
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
3007
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
3008
+ },
3009
+ }))
3010
+ } : undefined,
3011
+ sessions: prop.user.sessions ?
3012
+ Array.isArray(prop.user.sessions) && prop.user.sessions.length > 0
3013
+ ? prop.user.sessions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
3014
+ connect: prop.user.sessions.map((item) => ({
3015
+ id: item.id
3016
+ }))
3017
+ }
3018
+ : { connectOrCreate: prop.user.sessions.map((item) => ({
3019
+ where: {
3020
+ id: item.id !== undefined ? item.id : undefined,
3021
+ },
3022
+ create: {
3023
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
3024
+ expires: item.expires !== undefined ? item.expires : undefined,
3025
+ },
3026
+ }))
3027
+ } : undefined,
3028
+ authenticators: prop.user.authenticators ?
3029
+ Array.isArray(prop.user.authenticators) && prop.user.authenticators.length > 0
3030
+ ? prop.user.authenticators.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
3031
+ connect: prop.user.authenticators.map((item) => ({
3032
+ id: item.id
3033
+ }))
3034
+ }
3035
+ : { connectOrCreate: prop.user.authenticators.map((item) => ({
3036
+ where: {
3037
+ id: item.id !== undefined ? item.id : undefined,
3038
+ },
3039
+ create: {
3040
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
3041
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
3042
+ counter: item.counter !== undefined ? item.counter : undefined,
3043
+ },
3044
+ }))
3045
+ } : undefined,
3046
+ },
2897
3047
  }
2898
3048
  } : undefined,
2899
3049
  trades: prop.trades ? {
@@ -3223,86 +3373,97 @@ exports.AlpacaAccount = {
3223
3373
  timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
3224
3374
  status: item.status !== undefined ? item.status : undefined,
3225
3375
  optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
3226
- asset: item.asset ? {
3227
- connectOrCreate: {
3228
- where: {
3229
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3230
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3231
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3232
- },
3233
- create: {
3234
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3235
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3236
- type: item.asset.type !== undefined ? item.asset.type : undefined,
3237
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3238
- description: item.asset.description !== undefined ? item.asset.description : undefined,
3239
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3240
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3241
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3242
- country: item.asset.country !== undefined ? item.asset.country : undefined,
3243
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3244
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3245
- address: item.asset.address !== undefined ? item.asset.address : undefined,
3246
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3247
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3248
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3249
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3250
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3251
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3252
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3253
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3254
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3255
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3256
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3257
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3258
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3259
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3260
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3261
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3262
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3263
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3264
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3265
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3266
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3267
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3268
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3269
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3270
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3271
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3272
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3273
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3274
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3275
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3276
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3277
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3278
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3279
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3280
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3281
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3282
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3283
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3284
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3285
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3286
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3287
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3288
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3289
- },
3290
- }
3291
- } : undefined,
3292
- actions: item.actions ? {
3293
- connectOrCreate: item.actions.map((item) => ({
3294
- where: {
3295
- id: item.id !== undefined ? item.id : undefined,
3296
- },
3297
- create: {
3298
- sequence: item.sequence !== undefined ? item.sequence : undefined,
3299
- type: item.type !== undefined ? item.type : undefined,
3300
- note: item.note !== undefined ? item.note : undefined,
3301
- status: item.status !== undefined ? item.status : undefined,
3302
- fee: item.fee !== undefined ? item.fee : undefined,
3303
- },
3304
- }))
3305
- } : undefined,
3376
+ asset: item.asset ?
3377
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
3378
+ ? { connect: {
3379
+ id: item.asset.id
3380
+ }
3381
+ }
3382
+ : { connectOrCreate: {
3383
+ where: {
3384
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
3385
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3386
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3387
+ },
3388
+ create: {
3389
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3390
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3391
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3392
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3393
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3394
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3395
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3396
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3397
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3398
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3399
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3400
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3401
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3402
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3403
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3404
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3405
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3406
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3407
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3408
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3409
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3410
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3411
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3412
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3413
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3414
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3415
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3416
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3417
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3418
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3419
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3420
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3421
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3422
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3423
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3424
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3425
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3426
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3427
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3428
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3429
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3430
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3431
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3432
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3433
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3434
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3435
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3436
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3437
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3438
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3439
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3440
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3441
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3442
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3443
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3444
+ },
3445
+ }
3446
+ } : undefined,
3447
+ actions: item.actions ?
3448
+ Array.isArray(item.actions) && item.actions.length > 0
3449
+ ? item.actions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
3450
+ connect: item.actions.map((item) => ({
3451
+ id: item.id
3452
+ }))
3453
+ }
3454
+ : { connectOrCreate: item.actions.map((item) => ({
3455
+ where: {
3456
+ id: item.id !== undefined ? item.id : undefined,
3457
+ },
3458
+ create: {
3459
+ sequence: item.sequence !== undefined ? item.sequence : undefined,
3460
+ type: item.type !== undefined ? item.type : undefined,
3461
+ note: item.note !== undefined ? item.note : undefined,
3462
+ status: item.status !== undefined ? item.status : undefined,
3463
+ fee: item.fee !== undefined ? item.fee : undefined,
3464
+ },
3465
+ }))
3466
+ } : undefined,
3306
3467
  },
3307
3468
  }))
3308
3469
  } : undefined,
@@ -3659,86 +3820,96 @@ exports.AlpacaAccount = {
3659
3820
  filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
3660
3821
  filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
3661
3822
  fee: item.fee !== undefined ? item.fee : undefined,
3662
- action: item.action ? {
3663
- connectOrCreate: {
3664
- where: {
3665
- id: item.action.id !== undefined ? item.action.id : undefined,
3666
- },
3667
- create: {
3668
- sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
3669
- type: item.action.type !== undefined ? item.action.type : undefined,
3670
- note: item.action.note !== undefined ? item.action.note : undefined,
3671
- status: item.action.status !== undefined ? item.action.status : undefined,
3672
- fee: item.action.fee !== undefined ? item.action.fee : undefined,
3673
- },
3674
- }
3675
- } : undefined,
3676
- asset: item.asset ? {
3677
- connectOrCreate: {
3678
- where: {
3679
- id: item.asset.id !== undefined ? item.asset.id : undefined,
3680
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3681
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3682
- },
3683
- create: {
3684
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3685
- name: item.asset.name !== undefined ? item.asset.name : undefined,
3686
- type: item.asset.type !== undefined ? item.asset.type : undefined,
3687
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3688
- description: item.asset.description !== undefined ? item.asset.description : undefined,
3689
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3690
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3691
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3692
- country: item.asset.country !== undefined ? item.asset.country : undefined,
3693
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3694
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3695
- address: item.asset.address !== undefined ? item.asset.address : undefined,
3696
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3697
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3698
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3699
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3700
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3701
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3702
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3703
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3704
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3705
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3706
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3707
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3708
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3709
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3710
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3711
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3712
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3713
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3714
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3715
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3716
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3717
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3718
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3719
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3720
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3721
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3722
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3723
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3724
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3725
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3726
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3727
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3728
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3729
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3730
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3731
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3732
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3733
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3734
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3735
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3736
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3737
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3738
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3739
- },
3740
- }
3741
- } : undefined,
3823
+ action: item.action ?
3824
+ typeof item.action === 'object' && Object.keys(item.action).length === 1 && Object.keys(item.action)[0] === 'id'
3825
+ ? { connect: {
3826
+ id: item.action.id
3827
+ }
3828
+ }
3829
+ : { connectOrCreate: {
3830
+ where: {
3831
+ id: item.action.id !== undefined ? item.action.id : undefined,
3832
+ },
3833
+ create: {
3834
+ sequence: item.action.sequence !== undefined ? item.action.sequence : undefined,
3835
+ type: item.action.type !== undefined ? item.action.type : undefined,
3836
+ note: item.action.note !== undefined ? item.action.note : undefined,
3837
+ status: item.action.status !== undefined ? item.action.status : undefined,
3838
+ fee: item.action.fee !== undefined ? item.action.fee : undefined,
3839
+ },
3840
+ }
3841
+ } : undefined,
3842
+ asset: item.asset ?
3843
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
3844
+ ? { connect: {
3845
+ id: item.asset.id
3846
+ }
3847
+ }
3848
+ : { connectOrCreate: {
3849
+ where: {
3850
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
3851
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3852
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3853
+ },
3854
+ create: {
3855
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
3856
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
3857
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
3858
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
3859
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
3860
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
3861
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
3862
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
3863
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
3864
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
3865
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
3866
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
3867
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
3868
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
3869
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
3870
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
3871
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
3872
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
3873
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
3874
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
3875
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
3876
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
3877
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
3878
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
3879
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
3880
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
3881
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
3882
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
3883
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
3884
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
3885
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
3886
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
3887
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
3888
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
3889
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
3890
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
3891
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
3892
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
3893
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
3894
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
3895
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
3896
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
3897
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
3898
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
3899
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
3900
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
3901
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
3902
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
3903
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
3904
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
3905
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
3906
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
3907
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
3908
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
3909
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
3910
+ },
3911
+ }
3912
+ } : undefined,
3742
3913
  },
3743
3914
  }))
3744
3915
  } : undefined,
@@ -4047,72 +4218,77 @@ exports.AlpacaAccount = {
4047
4218
  lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
4048
4219
  changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
4049
4220
  assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
4050
- asset: item.asset ? {
4051
- connectOrCreate: {
4052
- where: {
4053
- id: item.asset.id !== undefined ? item.asset.id : undefined,
4054
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4055
- name: item.asset.name !== undefined ? item.asset.name : undefined,
4056
- },
4057
- create: {
4058
- symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4059
- name: item.asset.name !== undefined ? item.asset.name : undefined,
4060
- type: item.asset.type !== undefined ? item.asset.type : undefined,
4061
- logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
4062
- description: item.asset.description !== undefined ? item.asset.description : undefined,
4063
- cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
4064
- exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
4065
- currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
4066
- country: item.asset.country !== undefined ? item.asset.country : undefined,
4067
- sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
4068
- industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
4069
- address: item.asset.address !== undefined ? item.asset.address : undefined,
4070
- officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
4071
- fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
4072
- latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
4073
- marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
4074
- ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
4075
- peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
4076
- pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
4077
- bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
4078
- dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
4079
- dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
4080
- eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
4081
- revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
4082
- profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
4083
- operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
4084
- returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
4085
- returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
4086
- revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
4087
- grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
4088
- dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
4089
- quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
4090
- quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
4091
- analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
4092
- analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
4093
- analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
4094
- analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
4095
- analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
4096
- analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
4097
- trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
4098
- forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
4099
- priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
4100
- priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
4101
- evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
4102
- evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
4103
- beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
4104
- week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
4105
- week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
4106
- day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
4107
- day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
4108
- sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
4109
- dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
4110
- exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
4111
- sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
4112
- buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
4113
- },
4114
- }
4115
- } : undefined,
4221
+ asset: item.asset ?
4222
+ typeof item.asset === 'object' && Object.keys(item.asset).length === 1 && Object.keys(item.asset)[0] === 'id'
4223
+ ? { connect: {
4224
+ id: item.asset.id
4225
+ }
4226
+ }
4227
+ : { connectOrCreate: {
4228
+ where: {
4229
+ id: item.asset.id !== undefined ? item.asset.id : undefined,
4230
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4231
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
4232
+ },
4233
+ create: {
4234
+ symbol: item.asset.symbol !== undefined ? item.asset.symbol : undefined,
4235
+ name: item.asset.name !== undefined ? item.asset.name : undefined,
4236
+ type: item.asset.type !== undefined ? item.asset.type : undefined,
4237
+ logoUrl: item.asset.logoUrl !== undefined ? item.asset.logoUrl : undefined,
4238
+ description: item.asset.description !== undefined ? item.asset.description : undefined,
4239
+ cik: item.asset.cik !== undefined ? item.asset.cik : undefined,
4240
+ exchange: item.asset.exchange !== undefined ? item.asset.exchange : undefined,
4241
+ currency: item.asset.currency !== undefined ? item.asset.currency : undefined,
4242
+ country: item.asset.country !== undefined ? item.asset.country : undefined,
4243
+ sector: item.asset.sector !== undefined ? item.asset.sector : undefined,
4244
+ industry: item.asset.industry !== undefined ? item.asset.industry : undefined,
4245
+ address: item.asset.address !== undefined ? item.asset.address : undefined,
4246
+ officialSite: item.asset.officialSite !== undefined ? item.asset.officialSite : undefined,
4247
+ fiscalYearEnd: item.asset.fiscalYearEnd !== undefined ? item.asset.fiscalYearEnd : undefined,
4248
+ latestQuarter: item.asset.latestQuarter !== undefined ? item.asset.latestQuarter : undefined,
4249
+ marketCapitalization: item.asset.marketCapitalization !== undefined ? item.asset.marketCapitalization : undefined,
4250
+ ebitda: item.asset.ebitda !== undefined ? item.asset.ebitda : undefined,
4251
+ peRatio: item.asset.peRatio !== undefined ? item.asset.peRatio : undefined,
4252
+ pegRatio: item.asset.pegRatio !== undefined ? item.asset.pegRatio : undefined,
4253
+ bookValue: item.asset.bookValue !== undefined ? item.asset.bookValue : undefined,
4254
+ dividendPerShare: item.asset.dividendPerShare !== undefined ? item.asset.dividendPerShare : undefined,
4255
+ dividendYield: item.asset.dividendYield !== undefined ? item.asset.dividendYield : undefined,
4256
+ eps: item.asset.eps !== undefined ? item.asset.eps : undefined,
4257
+ revenuePerShareTTM: item.asset.revenuePerShareTTM !== undefined ? item.asset.revenuePerShareTTM : undefined,
4258
+ profitMargin: item.asset.profitMargin !== undefined ? item.asset.profitMargin : undefined,
4259
+ operatingMarginTTM: item.asset.operatingMarginTTM !== undefined ? item.asset.operatingMarginTTM : undefined,
4260
+ returnOnAssetsTTM: item.asset.returnOnAssetsTTM !== undefined ? item.asset.returnOnAssetsTTM : undefined,
4261
+ returnOnEquityTTM: item.asset.returnOnEquityTTM !== undefined ? item.asset.returnOnEquityTTM : undefined,
4262
+ revenueTTM: item.asset.revenueTTM !== undefined ? item.asset.revenueTTM : undefined,
4263
+ grossProfitTTM: item.asset.grossProfitTTM !== undefined ? item.asset.grossProfitTTM : undefined,
4264
+ dilutedEPSTTM: item.asset.dilutedEPSTTM !== undefined ? item.asset.dilutedEPSTTM : undefined,
4265
+ quarterlyEarningsGrowthYOY: item.asset.quarterlyEarningsGrowthYOY !== undefined ? item.asset.quarterlyEarningsGrowthYOY : undefined,
4266
+ quarterlyRevenueGrowthYOY: item.asset.quarterlyRevenueGrowthYOY !== undefined ? item.asset.quarterlyRevenueGrowthYOY : undefined,
4267
+ analystTargetPrice: item.asset.analystTargetPrice !== undefined ? item.asset.analystTargetPrice : undefined,
4268
+ analystRatingStrongBuy: item.asset.analystRatingStrongBuy !== undefined ? item.asset.analystRatingStrongBuy : undefined,
4269
+ analystRatingBuy: item.asset.analystRatingBuy !== undefined ? item.asset.analystRatingBuy : undefined,
4270
+ analystRatingHold: item.asset.analystRatingHold !== undefined ? item.asset.analystRatingHold : undefined,
4271
+ analystRatingSell: item.asset.analystRatingSell !== undefined ? item.asset.analystRatingSell : undefined,
4272
+ analystRatingStrongSell: item.asset.analystRatingStrongSell !== undefined ? item.asset.analystRatingStrongSell : undefined,
4273
+ trailingPE: item.asset.trailingPE !== undefined ? item.asset.trailingPE : undefined,
4274
+ forwardPE: item.asset.forwardPE !== undefined ? item.asset.forwardPE : undefined,
4275
+ priceToSalesRatioTTM: item.asset.priceToSalesRatioTTM !== undefined ? item.asset.priceToSalesRatioTTM : undefined,
4276
+ priceToBookRatio: item.asset.priceToBookRatio !== undefined ? item.asset.priceToBookRatio : undefined,
4277
+ evToRevenue: item.asset.evToRevenue !== undefined ? item.asset.evToRevenue : undefined,
4278
+ evToEbitda: item.asset.evToEbitda !== undefined ? item.asset.evToEbitda : undefined,
4279
+ beta: item.asset.beta !== undefined ? item.asset.beta : undefined,
4280
+ week52High: item.asset.week52High !== undefined ? item.asset.week52High : undefined,
4281
+ week52Low: item.asset.week52Low !== undefined ? item.asset.week52Low : undefined,
4282
+ day50MovingAverage: item.asset.day50MovingAverage !== undefined ? item.asset.day50MovingAverage : undefined,
4283
+ day200MovingAverage: item.asset.day200MovingAverage !== undefined ? item.asset.day200MovingAverage : undefined,
4284
+ sharesOutstanding: item.asset.sharesOutstanding !== undefined ? item.asset.sharesOutstanding : undefined,
4285
+ dividendDate: item.asset.dividendDate !== undefined ? item.asset.dividendDate : undefined,
4286
+ exDividendDate: item.asset.exDividendDate !== undefined ? item.asset.exDividendDate : undefined,
4287
+ sellPrice: item.asset.sellPrice !== undefined ? item.asset.sellPrice : undefined,
4288
+ buyPrice: item.asset.buyPrice !== undefined ? item.asset.buyPrice : undefined,
4289
+ },
4290
+ }
4291
+ } : undefined,
4116
4292
  },
4117
4293
  }))
4118
4294
  } : undefined,