adaptic-backend 1.0.75 → 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/Account.cjs +264 -190
  2. package/Action.cjs +594 -524
  3. package/Alert.cjs +352 -278
  4. package/AlpacaAccount.cjs +1197 -1021
  5. package/Asset.cjs +485 -368
  6. package/Authenticator.cjs +285 -211
  7. package/Customer.cjs +268 -190
  8. package/NewsArticle.cjs +233 -212
  9. package/NewsArticleAssetSentiment.cjs +354 -290
  10. package/Order.cjs +694 -541
  11. package/Position.cjs +621 -488
  12. package/Session.cjs +288 -214
  13. package/Trade.cjs +767 -613
  14. package/User.cjs +410 -309
  15. package/package.json +1 -1
  16. package/server/Account.d.ts.map +1 -1
  17. package/server/Account.js.map +1 -1
  18. package/server/Account.mjs +264 -190
  19. package/server/Action.d.ts.map +1 -1
  20. package/server/Action.js.map +1 -1
  21. package/server/Action.mjs +594 -524
  22. package/server/Alert.d.ts.map +1 -1
  23. package/server/Alert.js.map +1 -1
  24. package/server/Alert.mjs +352 -278
  25. package/server/AlpacaAccount.d.ts.map +1 -1
  26. package/server/AlpacaAccount.js.map +1 -1
  27. package/server/AlpacaAccount.mjs +1197 -1021
  28. package/server/Asset.d.ts.map +1 -1
  29. package/server/Asset.js.map +1 -1
  30. package/server/Asset.mjs +485 -368
  31. package/server/Authenticator.d.ts.map +1 -1
  32. package/server/Authenticator.js.map +1 -1
  33. package/server/Authenticator.mjs +285 -211
  34. package/server/Customer.d.ts.map +1 -1
  35. package/server/Customer.js.map +1 -1
  36. package/server/Customer.mjs +268 -190
  37. package/server/NewsArticle.d.ts.map +1 -1
  38. package/server/NewsArticle.js.map +1 -1
  39. package/server/NewsArticle.mjs +233 -212
  40. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  41. package/server/NewsArticleAssetSentiment.js.map +1 -1
  42. package/server/NewsArticleAssetSentiment.mjs +354 -290
  43. package/server/Order.d.ts.map +1 -1
  44. package/server/Order.js.map +1 -1
  45. package/server/Order.mjs +694 -541
  46. package/server/Position.d.ts.map +1 -1
  47. package/server/Position.js.map +1 -1
  48. package/server/Position.mjs +621 -488
  49. package/server/Session.d.ts.map +1 -1
  50. package/server/Session.js.map +1 -1
  51. package/server/Session.mjs +288 -214
  52. package/server/Trade.d.ts.map +1 -1
  53. package/server/Trade.js.map +1 -1
  54. package/server/Trade.mjs +767 -613
  55. package/server/User.d.ts.map +1 -1
  56. package/server/User.js.map +1 -1
  57. package/server/User.mjs +410 -309
