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/Alert.cjs CHANGED
@@ -286,108 +286,136 @@ exports.Alert = {
286
286
  message: props.message !== undefined ? props.message : undefined,
287
287
  type: props.type !== undefined ? props.type : undefined,
288
288
  isRead: props.isRead !== undefined ? props.isRead : undefined,
289
- alpacaAccount: props.alpacaAccount ? {
290
- connectOrCreate: {
291
- where: {
292
- id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
293
- },
294
- create: {
295
- type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
296
- APIKey: props.alpacaAccount.APIKey !== undefined ? props.alpacaAccount.APIKey : undefined,
297
- APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
298
- configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
299
- marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
300
- user: props.alpacaAccount.user ? {
301
- connectOrCreate: {
302
- where: {
303
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
304
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
305
- name: props.alpacaAccount.user.name !== undefined ? {
306
- equals: props.alpacaAccount.user.name
307
- } : undefined,
308
- },
309
- create: {
310
- name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
311
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
312
- emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
313
- image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
314
- role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
315
- bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
316
- jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
317
- currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
318
- plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
319
- },
320
- }
321
- } : undefined,
322
- trades: props.alpacaAccount.trades ? {
323
- connectOrCreate: props.alpacaAccount.trades.map((item) => ({
324
- where: {
325
- id: item.id !== undefined ? item.id : undefined,
326
- },
327
- create: {
328
- qty: item.qty !== undefined ? item.qty : undefined,
329
- price: item.price !== undefined ? item.price : undefined,
330
- total: item.total !== undefined ? item.total : undefined,
331
- signal: item.signal !== undefined ? item.signal : undefined,
332
- strategy: item.strategy !== undefined ? item.strategy : undefined,
333
- analysis: item.analysis !== undefined ? item.analysis : undefined,
334
- confidence: item.confidence !== undefined ? item.confidence : undefined,
335
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
336
- status: item.status !== undefined ? item.status : undefined,
337
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
338
- },
339
- }))
340
- } : undefined,
341
- orders: props.alpacaAccount.orders ? {
342
- connectOrCreate: props.alpacaAccount.orders.map((item) => ({
343
- where: {
344
- id: item.id !== undefined ? item.id : undefined,
345
- },
346
- create: {
347
- qty: item.qty !== undefined ? item.qty : undefined,
348
- notional: item.notional !== undefined ? item.notional : undefined,
349
- side: item.side !== undefined ? item.side : undefined,
350
- type: item.type !== undefined ? item.type : undefined,
351
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
352
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
353
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
354
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
355
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
356
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
357
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
358
- status: item.status !== undefined ? item.status : undefined,
359
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
360
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
361
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
362
- fee: item.fee !== undefined ? item.fee : undefined,
363
- },
364
- }))
365
- } : undefined,
366
- positions: props.alpacaAccount.positions ? {
367
- connectOrCreate: props.alpacaAccount.positions.map((item) => ({
368
- where: {
369
- id: item.id !== undefined ? item.id : undefined,
370
- },
371
- create: {
372
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
373
- qty: item.qty !== undefined ? item.qty : undefined,
374
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
375
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
376
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
377
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
378
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
379
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
380
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
381
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
382
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
383
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
384
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
385
- },
386
- }))
387
- } : undefined,
388
- },
389
- }
390
- } : undefined,
289
+ alpacaAccount: props.alpacaAccount ?
290
+ typeof props.alpacaAccount === 'object' && Object.keys(props.alpacaAccount).length === 1 && Object.keys(props.alpacaAccount)[0] === 'id'
291
+ ? { connect: {
292
+ id: props.alpacaAccount.id
293
+ }
294
+ }
295
+ : { connectOrCreate: {
296
+ where: {
297
+ id: props.alpacaAccount.id !== undefined ? props.alpacaAccount.id : undefined,
298
+ },
299
+ create: {
300
+ type: props.alpacaAccount.type !== undefined ? props.alpacaAccount.type : undefined,
301
+ APIKey: props.alpacaAccount.APIKey !== undefined ? props.alpacaAccount.APIKey : undefined,
302
+ APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
303
+ configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
304
+ marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
305
+ user: props.alpacaAccount.user ?
306
+ typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
307
+ ? { connect: {
308
+ id: props.alpacaAccount.user.id
309
+ }
310
+ }
311
+ : { connectOrCreate: {
312
+ where: {
313
+ id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
314
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
315
+ name: props.alpacaAccount.user.name !== undefined ? {
316
+ equals: props.alpacaAccount.user.name
317
+ } : undefined,
318
+ },
319
+ create: {
320
+ name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
321
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
322
+ emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
323
+ image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
324
+ role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
325
+ bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
326
+ jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
327
+ currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
328
+ plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
329
+ },
330
+ }
331
+ } : undefined,
332
+ trades: props.alpacaAccount.trades ?
333
+ Array.isArray(props.alpacaAccount.trades) && props.alpacaAccount.trades.length > 0
334
+ ? props.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
335
+ connect: props.alpacaAccount.trades.map((item) => ({
336
+ id: item.id
337
+ }))
338
+ }
339
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
340
+ where: {
341
+ id: item.id !== undefined ? item.id : undefined,
342
+ },
343
+ create: {
344
+ qty: item.qty !== undefined ? item.qty : undefined,
345
+ price: item.price !== undefined ? item.price : undefined,
346
+ total: item.total !== undefined ? item.total : undefined,
347
+ signal: item.signal !== undefined ? item.signal : undefined,
348
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
349
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
350
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
351
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
352
+ status: item.status !== undefined ? item.status : undefined,
353
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
354
+ },
355
+ }))
356
+ } : undefined,
357
+ orders: props.alpacaAccount.orders ?
358
+ Array.isArray(props.alpacaAccount.orders) && props.alpacaAccount.orders.length > 0
359
+ ? props.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
360
+ connect: props.alpacaAccount.orders.map((item) => ({
361
+ id: item.id
362
+ }))
363
+ }
364
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
365
+ where: {
366
+ id: item.id !== undefined ? item.id : undefined,
367
+ },
368
+ create: {
369
+ qty: item.qty !== undefined ? item.qty : undefined,
370
+ notional: item.notional !== undefined ? item.notional : undefined,
371
+ side: item.side !== undefined ? item.side : undefined,
372
+ type: item.type !== undefined ? item.type : undefined,
373
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
374
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
375
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
376
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
377
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
378
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
379
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
380
+ status: item.status !== undefined ? item.status : undefined,
381
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
382
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
383
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
384
+ fee: item.fee !== undefined ? item.fee : undefined,
385
+ },
386
+ }))
387
+ } : undefined,
388
+ positions: props.alpacaAccount.positions ?
389
+ Array.isArray(props.alpacaAccount.positions) && props.alpacaAccount.positions.length > 0
390
+ ? props.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
391
+ connect: props.alpacaAccount.positions.map((item) => ({
392
+ id: item.id
393
+ }))
394
+ }
395
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
396
+ where: {
397
+ id: item.id !== undefined ? item.id : undefined,
398
+ },
399
+ create: {
400
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
401
+ qty: item.qty !== undefined ? item.qty : undefined,
402
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
403
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
404
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
405
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
406
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
407
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
408
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
409
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
410
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
411
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
412
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
413
+ },
414
+ }))
415
+ } : undefined,
416
+ },
417
+ }
418
+ } : undefined,
391
419
  },
