adaptic-backend 1.0.75 → 1.0.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/Account.cjs +255 -190
  2. package/Action.cjs +594 -524
  3. package/Alert.cjs +343 -278
  4. package/AlpacaAccount.cjs +1181 -1021
  5. package/Asset.cjs +478 -368
  6. package/Authenticator.cjs +276 -211
  7. package/Customer.cjs +255 -190
  8. package/NewsArticle.cjs +232 -212
  9. package/NewsArticleAssetSentiment.cjs +345 -290
  10. package/Order.cjs +676 -541
  11. package/Position.cjs +603 -488
  12. package/Session.cjs +279 -214
  13. package/Trade.cjs +748 -613
  14. package/User.cjs +394 -309
  15. package/package.json +1 -1
  16. package/server/Account.d.ts.map +1 -1
  17. package/server/Account.js.map +1 -1
  18. package/server/Account.mjs +255 -190
  19. package/server/Action.d.ts.map +1 -1
  20. package/server/Action.js.map +1 -1
  21. package/server/Action.mjs +594 -524
  22. package/server/Alert.d.ts.map +1 -1
  23. package/server/Alert.js.map +1 -1
  24. package/server/Alert.mjs +343 -278
  25. package/server/AlpacaAccount.d.ts.map +1 -1
  26. package/server/AlpacaAccount.js.map +1 -1
  27. package/server/AlpacaAccount.mjs +1181 -1021
  28. package/server/Asset.d.ts.map +1 -1
  29. package/server/Asset.js.map +1 -1
  30. package/server/Asset.mjs +478 -368
  31. package/server/Authenticator.d.ts.map +1 -1
  32. package/server/Authenticator.js.map +1 -1
  33. package/server/Authenticator.mjs +276 -211
  34. package/server/Customer.d.ts.map +1 -1
  35. package/server/Customer.js.map +1 -1
  36. package/server/Customer.mjs +255 -190
  37. package/server/NewsArticle.d.ts.map +1 -1
  38. package/server/NewsArticle.js.map +1 -1
  39. package/server/NewsArticle.mjs +232 -212
  40. package/server/NewsArticleAssetSentiment.d.ts.map +1 -1
  41. package/server/NewsArticleAssetSentiment.js.map +1 -1
  42. package/server/NewsArticleAssetSentiment.mjs +345 -290
  43. package/server/Order.d.ts.map +1 -1
  44. package/server/Order.js.map +1 -1
  45. package/server/Order.mjs +676 -541
  46. package/server/Position.d.ts.map +1 -1
  47. package/server/Position.js.map +1 -1
  48. package/server/Position.mjs +603 -488
  49. package/server/Session.d.ts.map +1 -1
  50. package/server/Session.js.map +1 -1
  51. package/server/Session.mjs +279 -214
  52. package/server/Trade.d.ts.map +1 -1
  53. package/server/Trade.js.map +1 -1
  54. package/server/Trade.mjs +748 -613
  55. package/server/User.d.ts.map +1 -1
  56. package/server/User.js.map +1 -1
  57. package/server/User.mjs +394 -309
package/server/Alert.mjs CHANGED
@@ -284,108 +284,133 @@ 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
+ typeof props.alpacaAccount.trades[0] === 'object' && Object.keys(props.alpacaAccount.trades).length === 1 && Object.keys(props.alpacaAccount.trades)[0] === 'id'
332
+ ? { connect: props.alpacaAccount.trades.map((item) => ({
333
+ id: item.id
334
+ }))
335
+ }
336
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
337
+ where: {
338
+ id: item.id !== undefined ? item.id : undefined,
339
+ },
340
+ create: {
341
+ qty: item.qty !== undefined ? item.qty : undefined,
342
+ price: item.price !== undefined ? item.price : undefined,
343
+ total: item.total !== undefined ? item.total : undefined,
344
+ signal: item.signal !== undefined ? item.signal : undefined,
345
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
346
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
347
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
348
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
349
+ status: item.status !== undefined ? item.status : undefined,
350
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
351
+ },
352
+ }))
353
+ } : undefined,
354
+ orders: props.alpacaAccount.orders ?
355
+ typeof props.alpacaAccount.orders[0] === 'object' && Object.keys(props.alpacaAccount.orders).length === 1 && Object.keys(props.alpacaAccount.orders)[0] === 'id'
356
+ ? { connect: props.alpacaAccount.orders.map((item) => ({
357
+ id: item.id
358
+ }))
359
+ }
360
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
361
+ where: {
362
+ id: item.id !== undefined ? item.id : undefined,
363
+ },
364
+ create: {
365
+ qty: item.qty !== undefined ? item.qty : undefined,
366
+ notional: item.notional !== undefined ? item.notional : undefined,
367
+ side: item.side !== undefined ? item.side : undefined,
368
+ type: item.type !== undefined ? item.type : undefined,
369
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
370
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
371
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
372
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
373
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
374
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
375
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
376
+ status: item.status !== undefined ? item.status : undefined,
377
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
378
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
379
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
380
+ fee: item.fee !== undefined ? item.fee : undefined,
381
+ },
382
+ }))
383
+ } : undefined,
384
+ positions: props.alpacaAccount.positions ?
385
+ typeof props.alpacaAccount.positions[0] === 'object' && Object.keys(props.alpacaAccount.positions).length === 1 && Object.keys(props.alpacaAccount.positions)[0] === 'id'
386
+ ? { connect: props.alpacaAccount.positions.map((item) => ({
387
+ id: item.id
388
+ }))
389
+ }
390
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
391
+ where: {
392
+ id: item.id !== undefined ? item.id : undefined,
393
+ },
394
+ create: {
395
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
396
+ qty: item.qty !== undefined ? item.qty : undefined,
397
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
398
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
399
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
400
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
401
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
402
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
403
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
404
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
405
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
406
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
407
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
408
+ },
409
+ }))
410
+ } : undefined,
411
+ },
412
+ }
413
+ } : undefined,
389
414
  },