package/server/Alert.mjs CHANGED
@@ -284,108 +284,136 @@ export const Alert = {
284
284
  message: props.message !== undefined ? props.message : undefined,
285
285
  type: props.type !== undefined ? props.type : undefined,
286
286
  isRead: props.isRead !== undefined ? props.isRead : undefined,
287
- alpacaAccount: props.alpacaAccount ? {
288
- connectOrCreate: {
289
- where: {
290
- id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
291
- },
292
- create: {
293
- type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
294
- APIKey: props.alpacaAccount.APIKey !== undefined ? props.alpacaAccount.APIKey : undefined,
295
- APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
296
- configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
297
- marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
298
- user: props.alpacaAccount.user ? {
299
- connectOrCreate: {
300
- where: {
301
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
302
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
303
- name: props.alpacaAccount.user.name !== undefined ? {
304
- equals: props.alpacaAccount.user.name
305
- } : undefined,
306
- },
307
- create: {
308
- name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
309
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
310
- emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
311
- image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
312
- role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
313
- bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
314
- jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
315
- currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
316
- plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
317
- },
318
- }
319
- } : undefined,
320
- trades: props.alpacaAccount.trades ? {
321
- connectOrCreate: props.alpacaAccount.trades.map((item) => ({
322
- where: {
323
- id: item.id !== undefined ? item.id : undefined,
324
- },
325
- create: {
326
- qty: item.qty !== undefined ? item.qty : undefined,
327
- price: item.price !== undefined ? item.price : undefined,
328
- total: item.total !== undefined ? item.total : undefined,
329
- signal: item.signal !== undefined ? item.signal : undefined,
330
- strategy: item.strategy !== undefined ? item.strategy : undefined,
331
- analysis: item.analysis !== undefined ? item.analysis : undefined,
332
- confidence: item.confidence !== undefined ? item.confidence : undefined,
333
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
334
- status: item.status !== undefined ? item.status : undefined,
335
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
336
- },
337
- }))
338
- } : undefined,
339
- orders: props.alpacaAccount.orders ? {
340
- connectOrCreate: props.alpacaAccount.orders.map((item) => ({
341
- where: {
342
- id: item.id !== undefined ? item.id : undefined,
343
- },
344
- create: {
345
- qty: item.qty !== undefined ? item.qty : undefined,
346
- notional: item.notional !== undefined ? item.notional : undefined,
347
- side: item.side !== undefined ? item.side : undefined,
348
- type: item.type !== undefined ? item.type : undefined,
349
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
350
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
351
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
352
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
353
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
354
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
355
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
356
- status: item.status !== undefined ? item.status : undefined,
357
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
358
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
359
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
360
- fee: item.fee !== undefined ? item.fee : undefined,
361
- },
362
- }))
363
- } : undefined,
364
- positions: props.alpacaAccount.positions ? {
365
- connectOrCreate: props.alpacaAccount.positions.map((item) => ({
366
- where: {
367
- id: item.id !== undefined ? item.id : undefined,
368
- },
369
- create: {
370
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
371
- qty: item.qty !== undefined ? item.qty : undefined,
372
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
373
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
374
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
375
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
376
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
377
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
378
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
379
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
380
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
381
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
382
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
383
- },
384
- }))
385
- } : undefined,
386
- },
387
- }
388
- } : undefined,
287
+ alpacaAccount: props.alpacaAccount ?
288
+ typeof props.alpacaAccount === 'object' && Object.keys(props.alpacaAccount).length === 1 && Object.keys(props.alpacaAccount)[0] === 'id'
289
+ ? { connect: {
290
+ id: props.alpacaAccount.id
291
+ }
292
+ }
293
+ : { connectOrCreate: {
294
+ where: {
295
+ id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
296
+ },
297
+ create: {
298
+ type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
299
+ APIKey: props.alpacaAccount.APIKey !== undefined ? props.alpacaAccount.APIKey : undefined,
300
+ APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
301
+ configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
302
+ marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
303
+ user: props.alpacaAccount.user ?
304
+ typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
305
+ ? { connect: {
306
+ id: props.alpacaAccount.user.id
307
+ }
308
+ }
309
+ : { connectOrCreate: {
310
+ where: {
311
+ id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
312
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
313
+ name: props.alpacaAccount.user.name !== undefined ? {
314
+ equals: props.alpacaAccount.user.name
315
+ } : undefined,
316
+ },
317
+ create: {
318
+ name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
319
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
320
+ emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
321
+ image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
322
+ role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
323
+ bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
324
+ jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
325
+ currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
326
+ plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
327
+ },
328
+ }
329
+ } : undefined,
330
+ trades: props.alpacaAccount.trades ?
331
+ Array.isArray(props.alpacaAccount.trades) && props.alpacaAccount.trades.length > 0
332
+ ? props.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
333
+ connect: props.alpacaAccount.trades.map((item) => ({
334
+ id: item.id
335
+ }))
336
+ }
337
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
338
+ where: {
339
+ id: item.id !== undefined ? item.id : undefined,
340
+ },
341
+ create: {
342
+ qty: item.qty !== undefined ? item.qty : undefined,
343
+ price: item.price !== undefined ? item.price : undefined,
344
+ total: item.total !== undefined ? item.total : undefined,
345
+ signal: item.signal !== undefined ? item.signal : undefined,
346
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
347
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
348
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
349
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
350
+ status: item.status !== undefined ? item.status : undefined,
351
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
352
+ },
353
+ }))
354
+ } : undefined,
355
+ orders: props.alpacaAccount.orders ?
356
+ Array.isArray(props.alpacaAccount.orders) && props.alpacaAccount.orders.length > 0
357
+ ? props.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
358
+ connect: props.alpacaAccount.orders.map((item) => ({
359
+ id: item.id
360
+ }))
361
+ }
362
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
363
+ where: {
364
+ id: item.id !== undefined ? item.id : undefined,
365
+ },
366
+ create: {
367
+ qty: item.qty !== undefined ? item.qty : undefined,
368
+ notional: item.notional !== undefined ? item.notional : undefined,
369
+ side: item.side !== undefined ? item.side : undefined,
370
+ type: item.type !== undefined ? item.type : undefined,
371
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
372
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
373
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
374
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
375
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
376
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
377
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
378
+ status: item.status !== undefined ? item.status : undefined,
379
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
380
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
381
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
382
+ fee: item.fee !== undefined ? item.fee : undefined,
383
+ },
384
+ }))
385
+ } : undefined,
386
+ positions: props.alpacaAccount.positions ?
387
+ Array.isArray(props.alpacaAccount.positions) && props.alpacaAccount.positions.length > 0
388
+ ? props.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
389
+ connect: props.alpacaAccount.positions.map((item) => ({
390
+ id: item.id
391
+ }))
392
+ }
393
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
394
+ where: {
395
+ id: item.id !== undefined ? item.id : undefined,
396
+ },
397
+ create: {
398
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
399
+ qty: item.qty !== undefined ? item.qty : undefined,
400
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
401
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
402
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
403
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
404
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
405
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
406
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
407
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
408
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
409
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
410
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
411
+ },
412
+ }))
413
+ } : undefined,
414
+ },
415
+ }
416
+ } : undefined,
389
417
  },
