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/Customer.cjs CHANGED
@@ -209,84 +209,109 @@ exports.Customer = {
209
209
  stripeSubscriptionId: props.stripeSubscriptionId !== undefined ? props.stripeSubscriptionId : undefined,
210
210
  stripePriceId: props.stripePriceId !== undefined ? props.stripePriceId : undefined,
211
211
  stripeCurrentPeriodEnd: props.stripeCurrentPeriodEnd !== undefined ? props.stripeCurrentPeriodEnd : undefined,
212
- users: props.users ? {
213
- connectOrCreate: props.users.map((item) => ({
214
- where: {
215
- id: item.id !== undefined ? item.id : undefined,
216
- email: item.email !== undefined ? item.email : undefined,
217
- name: item.name !== undefined ? {
218
- equals: item.name
219
- } : undefined,
220
- },
221
- create: {
222
- name: item.name !== undefined ? item.name : undefined,
223
- email: item.email !== undefined ? item.email : undefined,
224
- emailVerified: item.emailVerified !== undefined ? item.emailVerified : undefined,
225
- image: item.image !== undefined ? item.image : undefined,
226
- role: item.role !== undefined ? item.role : undefined,
227
- bio: item.bio !== undefined ? item.bio : undefined,
228
- jobTitle: item.jobTitle !== undefined ? item.jobTitle : undefined,
229
- currentAccount: item.currentAccount !== undefined ? item.currentAccount : undefined,
230
- plan: item.plan !== undefined ? item.plan : undefined,
231
- accounts: item.accounts ? {
232
- connectOrCreate: item.accounts.map((item) => ({
233
- where: {
234
- id: item.id !== undefined ? item.id : undefined,
235
- },
236
- create: {
237
- type: item.type !== undefined ? item.type : undefined,
238
- provider: item.provider !== undefined ? item.provider : undefined,
239
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
240
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
241
- access_token: item.access_token !== undefined ? item.access_token : undefined,
242
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
243
- token_type: item.token_type !== undefined ? item.token_type : undefined,
244
- scope: item.scope !== undefined ? item.scope : undefined,
245
- id_token: item.id_token !== undefined ? item.id_token : undefined,
246
- session_state: item.session_state !== undefined ? item.session_state : undefined,
247
- },
248
- }))
249
- } : undefined,
250
- sessions: item.sessions ? {
251
- connectOrCreate: item.sessions.map((item) => ({
252
- where: {
253
- id: item.id !== undefined ? item.id : undefined,
254
- },
255
- create: {
256
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
257
- expires: item.expires !== undefined ? item.expires : undefined,
258
- },
259
- }))
260
- } : undefined,
261
- authenticators: item.authenticators ? {
262
- connectOrCreate: item.authenticators.map((item) => ({
263
- where: {
264
- id: item.id !== undefined ? item.id : undefined,
265
- },
266
- create: {
267
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
268
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
269
- counter: item.counter !== undefined ? item.counter : undefined,
270
- },
271
- }))
272
- } : undefined,
273
- alpacaAccounts: item.alpacaAccounts ? {
274
- connectOrCreate: item.alpacaAccounts.map((item) => ({
275
- where: {
276
- id: item.id !== undefined ? item.id : undefined,
277
- },
278
- create: {
279
- type: item.type !== undefined ? item.type : undefined,
280
- APIKey: item.APIKey !== undefined ? item.APIKey : undefined,
281
- APISecret: item.APISecret !== undefined ? item.APISecret : undefined,
282
- configuration: item.configuration !== undefined ? item.configuration : undefined,
283
- marketOpen: item.marketOpen !== undefined ? item.marketOpen : undefined,
284
- },
285
- }))
286
- } : undefined,
287
- },
288
- }))
289
- } : undefined,
212
+ users: props.users ?
213
+ typeof props.users[0] === 'object' && Object.keys(props.users).length === 1 && Object.keys(props.users)[0] === 'id'
214
+ ? { connect: props.users.map((item) => ({
215
+ id: item.id
216
+ }))
217
+ }
218
+ : { connectOrCreate: props.users.map((item) => ({
219
+ where: {
220
+ id: item.id !== undefined ? item.id : undefined,
221
+ email: item.email !== undefined ? item.email : undefined,
222
+ name: item.name !== undefined ? {
223
+ equals: item.name
224
+ } : undefined,
225
+ },
226
+ create: {
227
+ name: item.name !== undefined ? item.name : undefined,
228
+ email: item.email !== undefined ? item.email : undefined,
229
+ emailVerified: item.emailVerified !== undefined ? item.emailVerified : undefined,
230
+ image: item.image !== undefined ? item.image : undefined,
231
+ role: item.role !== undefined ? item.role : undefined,
232
+ bio: item.bio !== undefined ? item.bio : undefined,
233
+ jobTitle: item.jobTitle !== undefined ? item.jobTitle : undefined,
234
+ currentAccount: item.currentAccount !== undefined ? item.currentAccount : undefined,
235
+ plan: item.plan !== undefined ? item.plan : undefined,
236
+ accounts: item.accounts ?
237
+ typeof item.accounts[0] === 'object' && Object.keys(item.accounts).length === 1 && Object.keys(item.accounts)[0] === 'id'
238
+ ? { connect: item.accounts.map((item) => ({
239
+ id: item.id
240
+ }))
241
+ }
242
+ : { connectOrCreate: item.accounts.map((item) => ({
243
+ where: {
244
+ id: item.id !== undefined ? item.id : undefined,
245
+ },
246
+ create: {
247
+ type: item.type !== undefined ? item.type : undefined,
248
+ provider: item.provider !== undefined ? item.provider : undefined,
249
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
250
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
251
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
252
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
253
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
254
+ scope: item.scope !== undefined ? item.scope : undefined,
255
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
256
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
257
+ },
258
+ }))
259
+ } : undefined,
260
+ sessions: item.sessions ?
261
+ typeof item.sessions[0] === 'object' && Object.keys(item.sessions).length === 1 && Object.keys(item.sessions)[0] === 'id'
262
+ ? { connect: item.sessions.map((item) => ({
263
+ id: item.id
264
+ }))
265
+ }
266
+ : { connectOrCreate: item.sessions.map((item) => ({
267
+ where: {
268
+ id: item.id !== undefined ? item.id : undefined,
269
+ },
270
+ create: {
271
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
272
+ expires: item.expires !== undefined ? item.expires : undefined,
273
+ },
274
+ }))
275
+ } : undefined,
276
+ authenticators: item.authenticators ?
277
+ typeof item.authenticators[0] === 'object' && Object.keys(item.authenticators).length === 1 && Object.keys(item.authenticators)[0] === 'id'
278
+ ? { connect: item.authenticators.map((item) => ({
279
+ id: item.id
280
+ }))
281
+ }
282
+ : { connectOrCreate: item.authenticators.map((item) => ({
283
+ where: {
284
+ id: item.id !== undefined ? item.id : undefined,
285
+ },
286
+ create: {
287
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
288
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
289
+ counter: item.counter !== undefined ? item.counter : undefined,
290
+ },
291
+ }))
292
+ } : undefined,
293
+ alpacaAccounts: item.alpacaAccounts ?
294
+ typeof item.alpacaAccounts[0] === 'object' && Object.keys(item.alpacaAccounts).length === 1 && Object.keys(item.alpacaAccounts)[0] === 'id'
295
+ ? { connect: item.alpacaAccounts.map((item) => ({
296
+ id: item.id
297
+ }))
298
+ }
299
+ : { connectOrCreate: item.alpacaAccounts.map((item) => ({
300
+ where: {
301
+ id: item.id !== undefined ? item.id : undefined,
302
+ },
303
+ create: {
304
+ type: item.type !== undefined ? item.type : undefined,
305
+ APIKey: item.APIKey !== undefined ? item.APIKey : undefined,
306
+ APISecret: item.APISecret !== undefined ? item.APISecret : undefined,
307
+ configuration: item.configuration !== undefined ? item.configuration : undefined,
308
+ marketOpen: item.marketOpen !== undefined ? item.marketOpen : undefined,
309
+ },
310
+ }))
311
+ } : undefined,
312
+ },
313
+ }))
314
+ } : undefined,
290
315
  },