390
415
  };
391
416
  const filteredVariables = removeUndefinedProps(variables);
@@ -1027,94 +1052,114 @@ export const Alert = {
1027
1052
  APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
1028
1053
  configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
1029
1054
  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,
1055
+ user: props.alpacaAccount.user ?
1056
+ typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
1057
+ ? { connect: {
1058
+ id: props.alpacaAccount.user.id
1059
+ }
1060
+ }
1061
+ : { connectOrCreate: {
1062
+ where: {
1063
+ id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
1064
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1065
+ name: props.alpacaAccount.user.name !== undefined ? {
1066
+ equals: props.alpacaAccount.user.name
1067
+ } : undefined,
1068
+ },
1069
+ create: {
1070
+ name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
1071
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1072
+ emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
1073
+ image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
1074
+ role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
1075
+ bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
1076
+ jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1077
+ currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1078
+ plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
1079
+ },
1080
+ }
1081
+ } : undefined,
1082
+ trades: props.alpacaAccount.trades ?
1083
+ typeof props.alpacaAccount.trades[0] === 'object' && Object.keys(props.alpacaAccount.trades).length === 1 && Object.keys(props.alpacaAccount.trades)[0] === 'id'
1084
+ ? { connect: props.alpacaAccount.trades.map((item) => ({
1085
+ id: item.id
1086
+ }))
1087
+ }
1088
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
1089
+ where: {
1090
+ id: item.id !== undefined ? item.id : undefined,
1091
+ },
1092
+ create: {
1093
+ qty: item.qty !== undefined ? item.qty : undefined,
1094
+ price: item.price !== undefined ? item.price : undefined,
1095
+ total: item.total !== undefined ? item.total : undefined,
1096
+ signal: item.signal !== undefined ? item.signal : undefined,
1097
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1098
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1099
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1100
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1101
+ status: item.status !== undefined ? item.status : undefined,
1102
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1103
+ },
1104
+ }))
1105
+ } : undefined,
1106
+ orders: props.alpacaAccount.orders ?
1107
+ typeof props.alpacaAccount.orders[0] === 'object' && Object.keys(props.alpacaAccount.orders).length === 1 && Object.keys(props.alpacaAccount.orders)[0] === 'id'
1108
+ ? { connect: props.alpacaAccount.orders.map((item) => ({
1109
+ id: item.id
1110
+ }))
1111
+ }
1112
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
1113
+ where: {
1114
+ id: item.id !== undefined ? item.id : undefined,
1115
+ },
1116
+ create: {
1117
+ qty: item.qty !== undefined ? item.qty : undefined,
1118
+ notional: item.notional !== undefined ? item.notional : undefined,
1119
+ side: item.side !== undefined ? item.side : undefined,
1120
+ type: item.type !== undefined ? item.type : undefined,
1121
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1122
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1123
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1124
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1125
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1126
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1127
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1128
+ status: item.status !== undefined ? item.status : undefined,
1129
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1130
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1131
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1132
+ fee: item.fee !== undefined ? item.fee : undefined,
1133
+ },
1134
+ }))
1135
+ } : undefined,
1136
+ positions: props.alpacaAccount.positions ?
1137
+ typeof props.alpacaAccount.positions[0] === 'object' && Object.keys(props.alpacaAccount.positions).length === 1 && Object.keys(props.alpacaAccount.positions)[0] === 'id'
1138
+ ? { connect: props.alpacaAccount.positions.map((item) => ({
1139
+ id: item.id
1140
+ }))
1141
+ }
1142
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
1143
+ where: {
1144
+ id: item.id !== undefined ? item.id : undefined,
1145
+ },
1146
+ create: {
1147
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1148
+ qty: item.qty !== undefined ? item.qty : undefined,
1149
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1150
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1151
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1152
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1153
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1154
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1155
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1156
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1157
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1158
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1159
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1160
+ },
1161
+ }))
1162
+ } : undefined,
1118
1163
  },