390
418
  };
391
419
  const filteredVariables = removeUndefinedProps(variables);
@@ -1027,94 +1055,117 @@ export const Alert = {
1027
1055
  APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
1028
1056
  configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
1029
1057
  marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
1030
- user: props.alpacaAccount.user ? {
1031
- connectOrCreate: {
1032
- where: {
1033
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
1034
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1035
- name: props.alpacaAccount.user.name !== undefined ? {
1036
- equals: props.alpacaAccount.user.name
1037
- } : undefined,
1038
- },
1039
- create: {
1040
- name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
1041
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1042
- emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
1043
- image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
1044
- role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
1045
- bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
1046
- jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1047
- currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1048
- plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
1049
- },
1050
- }
1051
- } : undefined,
1052
- trades: props.alpacaAccount.trades ? {
1053
- connectOrCreate: props.alpacaAccount.trades.map((item) => ({
1054
- where: {
1055
- id: item.id !== undefined ? item.id : undefined,
1056
- },
1057
- create: {
1058
- qty: item.qty !== undefined ? item.qty : undefined,
1059
- price: item.price !== undefined ? item.price : undefined,
1060
- total: item.total !== undefined ? item.total : undefined,
1061
- signal: item.signal !== undefined ? item.signal : undefined,
1062
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1063
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1064
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1065
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1066
- status: item.status !== undefined ? item.status : undefined,
1067
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1068
- },
1069
- }))
1070
- } : undefined,
1071
- orders: props.alpacaAccount.orders ? {
1072
- connectOrCreate: props.alpacaAccount.orders.map((item) => ({
1073
- where: {
1074
- id: item.id !== undefined ? item.id : undefined,
1075
- },
1076
- create: {
1077
- qty: item.qty !== undefined ? item.qty : undefined,
1078
- notional: item.notional !== undefined ? item.notional : undefined,
1079
- side: item.side !== undefined ? item.side : undefined,
1080
- type: item.type !== undefined ? item.type : undefined,
1081
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1082
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1083
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1084
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1085
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1086
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1087
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1088
- status: item.status !== undefined ? item.status : undefined,
1089
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1090
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1091
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1092
- fee: item.fee !== undefined ? item.fee : undefined,
1093
- },
1094
- }))
1095
- } : undefined,
1096
- positions: props.alpacaAccount.positions ? {
1097
- connectOrCreate: props.alpacaAccount.positions.map((item) => ({
1098
- where: {
1099
- id: item.id !== undefined ? item.id : undefined,
1100
- },
1101
- create: {
1102
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1103
- qty: item.qty !== undefined ? item.qty : undefined,
1104
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1105
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1106
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1107
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1108
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1109
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1110
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1111
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1112
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1113
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1114
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1115
- },
1116
- }))
1117
- } : undefined,
1058
+ user: props.alpacaAccount.user ?
1059
+ typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
1060
+ ? { connect: {
1061
+ id: props.alpacaAccount.user.id
1062
+ }
1063
+ }
1064
+ : { connectOrCreate: {
1065
+ where: {
1066
+ id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
1067
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1068
+ name: props.alpacaAccount.user.name !== undefined ? {
1069
+ equals: props.alpacaAccount.user.name
1070
+ } : undefined,
1071
+ },
1072
+ create: {
1073
+ name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
1074
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1075
+ emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
1076
+ image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
1077
+ role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
1078
+ bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
1079
+ jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1080
+ currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1081
+ plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
1082
+ },
1083
+ }
1084
+ } : undefined,
1085
+ trades: props.alpacaAccount.trades ?
1086
+ Array.isArray(props.alpacaAccount.trades) && props.alpacaAccount.trades.length > 0
1087
+ ? props.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1088
+ connect: props.alpacaAccount.trades.map((item) => ({
1089
+ id: item.id
1090
+ }))
1091
+ }
1092
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
1093
+ where: {
1094
+ id: item.id !== undefined ? item.id : undefined,
1095
+ },
1096
+ create: {
1097
+ qty: item.qty !== undefined ? item.qty : undefined,
1098
+ price: item.price !== undefined ? item.price : undefined,
1099
+ total: item.total !== undefined ? item.total : undefined,
1100
+ signal: item.signal !== undefined ? item.signal : undefined,
1101
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1102
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1103
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1104
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1105
+ status: item.status !== undefined ? item.status : undefined,
1106
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1107
+ },
1108
+ }))
1109
+ } : undefined,
1110
+ orders: props.alpacaAccount.orders ?
1111
+ Array.isArray(props.alpacaAccount.orders) && props.alpacaAccount.orders.length > 0
1112
+ ? props.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1113
+ connect: props.alpacaAccount.orders.map((item) => ({
1114
+ id: item.id
1115
+ }))
1116
+ }
1117
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
1118
+ where: {
1119
+ id: item.id !== undefined ? item.id : undefined,
1120
+ },
1121
+ create: {
1122
+ qty: item.qty !== undefined ? item.qty : undefined,
1123
+ notional: item.notional !== undefined ? item.notional : undefined,
1124
+ side: item.side !== undefined ? item.side : undefined,
1125
+ type: item.type !== undefined ? item.type : undefined,
1126
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1127
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1128
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1129
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1130
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1131
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1132
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1133
+ status: item.status !== undefined ? item.status : undefined,
1134
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1135
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1136
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1137
+ fee: item.fee !== undefined ? item.fee : undefined,
1138
+ },
1139
+ }))
1140
+ } : undefined,
1141
+ positions: props.alpacaAccount.positions ?
1142
+ Array.isArray(props.alpacaAccount.positions) && props.alpacaAccount.positions.length > 0
1143
+ ? props.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1144
+ connect: props.alpacaAccount.positions.map((item) => ({
1145
+ id: item.id
1146
+ }))
1147
+ }
1148
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
1149
+ where: {
1150
+ id: item.id !== undefined ? item.id : undefined,
1151
+ },
1152
+ create: {
1153
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1154
+ qty: item.qty !== undefined ? item.qty : undefined,
1155
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1156
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1157
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1158
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1159
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1160
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1161
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1162
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1163
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1164
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1165
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1166
+ },
1167
+ }))
1168
+ } : undefined,
1118
1169
  },