291
316
  };
292
317
  const filteredVariables = (0, utils_1.removeUndefinedProps)(variables);
@@ -760,62 +785,82 @@ exports.Customer = {
760
785
  jobTitle: item.jobTitle !== undefined ? item.jobTitle : undefined,
761
786
  currentAccount: item.currentAccount !== undefined ? item.currentAccount : undefined,
762
787
  plan: item.plan !== undefined ? item.plan : undefined,
763
- accounts: item.accounts ? {
764
- connectOrCreate: item.accounts.map((item) => ({
765
- where: {
766
- id: item.id !== undefined ? item.id : undefined,
767
- },
768
- create: {
769
- type: item.type !== undefined ? item.type : undefined,
770
- provider: item.provider !== undefined ? item.provider : undefined,
771
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
772
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
773
- access_token: item.access_token !== undefined ? item.access_token : undefined,
774
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
775
- token_type: item.token_type !== undefined ? item.token_type : undefined,
776
- scope: item.scope !== undefined ? item.scope : undefined,
777
- id_token: item.id_token !== undefined ? item.id_token : undefined,
778
- session_state: item.session_state !== undefined ? item.session_state : undefined,
779
- },
780
- }))
781
- } : undefined,
782
- sessions: item.sessions ? {
783
- connectOrCreate: item.sessions.map((item) => ({
784
- where: {
785
- id: item.id !== undefined ? item.id : undefined,
786
- },
787
- create: {
788
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
789
- expires: item.expires !== undefined ? item.expires : undefined,
790
- },
791
- }))
792
- } : undefined,
793
- authenticators: item.authenticators ? {
794
- connectOrCreate: item.authenticators.map((item) => ({
795
- where: {
796
- id: item.id !== undefined ? item.id : undefined,
797
- },
798
- create: {
799
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
800
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
801
- counter: item.counter !== undefined ? item.counter : undefined,
802
- },
803
- }))
804
- } : undefined,
805
- alpacaAccounts: item.alpacaAccounts ? {
806
- connectOrCreate: item.alpacaAccounts.map((item) => ({
807
- where: {
808
- id: item.id !== undefined ? item.id : undefined,
809
- },
810
- create: {
811
- type: item.type !== undefined ? item.type : undefined,
812
- APIKey: item.APIKey !== undefined ? item.APIKey : undefined,
813
- APISecret: item.APISecret !== undefined ? item.APISecret : undefined,
814
- configuration: item.configuration !== undefined ? item.configuration : undefined,
815
- marketOpen: item.marketOpen !== undefined ? item.marketOpen : undefined,
816
- },
817
- }))
818
- } : undefined,
788
+ accounts: item.accounts ?
789
+ typeof item.accounts[0] === 'object' && Object.keys(item.accounts).length === 1 && Object.keys(item.accounts)[0] === 'id'
790
+ ? { connect: item.accounts.map((item) => ({
791
+ id: item.id
792
+ }))
793
+ }
794
+ : { connectOrCreate: item.accounts.map((item) => ({
795
+ where: {
796
+ id: item.id !== undefined ? item.id : undefined,
797
+ },
798
+ create: {
799
+ type: item.type !== undefined ? item.type : undefined,
800
+ provider: item.provider !== undefined ? item.provider : undefined,
801
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
802
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
803
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
804
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
805
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
806
+ scope: item.scope !== undefined ? item.scope : undefined,
807
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
808
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
809
+ },
810
+ }))
811
+ } : undefined,
812
+ sessions: item.sessions ?
813
+ typeof item.sessions[0] === 'object' && Object.keys(item.sessions).length === 1 && Object.keys(item.sessions)[0] === 'id'
814
+ ? { connect: item.sessions.map((item) => ({
815
+ id: item.id
816
+ }))
817
+ }
818
+ : { connectOrCreate: item.sessions.map((item) => ({
819
+ where: {
820
+ id: item.id !== undefined ? item.id : undefined,
821
+ },
822
+ create: {
823
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
824
+ expires: item.expires !== undefined ? item.expires : undefined,
825
+ },
826
+ }))
827
+ } : undefined,
828
+ authenticators: item.authenticators ?
829
+ typeof item.authenticators[0] === 'object' && Object.keys(item.authenticators).length === 1 && Object.keys(item.authenticators)[0] === 'id'
830
+ ? { connect: item.authenticators.map((item) => ({
831
+ id: item.id
832
+ }))
833
+ }
834
+ : { connectOrCreate: item.authenticators.map((item) => ({
835
+ where: {
836
+ id: item.id !== undefined ? item.id : undefined,
837
+ },
838
+ create: {
839
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
840
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
841
+ counter: item.counter !== undefined ? item.counter : undefined,
842
+ },
843
+ }))
844
+ } : undefined,
845
+ alpacaAccounts: item.alpacaAccounts ?
846
+ typeof item.alpacaAccounts[0] === 'object' && Object.keys(item.alpacaAccounts).length === 1 && Object.keys(item.alpacaAccounts)[0] === 'id'
847
+ ? { connect: item.alpacaAccounts.map((item) => ({
848
+ id: item.id
849
+ }))
850
+ }
851
+ : { connectOrCreate: item.alpacaAccounts.map((item) => ({
852
+ where: {
853
+ id: item.id !== undefined ? item.id : undefined,
854
+ },
855
+ create: {
856
+ type: item.type !== undefined ? item.type : undefined,
857
+ APIKey: item.APIKey !== undefined ? item.APIKey : undefined,
858
+ APISecret: item.APISecret !== undefined ? item.APISecret : undefined,
859
+ configuration: item.configuration !== undefined ? item.configuration : undefined,
860
+ marketOpen: item.marketOpen !== undefined ? item.marketOpen : undefined,
861
+ },
862
+ }))
863
+ } : undefined,
819
864
  },