392
420
  };
393
421
  const filteredVariables = (0, utils_1.removeUndefinedProps)(variables);
@@ -1029,94 +1057,117 @@ exports.Alert = {
1029
1057
  APISecret: props.alpacaAccount.APISecret !== undefined ? props.alpacaAccount.APISecret : undefined,
1030
1058
  configuration: props.alpacaAccount.configuration !== undefined ? props.alpacaAccount.configuration : undefined,
1031
1059
  marketOpen: props.alpacaAccount.marketOpen !== undefined ? props.alpacaAccount.marketOpen : undefined,
1032
- user: props.alpacaAccount.user ? {
1033
- connectOrCreate: {
1034
- where: {
1035
- id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
1036
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1037
- name: props.alpacaAccount.user.name !== undefined ? {
1038
- equals: props.alpacaAccount.user.name
1039
- } : undefined,
1040
- },
1041
- create: {
1042
- name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
1043
- email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1044
- emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
1045
- image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
1046
- role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
1047
- bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
1048
- jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1049
- currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1050
- plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
1051
- },
1052
- }
1053
- } : undefined,
1054
- trades: props.alpacaAccount.trades ? {
1055
- connectOrCreate: props.alpacaAccount.trades.map((item) => ({
1056
- where: {
1057
- id: item.id !== undefined ? item.id : undefined,
1058
- },
1059
- create: {
1060
- qty: item.qty !== undefined ? item.qty : undefined,
1061
- price: item.price !== undefined ? item.price : undefined,
1062
- total: item.total !== undefined ? item.total : undefined,
1063
- signal: item.signal !== undefined ? item.signal : undefined,
1064
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1065
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1066
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1067
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1068
- status: item.status !== undefined ? item.status : undefined,
1069
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1070
- },
1071
- }))
1072
- } : undefined,
1073
- orders: props.alpacaAccount.orders ? {
1074
- connectOrCreate: props.alpacaAccount.orders.map((item) => ({
1075
- where: {
1076
- id: item.id !== undefined ? item.id : undefined,
1077
- },
1078
- create: {
1079
- qty: item.qty !== undefined ? item.qty : undefined,
1080
- notional: item.notional !== undefined ? item.notional : undefined,
1081
- side: item.side !== undefined ? item.side : undefined,
1082
- type: item.type !== undefined ? item.type : undefined,
1083
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1084
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1085
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1086
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1087
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1088
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1089
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1090
- status: item.status !== undefined ? item.status : undefined,
1091
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1092
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1093
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1094
- fee: item.fee !== undefined ? item.fee : undefined,
1095
- },
1096
- }))
1097
- } : undefined,
1098
- positions: props.alpacaAccount.positions ? {
1099
- connectOrCreate: props.alpacaAccount.positions.map((item) => ({
1100
- where: {
1101
- id: item.id !== undefined ? item.id : undefined,
1102
- },
1103
- create: {
1104
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1105
- qty: item.qty !== undefined ? item.qty : undefined,
1106
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1107
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1108
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1109
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1110
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1111
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1112
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1113
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1114
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1115
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1116
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1117
- },
1118
- }))
1119
- } : undefined,
1060
+ user: props.alpacaAccount.user ?
1061
+ typeof props.alpacaAccount.user === 'object' && Object.keys(props.alpacaAccount.user).length === 1 && Object.keys(props.alpacaAccount.user)[0] === 'id'
1062
+ ? { connect: {
1063
+ id: props.alpacaAccount.user.id
1064
+ }
1065
+ }
1066
+ : { connectOrCreate: {
1067
+ where: {
1068
+ id: props.alpacaAccount.user.id !== undefined ? props.alpacaAccount.user.id : undefined,
1069
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1070
+ name: props.alpacaAccount.user.name !== undefined ? {
1071
+ equals: props.alpacaAccount.user.name
1072
+ } : undefined,
1073
+ },
1074
+ create: {
1075
+ name: props.alpacaAccount.user.name !== undefined ? props.alpacaAccount.user.name : undefined,
1076
+ email: props.alpacaAccount.user.email !== undefined ? props.alpacaAccount.user.email : undefined,
1077
+ emailVerified: props.alpacaAccount.user.emailVerified !== undefined ? props.alpacaAccount.user.emailVerified : undefined,
1078
+ image: props.alpacaAccount.user.image !== undefined ? props.alpacaAccount.user.image : undefined,
1079
+ role: props.alpacaAccount.user.role !== undefined ? props.alpacaAccount.user.role : undefined,
1080
+ bio: props.alpacaAccount.user.bio !== undefined ? props.alpacaAccount.user.bio : undefined,
1081
+ jobTitle: props.alpacaAccount.user.jobTitle !== undefined ? props.alpacaAccount.user.jobTitle : undefined,
1082
+ currentAccount: props.alpacaAccount.user.currentAccount !== undefined ? props.alpacaAccount.user.currentAccount : undefined,
1083
+ plan: props.alpacaAccount.user.plan !== undefined ? props.alpacaAccount.user.plan : undefined,
1084
+ },
1085
+ }
1086
+ } : undefined,
1087
+ trades: props.alpacaAccount.trades ?
1088
+ Array.isArray(props.alpacaAccount.trades) && props.alpacaAccount.trades.length > 0
1089
+ ? props.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1090
+ connect: props.alpacaAccount.trades.map((item) => ({
1091
+ id: item.id
1092
+ }))
1093
+ }
1094
+ : { connectOrCreate: props.alpacaAccount.trades.map((item) => ({
1095
+ where: {
1096
+ id: item.id !== undefined ? item.id : undefined,
1097
+ },
1098
+ create: {
1099
+ qty: item.qty !== undefined ? item.qty : undefined,
1100
+ price: item.price !== undefined ? item.price : undefined,
1101
+ total: item.total !== undefined ? item.total : undefined,
1102
+ signal: item.signal !== undefined ? item.signal : undefined,
1103
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1104
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1105
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1106
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1107
+ status: item.status !== undefined ? item.status : undefined,
1108
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1109
+ },
1110
+ }))
1111
+ } : undefined,
1112
+ orders: props.alpacaAccount.orders ?
1113
+ Array.isArray(props.alpacaAccount.orders) && props.alpacaAccount.orders.length > 0
1114
+ ? props.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1115
+ connect: props.alpacaAccount.orders.map((item) => ({
1116
+ id: item.id
1117
+ }))
1118
+ }
1119
+ : { connectOrCreate: props.alpacaAccount.orders.map((item) => ({
1120
+ where: {
1121
+ id: item.id !== undefined ? item.id : undefined,
1122
+ },
1123
+ create: {
1124
+ qty: item.qty !== undefined ? item.qty : undefined,
1125
+ notional: item.notional !== undefined ? item.notional : undefined,
1126
+ side: item.side !== undefined ? item.side : undefined,
1127
+ type: item.type !== undefined ? item.type : undefined,
1128
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1129
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1130
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1131
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1132
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1133
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1134
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1135
+ status: item.status !== undefined ? item.status : undefined,
1136
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1137
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1138
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1139
+ fee: item.fee !== undefined ? item.fee : undefined,
1140
+ },
1141
+ }))
1142
+ } : undefined,
1143
+ positions: props.alpacaAccount.positions ?
1144
+ Array.isArray(props.alpacaAccount.positions) && props.alpacaAccount.positions.length > 0
1145
+ ? props.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1146
+ connect: props.alpacaAccount.positions.map((item) => ({
1147
+ id: item.id
1148
+ }))
1149
+ }
1150
+ : { connectOrCreate: props.alpacaAccount.positions.map((item) => ({
1151
+ where: {
1152
+ id: item.id !== undefined ? item.id : undefined,
1153
+ },
1154
+ create: {
1155
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1156
+ qty: item.qty !== undefined ? item.qty : undefined,
1157
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1158
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1159
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1160
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1161
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1162
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1163
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1164
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1165
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1166
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1167
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1168
+ },
1169
+ }))
1170
+ } : undefined,
1120
1171
  },