1119
1170
  }
1120
1171
  } : undefined,
@@ -1462,94 +1513,117 @@ export const Alert = {
1462
1513
  APISecret: prop.alpacaAccount.APISecret !== undefined ? prop.alpacaAccount.APISecret : undefined,
1463
1514
  configuration: prop.alpacaAccount.configuration !== undefined ? prop.alpacaAccount.configuration : undefined,
1464
1515
  marketOpen: prop.alpacaAccount.marketOpen !== undefined ? prop.alpacaAccount.marketOpen : undefined,
1465
- user: prop.alpacaAccount.user ? {
1466
- connectOrCreate: {
1467
- where: {
1468
- id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
1469
- email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1470
- name: prop.alpacaAccount.user.name !== undefined ? {
1471
- equals: prop.alpacaAccount.user.name
1472
- } : undefined,
1473
- },
1474
- create: {
1475
- name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
1476
- email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1477
- emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
1478
- image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
1479
- role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
1480
- bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
1481
- jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
1482
- currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
1483
- plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
1484
- },
1485
- }
1486
- } : undefined,
1487
- trades: prop.alpacaAccount.trades ? {
1488
- connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
1489
- where: {
1490
- id: item.id !== undefined ? item.id : undefined,
1491
- },
1492
- create: {
1493
- qty: item.qty !== undefined ? item.qty : undefined,
1494
- price: item.price !== undefined ? item.price : undefined,
1495
- total: item.total !== undefined ? item.total : undefined,
1496
- signal: item.signal !== undefined ? item.signal : undefined,
1497
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1498
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1499
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1500
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1501
- status: item.status !== undefined ? item.status : undefined,
1502
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1503
- },
1504
- }))
1505
- } : undefined,
1506
- orders: prop.alpacaAccount.orders ? {
1507
- connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
1508
- where: {
1509
- id: item.id !== undefined ? item.id : undefined,
1510
- },
1511
- create: {
1512
- qty: item.qty !== undefined ? item.qty : undefined,
1513
- notional: item.notional !== undefined ? item.notional : undefined,
1514
- side: item.side !== undefined ? item.side : undefined,
1515
- type: item.type !== undefined ? item.type : undefined,
1516
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1517
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1518
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1519
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1520
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1521
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1522
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1523
- status: item.status !== undefined ? item.status : undefined,
1524
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1525
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1526
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1527
- fee: item.fee !== undefined ? item.fee : undefined,
1528
- },
1529
- }))
1530
- } : undefined,
1531
- positions: prop.alpacaAccount.positions ? {
1532
- connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
1533
- where: {
1534
- id: item.id !== undefined ? item.id : undefined,
1535
- },
1536
- create: {
1537
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1538
- qty: item.qty !== undefined ? item.qty : undefined,
1539
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1540
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1541
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1542
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1543
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1544
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1545
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1546
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1547
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1548
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1549
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1550
- },
1551
- }))
1552
- } : undefined,
1516
+ user: prop.alpacaAccount.user ?
1517
+ typeof prop.alpacaAccount.user === 'object' && Object.keys(prop.alpacaAccount.user).length === 1 && Object.keys(prop.alpacaAccount.user)[0] === 'id'
1518
+ ? { connect: {
1519
+ id: prop.alpacaAccount.user.id
1520
+ }
1521
+ }
1522
+ : { connectOrCreate: {
1523
+ where: {
1524
+ id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
1525
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1526
+ name: prop.alpacaAccount.user.name !== undefined ? {
1527
+ equals: prop.alpacaAccount.user.name
1528
+ } : undefined,
1529
+ },
1530
+ create: {
1531
+ name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
1532
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1533
+ emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
1534
+ image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
1535
+ role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
1536
+ bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
1537
+ jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
1538
+ currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
1539
+ plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
1540
+ },
1541
+ }
1542
+ } : undefined,
1543
+ trades: prop.alpacaAccount.trades ?
1544
+ Array.isArray(prop.alpacaAccount.trades) && prop.alpacaAccount.trades.length > 0
1545
+ ? prop.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1546
+ connect: prop.alpacaAccount.trades.map((item) => ({
1547
+ id: item.id
1548
+ }))
1549
+ }
1550
+ : { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
1551
+ where: {
1552
+ id: item.id !== undefined ? item.id : undefined,
1553
+ },
1554
+ create: {
1555
+ qty: item.qty !== undefined ? item.qty : undefined,
1556
+ price: item.price !== undefined ? item.price : undefined,
1557
+ total: item.total !== undefined ? item.total : undefined,
1558
+ signal: item.signal !== undefined ? item.signal : undefined,
1559
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1560
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1561
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1562
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1563
+ status: item.status !== undefined ? item.status : undefined,
1564
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1565
+ },
1566
+ }))
1567
+ } : undefined,
1568
+ orders: prop.alpacaAccount.orders ?
1569
+ Array.isArray(prop.alpacaAccount.orders) && prop.alpacaAccount.orders.length > 0
1570
+ ? prop.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1571
+ connect: prop.alpacaAccount.orders.map((item) => ({
1572
+ id: item.id
1573
+ }))
1574
+ }
1575
+ : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
1576
+ where: {
1577
+ id: item.id !== undefined ? item.id : undefined,
1578
+ },
1579
+ create: {
1580
+ qty: item.qty !== undefined ? item.qty : undefined,
1581
+ notional: item.notional !== undefined ? item.notional : undefined,
1582
+ side: item.side !== undefined ? item.side : undefined,
1583
+ type: item.type !== undefined ? item.type : undefined,
1584
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1585
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1586
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1587
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1588
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1589
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1590
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1591
+ status: item.status !== undefined ? item.status : undefined,
1592
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1593
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1594
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1595
+ fee: item.fee !== undefined ? item.fee : undefined,
1596
+ },
1597
+ }))
1598
+ } : undefined,
1599
+ positions: prop.alpacaAccount.positions ?
1600
+ Array.isArray(prop.alpacaAccount.positions) && prop.alpacaAccount.positions.length > 0
1601
+ ? prop.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1602
+ connect: prop.alpacaAccount.positions.map((item) => ({
1603
+ id: item.id
1604
+ }))
1605
+ }
1606
+ : { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
1607
+ where: {
1608
+ id: item.id !== undefined ? item.id : undefined,
1609
+ },
1610
+ create: {
1611
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1612
+ qty: item.qty !== undefined ? item.qty : undefined,
1613
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1614
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1615
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1616
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1617
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1618
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1619
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1620
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1621
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1622
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1623
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1624
+ },
1625
+ }))
1626
+ } : undefined,
1553
1627
  },
1554
1628
  }
1555
1629
  } : undefined,