820
865
  }))
821
866
  } : undefined,
@@ -1073,62 +1118,82 @@ exports.Customer = {
1073
1118
  jobTitle: item.jobTitle !== undefined ? item.jobTitle : undefined,
1074
1119
  currentAccount: item.currentAccount !== undefined ? item.currentAccount : undefined,
1075
1120
  plan: item.plan !== undefined ? item.plan : undefined,
1076
- accounts: item.accounts ? {
1077
- connectOrCreate: item.accounts.map((item) => ({
1078
- where: {
1079
- id: item.id !== undefined ? item.id : undefined,
1080
- },
1081
- create: {
1082
- type: item.type !== undefined ? item.type : undefined,
1083
- provider: item.provider !== undefined ? item.provider : undefined,
1084
- providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
1085
- refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
1086
- access_token: item.access_token !== undefined ? item.access_token : undefined,
1087
- expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
1088
- token_type: item.token_type !== undefined ? item.token_type : undefined,
1089
- scope: item.scope !== undefined ? item.scope : undefined,
1090
- id_token: item.id_token !== undefined ? item.id_token : undefined,
1091
- session_state: item.session_state !== undefined ? item.session_state : undefined,
1092
- },
1093
- }))
1094
- } : undefined,
1095
- sessions: item.sessions ? {
1096
- connectOrCreate: item.sessions.map((item) => ({
1097
- where: {
1098
- id: item.id !== undefined ? item.id : undefined,
1099
- },
1100
- create: {
1101
- sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
1102
- expires: item.expires !== undefined ? item.expires : undefined,
1103
- },
1104
- }))
1105
- } : undefined,
1106
- authenticators: item.authenticators ? {
1107
- connectOrCreate: item.authenticators.map((item) => ({
1108
- where: {
1109
- id: item.id !== undefined ? item.id : undefined,
1110
- },
1111
- create: {
1112
- credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
1113
- publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
1114
- counter: item.counter !== undefined ? item.counter : undefined,
1115
- },
1116
- }))
1117
- } : undefined,
1118
- alpacaAccounts: item.alpacaAccounts ? {
1119
- connectOrCreate: item.alpacaAccounts.map((item) => ({
1120
- where: {
1121
- id: item.id !== undefined ? item.id : undefined,
1122
- },
1123
- create: {
1124
- type: item.type !== undefined ? item.type : undefined,
1125
- APIKey: item.APIKey !== undefined ? item.APIKey : undefined,
1126
- APISecret: item.APISecret !== undefined ? item.APISecret : undefined,
1127
- configuration: item.configuration !== undefined ? item.configuration : undefined,
1128
- marketOpen: item.marketOpen !== undefined ? item.marketOpen : undefined,
1129
- },
1130
- }))
1131
- } : undefined,
1121
+ accounts: item.accounts ?
1122
+ typeof item.accounts[0] === 'object' && Object.keys(item.accounts).length === 1 && Object.keys(item.accounts)[0] === 'id'
1123
+ ? { connect: item.accounts.map((item) => ({
1124
+ id: item.id
1125
+ }))
1126
+ }
1127
+ : { connectOrCreate: item.accounts.map((item) => ({
1128
+ where: {
1129
+ id: item.id !== undefined ? item.id : undefined,
1130
+ },
1131
+ create: {
1132
+ type: item.type !== undefined ? item.type : undefined,
1133
+ provider: item.provider !== undefined ? item.provider : undefined,
1134
+ providerAccountId: item.providerAccountId !== undefined ? item.providerAccountId : undefined,
1135
+ refresh_token: item.refresh_token !== undefined ? item.refresh_token : undefined,
1136
+ access_token: item.access_token !== undefined ? item.access_token : undefined,
1137
+ expires_at: item.expires_at !== undefined ? item.expires_at : undefined,
1138
+ token_type: item.token_type !== undefined ? item.token_type : undefined,
1139
+ scope: item.scope !== undefined ? item.scope : undefined,
1140
+ id_token: item.id_token !== undefined ? item.id_token : undefined,
1141
+ session_state: item.session_state !== undefined ? item.session_state : undefined,
1142
+ },
1143
+ }))
1144
+ } : undefined,
1145
+ sessions: item.sessions ?
1146
+ typeof item.sessions[0] === 'object' && Object.keys(item.sessions).length === 1 && Object.keys(item.sessions)[0] === 'id'
1147
+ ? { connect: item.sessions.map((item) => ({
1148
+ id: item.id
1149
+ }))
1150
+ }
1151
+ : { connectOrCreate: item.sessions.map((item) => ({
1152
+ where: {
1153
+ id: item.id !== undefined ? item.id : undefined,
1154
+ },
1155
+ create: {
1156
+ sessionToken: item.sessionToken !== undefined ? item.sessionToken : undefined,
1157
+ expires: item.expires !== undefined ? item.expires : undefined,
1158
+ },
1159
+ }))
1160
+ } : undefined,
1161
+ authenticators: item.authenticators ?
1162
+ typeof item.authenticators[0] === 'object' && Object.keys(item.authenticators).length === 1 && Object.keys(item.authenticators)[0] === 'id'
1163
+ ? { connect: item.authenticators.map((item) => ({
1164
+ id: item.id
1165
+ }))
1166
+ }
1167
+ : { connectOrCreate: item.authenticators.map((item) => ({
1168
+ where: {
1169
+ id: item.id !== undefined ? item.id : undefined,
1170
+ },
1171
+ create: {
1172
+ credentialID: item.credentialID !== undefined ? item.credentialID : undefined,
1173
+ publicKey: item.publicKey !== undefined ? item.publicKey : undefined,
1174
+ counter: item.counter !== undefined ? item.counter : undefined,
1175
+ },
1176
+ }))
1177
+ } : undefined,
1178
+ alpacaAccounts: item.alpacaAccounts ?
1179
+ typeof item.alpacaAccounts[0] === 'object' && Object.keys(item.alpacaAccounts).length === 1 && Object.keys(item.alpacaAccounts)[0] === 'id'
1180
+ ? { connect: item.alpacaAccounts.map((item) => ({
1181
+ id: item.id
1182
+ }))
1183
+ }
1184
+ : { connectOrCreate: item.alpacaAccounts.map((item) => ({
1185
+ where: {
1186
+ id: item.id !== undefined ? item.id : undefined,
1187
+ },
1188
+ create: {
1189
+ type: item.type !== undefined ? item.type : undefined,
1190
+ APIKey: item.APIKey !== undefined ? item.APIKey : undefined,
1191
+ APISecret: item.APISecret !== undefined ? item.APISecret : undefined,
1192
+ configuration: item.configuration !== undefined ? item.configuration : undefined,
1193
+ marketOpen: item.marketOpen !== undefined ? item.marketOpen : undefined,
1194
+ },
1195
+ }))
1196
+ } : undefined,
1132
1197
  },
1133
1198
  }))
1134
1199
  } : undefined,