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