1121
1172
  }
1122
1173
  } : undefined,
@@ -1464,94 +1515,117 @@ exports.Alert = {
1464
1515
  APISecret: prop.alpacaAccount.APISecret !== undefined ? prop.alpacaAccount.APISecret : undefined,
1465
1516
  configuration: prop.alpacaAccount.configuration !== undefined ? prop.alpacaAccount.configuration : undefined,
1466
1517
  marketOpen: prop.alpacaAccount.marketOpen !== undefined ? prop.alpacaAccount.marketOpen : undefined,
1467
- user: prop.alpacaAccount.user ? {
1468
- connectOrCreate: {
1469
- where: {
1470
- id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
1471
- email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1472
- name: prop.alpacaAccount.user.name !== undefined ? {
1473
- equals: prop.alpacaAccount.user.name
1474
- } : undefined,
1475
- },
1476
- create: {
1477
- name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
1478
- email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1479
- emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
1480
- image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
1481
- role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
1482
- bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
1483
- jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
1484
- currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
1485
- plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
1486
- },
1487
- }
1488
- } : undefined,
1489
- trades: prop.alpacaAccount.trades ? {
1490
- connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
1491
- where: {
1492
- id: item.id !== undefined ? item.id : undefined,
1493
- },
1494
- create: {
1495
- qty: item.qty !== undefined ? item.qty : undefined,
1496
- price: item.price !== undefined ? item.price : undefined,
1497
- total: item.total !== undefined ? item.total : undefined,
1498
- signal: item.signal !== undefined ? item.signal : undefined,
1499
- strategy: item.strategy !== undefined ? item.strategy : undefined,
1500
- analysis: item.analysis !== undefined ? item.analysis : undefined,
1501
- confidence: item.confidence !== undefined ? item.confidence : undefined,
1502
- timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1503
- status: item.status !== undefined ? item.status : undefined,
1504
- optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1505
- },
1506
- }))
1507
- } : undefined,
1508
- orders: prop.alpacaAccount.orders ? {
1509
- connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
1510
- where: {
1511
- id: item.id !== undefined ? item.id : undefined,
1512
- },
1513
- create: {
1514
- qty: item.qty !== undefined ? item.qty : undefined,
1515
- notional: item.notional !== undefined ? item.notional : undefined,
1516
- side: item.side !== undefined ? item.side : undefined,
1517
- type: item.type !== undefined ? item.type : undefined,
1518
- timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1519
- limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1520
- stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1521
- trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1522
- trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1523
- extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1524
- clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1525
- status: item.status !== undefined ? item.status : undefined,
1526
- submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1527
- filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1528
- filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1529
- fee: item.fee !== undefined ? item.fee : undefined,
1530
- },
1531
- }))
1532
- } : undefined,
1533
- positions: prop.alpacaAccount.positions ? {
1534
- connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
1535
- where: {
1536
- id: item.id !== undefined ? item.id : undefined,
1537
- },
1538
- create: {
1539
- averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1540
- qty: item.qty !== undefined ? item.qty : undefined,
1541
- qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1542
- marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1543
- costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1544
- unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1545
- unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1546
- unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1547
- unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1548
- currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1549
- lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1550
- changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1551
- assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1552
- },
1553
- }))
1554
- } : undefined,
1518
+ user: prop.alpacaAccount.user ?
1519
+ typeof prop.alpacaAccount.user === 'object' && Object.keys(prop.alpacaAccount.user).length === 1 && Object.keys(prop.alpacaAccount.user)[0] === 'id'
1520
+ ? { connect: {
1521
+ id: prop.alpacaAccount.user.id
1522
+ }
1523
+ }
1524
+ : { connectOrCreate: {
1525
+ where: {
1526
+ id: prop.alpacaAccount.user.id !== undefined ? prop.alpacaAccount.user.id : undefined,
1527
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1528
+ name: prop.alpacaAccount.user.name !== undefined ? {
1529
+ equals: prop.alpacaAccount.user.name
1530
+ } : undefined,
1531
+ },
1532
+ create: {
1533
+ name: prop.alpacaAccount.user.name !== undefined ? prop.alpacaAccount.user.name : undefined,
1534
+ email: prop.alpacaAccount.user.email !== undefined ? prop.alpacaAccount.user.email : undefined,
1535
+ emailVerified: prop.alpacaAccount.user.emailVerified !== undefined ? prop.alpacaAccount.user.emailVerified : undefined,
1536
+ image: prop.alpacaAccount.user.image !== undefined ? prop.alpacaAccount.user.image : undefined,
1537
+ role: prop.alpacaAccount.user.role !== undefined ? prop.alpacaAccount.user.role : undefined,
1538
+ bio: prop.alpacaAccount.user.bio !== undefined ? prop.alpacaAccount.user.bio : undefined,
1539
+ jobTitle: prop.alpacaAccount.user.jobTitle !== undefined ? prop.alpacaAccount.user.jobTitle : undefined,
1540
+ currentAccount: prop.alpacaAccount.user.currentAccount !== undefined ? prop.alpacaAccount.user.currentAccount : undefined,
1541
+ plan: prop.alpacaAccount.user.plan !== undefined ? prop.alpacaAccount.user.plan : undefined,
1542
+ },
1543
+ }
1544
+ } : undefined,
1545
+ trades: prop.alpacaAccount.trades ?
1546
+ Array.isArray(prop.alpacaAccount.trades) && prop.alpacaAccount.trades.length > 0
1547
+ ? prop.alpacaAccount.trades.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1548
+ connect: prop.alpacaAccount.trades.map((item) => ({
1549
+ id: item.id
1550
+ }))
1551
+ }
1552
+ : { connectOrCreate: prop.alpacaAccount.trades.map((item) => ({
1553
+ where: {
1554
+ id: item.id !== undefined ? item.id : undefined,
1555
+ },
1556
+ create: {
1557
+ qty: item.qty !== undefined ? item.qty : undefined,
1558
+ price: item.price !== undefined ? item.price : undefined,
1559
+ total: item.total !== undefined ? item.total : undefined,
1560
+ signal: item.signal !== undefined ? item.signal : undefined,
1561
+ strategy: item.strategy !== undefined ? item.strategy : undefined,
1562
+ analysis: item.analysis !== undefined ? item.analysis : undefined,
1563
+ confidence: item.confidence !== undefined ? item.confidence : undefined,
1564
+ timestamp: item.timestamp !== undefined ? item.timestamp : undefined,
1565
+ status: item.status !== undefined ? item.status : undefined,
1566
+ optionContractType: item.optionContractType !== undefined ? item.optionContractType : undefined,
1567
+ },
1568
+ }))
1569
+ } : undefined,
1570
+ orders: prop.alpacaAccount.orders ?
1571
+ Array.isArray(prop.alpacaAccount.orders) && prop.alpacaAccount.orders.length > 0
1572
+ ? prop.alpacaAccount.orders.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1573
+ connect: prop.alpacaAccount.orders.map((item) => ({
1574
+ id: item.id
1575
+ }))
1576
+ }
1577
+ : { connectOrCreate: prop.alpacaAccount.orders.map((item) => ({
1578
+ where: {
1579
+ id: item.id !== undefined ? item.id : undefined,
1580
+ },
1581
+ create: {
1582
+ qty: item.qty !== undefined ? item.qty : undefined,
1583
+ notional: item.notional !== undefined ? item.notional : undefined,
1584
+ side: item.side !== undefined ? item.side : undefined,
1585
+ type: item.type !== undefined ? item.type : undefined,
1586
+ timeInForce: item.timeInForce !== undefined ? item.timeInForce : undefined,
1587
+ limitPrice: item.limitPrice !== undefined ? item.limitPrice : undefined,
1588
+ stopPrice: item.stopPrice !== undefined ? item.stopPrice : undefined,
1589
+ trailPrice: item.trailPrice !== undefined ? item.trailPrice : undefined,
1590
+ trailPercent: item.trailPercent !== undefined ? item.trailPercent : undefined,
1591
+ extendedHours: item.extendedHours !== undefined ? item.extendedHours : undefined,
1592
+ clientOrderId: item.clientOrderId !== undefined ? item.clientOrderId : undefined,
1593
+ status: item.status !== undefined ? item.status : undefined,
1594
+ submittedAt: item.submittedAt !== undefined ? item.submittedAt : undefined,
1595
+ filledAt: item.filledAt !== undefined ? item.filledAt : undefined,
1596
+ filledAvgPrice: item.filledAvgPrice !== undefined ? item.filledAvgPrice : undefined,
1597
+ fee: item.fee !== undefined ? item.fee : undefined,
1598
+ },
1599
+ }))
1600
+ } : undefined,
1601
+ positions: prop.alpacaAccount.positions ?
1602
+ Array.isArray(prop.alpacaAccount.positions) && prop.alpacaAccount.positions.length > 0
1603
+ ? prop.alpacaAccount.positions.every((item) => typeof item === 'object' && 'id' in item && Object.keys(item).length === 1) && {
1604
+ connect: prop.alpacaAccount.positions.map((item) => ({
1605
+ id: item.id
1606
+ }))
1607
+ }
1608
+ : { connectOrCreate: prop.alpacaAccount.positions.map((item) => ({
1609
+ where: {
1610
+ id: item.id !== undefined ? item.id : undefined,
1611
+ },
1612
+ create: {
1613
+ averageEntryPrice: item.averageEntryPrice !== undefined ? item.averageEntryPrice : undefined,
1614
+ qty: item.qty !== undefined ? item.qty : undefined,
1615
+ qtyAvailable: item.qtyAvailable !== undefined ? item.qtyAvailable : undefined,
1616
+ marketValue: item.marketValue !== undefined ? item.marketValue : undefined,
1617
+ costBasis: item.costBasis !== undefined ? item.costBasis : undefined,
1618
+ unrealizedPL: item.unrealizedPL !== undefined ? item.unrealizedPL : undefined,
1619
+ unrealizedPLPC: item.unrealizedPLPC !== undefined ? item.unrealizedPLPC : undefined,
1620
+ unrealisedIntradayPL: item.unrealisedIntradayPL !== undefined ? item.unrealisedIntradayPL : undefined,
1621
+ unrealisedIntradayPLPC: item.unrealisedIntradayPLPC !== undefined ? item.unrealisedIntradayPLPC : undefined,
1622
+ currentPrice: item.currentPrice !== undefined ? item.currentPrice : undefined,
1623
+ lastTradePrice: item.lastTradePrice !== undefined ? item.lastTradePrice : undefined,
1624
+ changeToday: item.changeToday !== undefined ? item.changeToday : undefined,
1625
+ assetMarginable: item.assetMarginable !== undefined ? item.assetMarginable : undefined,
1626
+ },
1627
+ }))
1628
+ } : undefined,
1555
1629
  },
1556
1630
  }
1557
1631
  } : undefined,