1119
1164
  }
1120
1165
  } : undefined,
@@ -1462,94 +1507,114 @@ export const Alert = {
1462
1507
  APISecret: prop.alpacaAccount.APISecret !== undefined ? prop.alpacaAccount.APISecret : undefined,
1463
1508
  configuration: prop.alpacaAccount.configuration !== undefined ? prop.alpacaAccount.configuration : undefined,
1464
1509
  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,
1510
+ user: prop.alpacaAccount.user ?
1511
+ typeof prop.alpacaAccount.user === 'object' && Object.keys(prop.alpacaAccount.user).length === 1 && Object.keys(prop.alpacaAccount.user)[0] === 'id'
1512
+ ? { connect: {
1513
+ id: prop.alpacaAccount.user.id
1514
+ }
1515
+ }
1516
+ : { connectOrCreate: {
1517
+ where: {
1518
+ id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
1519
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1520
+ name: prop.alpacaAccount.user.name !== undefined ? {
1521
+ equals: prop.alpacaAccount.user.name
1522
+ } : undefined,
1523
+ },
1524
+ create: {
1525
+ name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
1526
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1527
+ emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
1528
+ image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
1529
+ role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
1530
+ bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
1531
+ jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
1532
+ currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
1533
+ plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
1534
+ },
1535
+ }
1536
+ } : undefined,
1537
+ trades: prop.alpacaAccount.trades ?
1538
+ typeof prop.alpacaAccount.trades[0] === 'object' && Object.keys(prop.alpacaAccount.trades).length === 1 && Object.keys(prop.alpacaAccount.trades)[0] === 'id'
1539
+ ? { connect: prop.alpacaAccount.trades.map((item) => ({
1540
+ id: item.id
1541
+ }))
1542
+ }
1543
+ : { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
1544
+ where: {
1545
+ id: item.id !== undefined ? item.id : undefined,
1546
+ },
1547
+ create: {
1548
+ qty: item.qty !== undefined ? item.qty : undefined,
1549
+ price: item.price !== undefined ? item.price : undefined,
1550
+ total: item.total !== undefined ? item.total : undefined,
1551
+ signal: item.signal !== undefined ? item.signal : undefined,
1552
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1553
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1554
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1555
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1556
+ status: item.status !== undefined ? item.status : undefined,
1557
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1558
+ },
1559
+ }))
1560
+ } : undefined,
1561
+ orders: prop.alpacaAccount.orders ?
1562
+ typeof prop.alpacaAccount.orders[0] === 'object' && Object.keys(prop.alpacaAccount.orders).length === 1 && Object.keys(prop.alpacaAccount.orders)[0] === 'id'
1563
+ ? { connect: prop.alpacaAccount.orders.map((item) => ({
1564
+ id: item.id
1565
+ }))
1566
+ }
1567
+ : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
1568
+ where: {
1569
+ id: item.id !== undefined ? item.id : undefined,
1570
+ },
1571
+ create: {
1572
+ qty: item.qty !== undefined ? item.qty : undefined,
1573
+ notional: item.notional !== undefined ? item.notional : undefined,
1574
+ side: item.side !== undefined ? item.side : undefined,
1575
+ type: item.type !== undefined ? item.type : undefined,
1576
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1577
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1578
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1579
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1580
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1581
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1582
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1583
+ status: item.status !== undefined ? item.status : undefined,
1584
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1585
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1586
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1587
+ fee: item.fee !== undefined ? item.fee : undefined,
1588
+ },
1589
+ }))
1590
+ } : undefined,
1591
+ positions: prop.alpacaAccount.positions ?
1592
+ typeof prop.alpacaAccount.positions[0] === 'object' && Object.keys(prop.alpacaAccount.positions).length === 1 && Object.keys(prop.alpacaAccount.positions)[0] === 'id'
1593
+ ? { connect: prop.alpacaAccount.positions.map((item) => ({
1594
+ id: item.id
1595
+ }))
1596
+ }
1597
+ : { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
1598
+ where: {
1599
+ id: item.id !== undefined ? item.id : undefined,
1600
+ },
1601
+ create: {
1602
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1603
+ qty: item.qty !== undefined ? item.qty : undefined,
1604
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1605
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1606
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1607
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1608
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1609
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1610
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1611
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1612
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1613
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1614
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1615
+ },
1616
+ }))
1617
+ } : undefined,
1553
1618
  },
1554
1619
  }
1555
1620
  } : undefined,