@adaptic/backend 0.0.1056 → 0.0.1058

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 (292) hide show
  1. package/Account.cjs +14 -0
  2. package/AccountLinkingRequest.cjs +14 -0
  3. package/AccountRiskMetrics.cjs +11 -0
  4. package/AdaConversation.cjs +14 -0
  5. package/Alert.cjs +11 -0
  6. package/Allocation.cjs +11 -0
  7. package/AlpacaAccount.cjs +36 -0
  8. package/Authenticator.cjs +14 -0
  9. package/AutoFollowRule.cjs +14 -0
  10. package/BrokerageAccount.cjs +11 -0
  11. package/Customer.cjs +14 -0
  12. package/DeskDecision.cjs +11 -0
  13. package/FeatureFlagOverride.cjs +14 -0
  14. package/Follow.cjs +14 -0
  15. package/Fund.cjs +56 -0
  16. package/FundAssignment.cjs +14 -0
  17. package/Investor.cjs +14 -0
  18. package/LinkedProvider.cjs +14 -0
  19. package/LlmConfiguration.cjs +14 -0
  20. package/Mandate.cjs +14 -0
  21. package/MandateApproval.cjs +14 -0
  22. package/MandateVersion.cjs +14 -0
  23. package/NotificationDelivery.cjs +14 -0
  24. package/NotificationPreference.cjs +14 -0
  25. package/OrgMembership.cjs +14 -0
  26. package/PolicyOverlay.cjs +64 -0
  27. package/PushSubscription.cjs +14 -0
  28. package/RiskEscalationEvent.cjs +33 -0
  29. package/Session.cjs +14 -0
  30. package/Strategy.cjs +28 -0
  31. package/StrategyHealthSnapshot.cjs +11 -0
  32. package/StrategySubscription.cjs +11 -0
  33. package/TradingPolicy.cjs +6 -0
  34. package/User.cjs +11 -0
  35. package/UserTotp.cjs +14 -0
  36. package/WaitlistEntry.cjs +14 -0
  37. package/auth/authorization-map.cjs +306 -0
  38. package/auth/authorization-map.d.ts +143 -0
  39. package/auth/cortex-auth-checker.cjs +172 -0
  40. package/auth/cortex-auth-checker.d.ts +114 -0
  41. package/auth/credential-fields.cjs +51 -0
  42. package/auth/credential-fields.d.ts +19 -0
  43. package/auth/credential-redaction.cjs +134 -0
  44. package/auth/credential-redaction.d.ts +60 -0
  45. package/auth/graphql-auth-shadow.cjs +317 -0
  46. package/auth/graphql-auth-shadow.d.ts +194 -0
  47. package/auth/membership-write-authority.cjs +131 -0
  48. package/auth/membership-write-authority.d.ts +110 -0
  49. package/auth/mutation-authorization.cjs +376 -0
  50. package/auth/mutation-authorization.d.ts +261 -0
  51. package/auth/nested-write-inspector.cjs +189 -0
  52. package/auth/nested-write-inspector.d.ts +94 -0
  53. package/auth/nested-write-policy.cjs +189 -0
  54. package/auth/nested-write-policy.d.ts +99 -0
  55. package/auth/service-token.cjs +316 -0
  56. package/auth/service-token.d.ts +94 -0
  57. package/auth/tenancy-scope.cjs +736 -0
  58. package/auth/tenancy-scope.d.ts +347 -0
  59. package/auth/token-verifier.cjs +451 -0
  60. package/auth/token-verifier.d.ts +153 -0
  61. package/auth/totp.cjs +265 -0
  62. package/auth/totp.d.ts +111 -0
  63. package/auth/user-write-content.cjs +116 -0
  64. package/auth/user-write-content.d.ts +47 -0
  65. package/auth/ws-auth-context.cjs +75 -0
  66. package/auth/ws-auth-context.d.ts +69 -0
  67. package/config/jwtConfig.cjs +52 -0
  68. package/config/jwtConfig.d.ts +16 -0
  69. package/config/metrics.cjs +356 -0
  70. package/config/metrics.d.ts +128 -0
  71. package/config/persisted-queries.cjs +122 -0
  72. package/config/persisted-queries.d.ts +40 -0
  73. package/config/server-only-models.cjs +166 -0
  74. package/config/server-only-models.d.ts +89 -0
  75. package/config/tracing.d.ts +24 -0
  76. package/esm/Account.mjs +14 -0
  77. package/esm/AccountLinkingRequest.mjs +14 -0
  78. package/esm/AccountRiskMetrics.mjs +11 -0
  79. package/esm/AdaConversation.mjs +14 -0
  80. package/esm/Alert.mjs +11 -0
  81. package/esm/Allocation.mjs +11 -0
  82. package/esm/AlpacaAccount.mjs +36 -0
  83. package/esm/Authenticator.mjs +14 -0
  84. package/esm/AutoFollowRule.mjs +14 -0
  85. package/esm/BrokerageAccount.mjs +11 -0
  86. package/esm/Customer.mjs +14 -0
  87. package/esm/DeskDecision.mjs +11 -0
  88. package/esm/FeatureFlagOverride.mjs +14 -0
  89. package/esm/Follow.mjs +14 -0
  90. package/esm/Fund.mjs +56 -0
  91. package/esm/FundAssignment.mjs +14 -0
  92. package/esm/Investor.mjs +14 -0
  93. package/esm/LinkedProvider.mjs +14 -0
  94. package/esm/LlmConfiguration.mjs +14 -0
  95. package/esm/Mandate.mjs +14 -0
  96. package/esm/MandateApproval.mjs +14 -0
  97. package/esm/MandateVersion.mjs +14 -0
  98. package/esm/NotificationDelivery.mjs +14 -0
  99. package/esm/NotificationPreference.mjs +14 -0
  100. package/esm/OrgMembership.mjs +14 -0
  101. package/esm/PolicyOverlay.mjs +64 -0
  102. package/esm/PushSubscription.mjs +14 -0
  103. package/esm/RiskEscalationEvent.mjs +33 -0
  104. package/esm/Session.mjs +14 -0
  105. package/esm/Strategy.mjs +28 -0
  106. package/esm/StrategyHealthSnapshot.mjs +11 -0
  107. package/esm/StrategySubscription.mjs +11 -0
  108. package/esm/TradingPolicy.mjs +6 -0
  109. package/esm/User.mjs +11 -0
  110. package/esm/UserTotp.mjs +14 -0
  111. package/esm/WaitlistEntry.mjs +14 -0
  112. package/esm/generated/typeStrings/PolicyOverlay.d.ts +1 -1
  113. package/esm/generated/typeStrings/PolicyOverlay.mjs +18 -0
  114. package/esm/generated/typeStrings/TradingPolicy.d.ts +1 -1
  115. package/esm/generated/typeStrings/TradingPolicy.mjs +18 -0
  116. package/esm/generated/typeStrings/index.d.ts +2 -2
  117. package/esm/generated/typegraphql-prisma/enhance.mjs +18 -18
  118. package/esm/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.d.ts +1 -0
  119. package/esm/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.mjs +1 -0
  120. package/esm/generated/typegraphql-prisma/models/TradingPolicy.d.ts +20 -0
  121. package/esm/generated/typegraphql-prisma/models/TradingPolicy.mjs +27 -0
  122. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyArgs.d.ts +1 -1
  123. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyOrThrowArgs.d.ts +1 -1
  124. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindManyTradingPolicyArgs.d.ts +1 -1
  125. package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/GroupByTradingPolicyArgs.d.ts +1 -1
  126. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.d.ts +1 -0
  127. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.mjs +7 -0
  128. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.d.ts +1 -0
  129. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.mjs +7 -0
  130. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.d.ts +1 -0
  131. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.mjs +7 -0
  132. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.d.ts +1 -0
  133. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.mjs +7 -0
  134. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.d.ts +1 -0
  135. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.mjs +7 -0
  136. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.d.ts +1 -0
  137. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.mjs +7 -0
  138. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.d.ts +1 -0
  139. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.mjs +7 -0
  140. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.d.ts +1 -0
  141. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.mjs +7 -0
  142. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.d.ts +1 -0
  143. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.mjs +7 -0
  144. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.d.ts +1 -0
  145. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.mjs +7 -0
  146. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.d.ts +1 -0
  147. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.mjs +7 -0
  148. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.d.ts +1 -0
  149. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.mjs +7 -0
  150. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.d.ts +1 -0
  151. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.mjs +7 -0
  152. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.d.ts +1 -0
  153. package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.mjs +7 -0
  154. package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.d.ts +1 -0
  155. package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.mjs +7 -0
  156. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.d.ts +1 -0
  157. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.mjs +7 -0
  158. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.d.ts +1 -0
  159. package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.mjs +7 -0
  160. package/esm/index.d.ts +1 -0
  161. package/esm/index.mjs +2 -0
  162. package/esm/middleware/mutation-account-facts.d.ts +3 -0
  163. package/esm/middleware/mutation-account-facts.mjs +2 -0
  164. package/esm/middleware/trading-policy-audit.d.ts +16 -4
  165. package/esm/middleware/trading-policy-audit.mjs +40 -11
  166. package/esm/readers/index.d.ts +10 -0
  167. package/esm/readers/index.mjs +10 -0
  168. package/esm/readers/intraday-lane-prefs.d.ts +45 -0
  169. package/esm/readers/intraday-lane-prefs.mjs +71 -0
  170. package/esm/tests/trading-policy-lane-fields-roundtrip.harness.d.ts +14 -0
  171. package/esm/tests/trading-policy-lane-fields-roundtrip.harness.mjs +107 -0
  172. package/generated/typeStrings/PolicyOverlay.cjs +18 -0
  173. package/generated/typeStrings/PolicyOverlay.d.ts +1 -1
  174. package/generated/typeStrings/TradingPolicy.cjs +18 -0
  175. package/generated/typeStrings/TradingPolicy.d.ts +1 -1
  176. package/generated/typeStrings/index.d.ts +2 -2
  177. package/generated/typegraphql-prisma/enhance.cjs +21 -21
  178. package/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.cjs +1 -0
  179. package/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.d.ts +1 -0
  180. package/generated/typegraphql-prisma/index.cjs +6 -6
  181. package/generated/typegraphql-prisma/models/TradingPolicy.cjs +7 -0
  182. package/generated/typegraphql-prisma/models/TradingPolicy.d.ts +20 -0
  183. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyArgs.d.ts +1 -1
  184. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyOrThrowArgs.d.ts +1 -1
  185. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindManyTradingPolicyArgs.d.ts +1 -1
  186. package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/GroupByTradingPolicyArgs.d.ts +1 -1
  187. package/generated/typegraphql-prisma/resolvers/crud/args.index.cjs +95 -95
  188. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.cjs +6 -0
  189. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.d.ts +1 -0
  190. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.cjs +6 -0
  191. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.d.ts +1 -0
  192. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.cjs +6 -0
  193. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.d.ts +1 -0
  194. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.cjs +6 -0
  195. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.d.ts +1 -0
  196. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.cjs +6 -0
  197. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.d.ts +1 -0
  198. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.cjs +6 -0
  199. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.d.ts +1 -0
  200. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.cjs +6 -0
  201. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.d.ts +1 -0
  202. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.cjs +6 -0
  203. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.d.ts +1 -0
  204. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.cjs +6 -0
  205. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.d.ts +1 -0
  206. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.cjs +6 -0
  207. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.d.ts +1 -0
  208. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.cjs +6 -0
  209. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.d.ts +1 -0
  210. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.cjs +6 -0
  211. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.d.ts +1 -0
  212. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.cjs +6 -0
  213. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.d.ts +1 -0
  214. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.cjs +6 -0
  215. package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.d.ts +1 -0
  216. package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.cjs +6 -0
  217. package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.d.ts +1 -0
  218. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.cjs +6 -0
  219. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.d.ts +1 -0
  220. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.cjs +6 -0
  221. package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.d.ts +1 -0
  222. package/generated/typegraphql-prisma/resolvers/outputs/index.cjs +1 -1
  223. package/generated/typegraphql-prisma/resolvers/relations/args.index.cjs +32 -32
  224. package/index.cjs +2 -0
  225. package/index.d.ts +1 -0
  226. package/middleware/audit-log-write-redaction.cjs +143 -0
  227. package/middleware/audit-log-write-redaction.d.ts +82 -0
  228. package/middleware/audit-logger.cjs +378 -0
  229. package/middleware/audit-logger.d.ts +158 -0
  230. package/middleware/audit-payload-guard.cjs +107 -0
  231. package/middleware/audit-payload-guard.d.ts +85 -0
  232. package/middleware/auth.cjs +66 -0
  233. package/middleware/auth.d.ts +41 -0
  234. package/middleware/credential-field-guard.cjs +514 -0
  235. package/middleware/credential-field-guard.d.ts +173 -0
  236. package/middleware/generated-type-names.cjs +77 -0
  237. package/middleware/generated-type-names.d.ts +44 -0
  238. package/middleware/graphql-validation-plugin.cjs +310 -0
  239. package/middleware/graphql-validation-plugin.d.ts +98 -0
  240. package/middleware/guard-log-throttle.cjs +89 -0
  241. package/middleware/guard-log-throttle.d.ts +80 -0
  242. package/middleware/index.cjs +57 -0
  243. package/middleware/index.d.ts +14 -0
  244. package/middleware/input-validator.cjs +220 -0
  245. package/middleware/input-validator.d.ts +63 -0
  246. package/middleware/mandate-version-validation.cjs +131 -0
  247. package/middleware/mandate-version-validation.d.ts +41 -0
  248. package/middleware/mutation-account-facts.cjs +223 -0
  249. package/middleware/mutation-account-facts.d.ts +143 -0
  250. package/middleware/mutation-auth-guard.cjs +536 -0
  251. package/middleware/mutation-auth-guard.d.ts +100 -0
  252. package/middleware/mutation-membership-facts.cjs +276 -0
  253. package/middleware/mutation-membership-facts.d.ts +133 -0
  254. package/middleware/mutation-tenant-facts.cjs +132 -0
  255. package/middleware/mutation-tenant-facts.d.ts +81 -0
  256. package/middleware/query-complexity.cjs +182 -0
  257. package/middleware/query-complexity.d.ts +56 -0
  258. package/middleware/rate-limiter.cjs +223 -0
  259. package/middleware/rate-limiter.d.ts +93 -0
  260. package/middleware/rate-tier.cjs +111 -0
  261. package/middleware/rate-tier.d.ts +56 -0
  262. package/middleware/soft-delete.cjs +175 -0
  263. package/middleware/soft-delete.d.ts +146 -0
  264. package/middleware/tenancy-scoping.cjs +229 -0
  265. package/middleware/tenancy-scoping.d.ts +67 -0
  266. package/middleware/trading-policy-audit.cjs +353 -0
  267. package/middleware/trading-policy-audit.d.ts +184 -0
  268. package/middleware/types.cjs +17 -0
  269. package/middleware/types.d.ts +87 -0
  270. package/middleware/validation-examples.cjs +398 -0
  271. package/middleware/validation-examples.d.ts +76 -0
  272. package/package.json +10 -2
  273. package/readers/index.cjs +15 -0
  274. package/readers/index.d.ts +10 -0
  275. package/readers/intraday-lane-prefs.cjs +76 -0
  276. package/readers/intraday-lane-prefs.d.ts +45 -0
  277. package/esm/config/__tests__/server-only-surface.harness.d.ts +0 -12
  278. package/esm/config/__tests__/server-only-surface.harness.mjs +0 -41
  279. package/esm/middleware/__tests__/audit-log-write-redaction.harness.d.ts +0 -144
  280. package/esm/middleware/__tests__/audit-log-write-redaction.harness.mjs +0 -920
  281. package/esm/middleware/__tests__/credential-field-coverage.harness.d.ts +0 -55
  282. package/esm/middleware/__tests__/credential-field-coverage.harness.mjs +0 -440
  283. package/esm/middleware/__tests__/credential-field-guard.harness.d.ts +0 -34
  284. package/esm/middleware/__tests__/credential-field-guard.harness.mjs +0 -212
  285. package/esm/middleware/__tests__/mutation-auth-guard.harness.d.ts +0 -56
  286. package/esm/middleware/__tests__/mutation-auth-guard.harness.mjs +0 -570
  287. package/esm/middleware/__tests__/rate-limit-test-utils.d.ts +0 -60
  288. package/esm/middleware/__tests__/rate-limit-test-utils.mjs +0 -85
  289. package/esm/middleware/__tests__/ts-node-harness.d.ts +0 -10
  290. package/esm/middleware/__tests__/ts-node-harness.mjs +0 -71
  291. package/health.cjs +0 -274
  292. package/server.cjs +0 -607
@@ -0,0 +1,398 @@
1
+ "use strict";
2
+ /**
3
+ * Example usage of validation functions in custom resolvers
4
+ *
5
+ * This file demonstrates how to use the validation utilities
6
+ * in custom resolver implementations.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
25
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
26
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
27
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
28
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
29
+ };
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ var __metadata = (this && this.__metadata) || function (k, v) {
48
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
49
+ };
50
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
51
+ return function (target, key) { decorator(target, key, paramIndex); }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.CustomValidators = exports.ValidationExamplesResolver = void 0;
55
+ const TypeGraphQL = __importStar(require("type-graphql"));
56
+ const input_validator_1 = require("./input-validator.cjs");
57
+ /**
58
+ * Example: Portfolio allocation input with validation
59
+ */
60
+ let PortfolioAllocationInput = class PortfolioAllocationInput {
61
+ };
62
+ __decorate([
63
+ TypeGraphQL.Field(() => TypeGraphQL.Float),
64
+ __metadata("design:type", Number)
65
+ ], PortfolioAllocationInput.prototype, "equitiesPct", void 0);
66
+ __decorate([
67
+ TypeGraphQL.Field(() => TypeGraphQL.Float),
68
+ __metadata("design:type", Number)
69
+ ], PortfolioAllocationInput.prototype, "optionsPct", void 0);
70
+ __decorate([
71
+ TypeGraphQL.Field(() => TypeGraphQL.Float),
72
+ __metadata("design:type", Number)
73
+ ], PortfolioAllocationInput.prototype, "cryptoPct", void 0);
74
+ __decorate([
75
+ TypeGraphQL.Field(() => String),
76
+ __metadata("design:type", String)
77
+ ], PortfolioAllocationInput.prototype, "portfolioName", void 0);
78
+ PortfolioAllocationInput = __decorate([
79
+ TypeGraphQL.InputType()
80
+ ], PortfolioAllocationInput);
81
+ /**
82
+ * Example: Trade configuration input with validation
83
+ */
84
+ let TradeConfigurationInput = class TradeConfigurationInput {
85
+ };
86
+ __decorate([
87
+ TypeGraphQL.Field(() => TypeGraphQL.Float),
88
+ __metadata("design:type", Number)
89
+ ], TradeConfigurationInput.prototype, "tradeAllocationPct", void 0);
90
+ __decorate([
91
+ TypeGraphQL.Field(() => TypeGraphQL.Float),
92
+ __metadata("design:type", Number)
93
+ ], TradeConfigurationInput.prototype, "minPercentageChange", void 0);
94
+ __decorate([
95
+ TypeGraphQL.Field(() => TypeGraphQL.Float),
96
+ __metadata("design:type", Number)
97
+ ], TradeConfigurationInput.prototype, "volumeThreshold", void 0);
98
+ __decorate([
99
+ TypeGraphQL.Field(() => TypeGraphQL.Int),
100
+ __metadata("design:type", Number)
101
+ ], TradeConfigurationInput.prototype, "quantity", void 0);
102
+ TradeConfigurationInput = __decorate([
103
+ TypeGraphQL.InputType()
104
+ ], TradeConfigurationInput);
105
+ /**
106
+ * Example resolver demonstrating manual validation in custom resolvers
107
+ *
108
+ * Note: With the validation plugin enabled, these validations happen
109
+ * automatically. This example shows how to add ADDITIONAL custom validation
110
+ * logic beyond the automatic pattern-based validation.
111
+ */
112
+ let ValidationExamplesResolver = class ValidationExamplesResolver {
113
+ /**
114
+ * Example 1: Basic field validation in a mutation
115
+ */
116
+ async updatePortfolioAllocation(input) {
117
+ // The validation plugin will automatically validate:
118
+ // - equitiesPct (0-100)
119
+ // - optionsPct (0-100)
120
+ // - cryptoPct (0-100)
121
+ // - portfolioName (non-empty)
122
+ // Add custom business logic validation
123
+ const totalAllocation = input.equitiesPct + input.optionsPct + input.cryptoPct;
124
+ if (totalAllocation !== 100) {
125
+ throw new input_validator_1.ValidationError('Total allocation must equal 100%', [
126
+ {
127
+ field: 'totalAllocation',
128
+ value: totalAllocation,
129
+ message: 'Sum of equitiesPct, optionsPct, and cryptoPct must equal 100',
130
+ constraint: 'sum',
131
+ },
132
+ ]);
133
+ }
134
+ // Resolver implementation...
135
+ return true;
136
+ }
137
+ /**
138
+ * Example 2: Batch validation using validateFields
139
+ */
140
+ async updateTradeConfiguration(input) {
141
+ // The validation plugin handles basic validation automatically.
142
+ // Use validateFields for additional custom validations.
143
+ // ValidationError is automatically formatted by Apollo Server
144
+ (0, input_validator_1.validateFields)([
145
+ // Custom validation: minPercentageChange should be less than tradeAllocationPct
146
+ () => {
147
+ if (input.minPercentageChange >= input.tradeAllocationPct) {
148
+ throw new input_validator_1.ValidationError('Invalid configuration', [
149
+ {
150
+ field: 'minPercentageChange',
151
+ value: input.minPercentageChange,
152
+ message: 'Must be less than tradeAllocationPct',
153
+ constraint: 'comparison',
154
+ },
155
+ ]);
156
+ }
157
+ },
158
+ ]);
159
+ // Resolver implementation...
160
+ return true;
161
+ }
162
+ /**
163
+ * Example 3: Conditional validation based on business logic
164
+ */
165
+ async createTrade(quantity, isPremiumUser) {
166
+ // Basic validation happens automatically via plugin
167
+ // Add conditional validation based on user type
168
+ if (!isPremiumUser && quantity > 1000) {
169
+ throw new input_validator_1.ValidationError('Quantity limit exceeded', [
170
+ {
171
+ field: 'quantity',
172
+ value: quantity,
173
+ message: 'Non-premium users are limited to 1000 units per trade',
174
+ constraint: 'userLimit',
175
+ },
176
+ ]);
177
+ }
178
+ // Resolver implementation...
179
+ return true;
180
+ }
181
+ /**
182
+ * Example 4: Validating related fields together
183
+ */
184
+ async setTradingThresholds(minPrice, maxPrice, targetPrice) {
185
+ // Automatic validation ensures all are positive numbers
186
+ // Custom validation for related fields
187
+ if (minPrice >= maxPrice) {
188
+ throw new input_validator_1.ValidationError('Invalid price range', [
189
+ {
190
+ field: 'minPrice',
191
+ value: minPrice,
192
+ message: 'minPrice must be less than maxPrice',
193
+ constraint: 'range',
194
+ },
195
+ ]);
196
+ }
197
+ if (targetPrice < minPrice || targetPrice > maxPrice) {
198
+ throw new input_validator_1.ValidationError('Invalid target price', [
199
+ {
200
+ field: 'targetPrice',
201
+ value: targetPrice,
202
+ message: 'targetPrice must be between minPrice and maxPrice',
203
+ constraint: 'range',
204
+ },
205
+ ]);
206
+ }
207
+ // Resolver implementation...
208
+ return true;
209
+ }
210
+ /**
211
+ * Example 5: Using manual validation for non-standard field names
212
+ */
213
+ async updateCustomSettings(customAllocation, customQuantity) {
214
+ // These field names don't match the automatic validation patterns,
215
+ // so we validate manually
216
+ (0, input_validator_1.validatePercentage)(customAllocation, 'customAllocation');
217
+ (0, input_validator_1.validatePositiveNumber)(customQuantity, 'customQuantity');
218
+ // Resolver implementation...
219
+ return true;
220
+ }
221
+ /**
222
+ * Example 6: Accumulating multiple validation errors
223
+ */
224
+ async bulkUpdateAllocations(allocations) {
225
+ // Validate each allocation
226
+ // The plugin validates each item's fields automatically
227
+ // Add custom cross-item validation
228
+ const totalItems = allocations.length;
229
+ if (totalItems === 0) {
230
+ throw new input_validator_1.ValidationError('Empty allocations array', [
231
+ {
232
+ field: 'allocations',
233
+ value: totalItems,
234
+ message: 'Must provide at least one allocation',
235
+ constraint: 'notEmpty',
236
+ },
237
+ ]);
238
+ }
239
+ if (totalItems > 100) {
240
+ throw new input_validator_1.ValidationError('Too many allocations', [
241
+ {
242
+ field: 'allocations',
243
+ value: totalItems,
244
+ message: 'Maximum 100 allocations per request',
245
+ constraint: 'maxLength',
246
+ },
247
+ ]);
248
+ }
249
+ // Resolver implementation...
250
+ return true;
251
+ }
252
+ };
253
+ exports.ValidationExamplesResolver = ValidationExamplesResolver;
254
+ __decorate([
255
+ TypeGraphQL.Mutation(() => Boolean),
256
+ __param(0, TypeGraphQL.Arg('input')),
257
+ __metadata("design:type", Function),
258
+ __metadata("design:paramtypes", [PortfolioAllocationInput]),
259
+ __metadata("design:returntype", Promise)
260
+ ], ValidationExamplesResolver.prototype, "updatePortfolioAllocation", null);
261
+ __decorate([
262
+ TypeGraphQL.Mutation(() => Boolean),
263
+ __param(0, TypeGraphQL.Arg('input')),
264
+ __metadata("design:type", Function),
265
+ __metadata("design:paramtypes", [TradeConfigurationInput]),
266
+ __metadata("design:returntype", Promise)
267
+ ], ValidationExamplesResolver.prototype, "updateTradeConfiguration", null);
268
+ __decorate([
269
+ TypeGraphQL.Mutation(() => Boolean),
270
+ __param(0, TypeGraphQL.Arg('quantity')),
271
+ __param(1, TypeGraphQL.Arg('isPremiumUser')),
272
+ __metadata("design:type", Function),
273
+ __metadata("design:paramtypes", [Number, Boolean]),
274
+ __metadata("design:returntype", Promise)
275
+ ], ValidationExamplesResolver.prototype, "createTrade", null);
276
+ __decorate([
277
+ TypeGraphQL.Mutation(() => Boolean),
278
+ __param(0, TypeGraphQL.Arg('minPrice')),
279
+ __param(1, TypeGraphQL.Arg('maxPrice')),
280
+ __param(2, TypeGraphQL.Arg('targetPrice')),
281
+ __metadata("design:type", Function),
282
+ __metadata("design:paramtypes", [Number, Number, Number]),
283
+ __metadata("design:returntype", Promise)
284
+ ], ValidationExamplesResolver.prototype, "setTradingThresholds", null);
285
+ __decorate([
286
+ TypeGraphQL.Mutation(() => Boolean),
287
+ __param(0, TypeGraphQL.Arg('customAllocation')),
288
+ __param(1, TypeGraphQL.Arg('customQuantity')),
289
+ __metadata("design:type", Function),
290
+ __metadata("design:paramtypes", [Number, Number]),
291
+ __metadata("design:returntype", Promise)
292
+ ], ValidationExamplesResolver.prototype, "updateCustomSettings", null);
293
+ __decorate([
294
+ TypeGraphQL.Mutation(() => Boolean),
295
+ __param(0, TypeGraphQL.Arg('allocations', () => [PortfolioAllocationInput])),
296
+ __metadata("design:type", Function),
297
+ __metadata("design:paramtypes", [Array]),
298
+ __metadata("design:returntype", Promise)
299
+ ], ValidationExamplesResolver.prototype, "bulkUpdateAllocations", null);
300
+ exports.ValidationExamplesResolver = ValidationExamplesResolver = __decorate([
301
+ TypeGraphQL.Resolver()
302
+ ], ValidationExamplesResolver);
303
+ /**
304
+ * Example: Reusable validation functions for complex business rules
305
+ */
306
+ class CustomValidators {
307
+ /**
308
+ * Validates that portfolio allocations sum to 100%
309
+ */
310
+ static validatePortfolioAllocationSum(equities, options, crypto) {
311
+ const total = equities + options + crypto;
312
+ if (Math.abs(total - 100) > 0.01) {
313
+ // Allow small floating point errors
314
+ throw new input_validator_1.ValidationError('Invalid portfolio allocation', [
315
+ {
316
+ field: 'totalAllocation',
317
+ value: total,
318
+ message: 'Total allocation must equal 100%',
319
+ constraint: 'sum',
320
+ },
321
+ ]);
322
+ }
323
+ }
324
+ /**
325
+ * Validates that a price is within acceptable market bounds
326
+ */
327
+ static validateMarketPrice(price, fieldName) {
328
+ (0, input_validator_1.validatePositiveNumber)(price, fieldName);
329
+ // Additional market-specific validation
330
+ if (price > 1000000) {
331
+ throw new input_validator_1.ValidationError('Price exceeds maximum', [
332
+ {
333
+ field: fieldName,
334
+ value: price,
335
+ message: 'Price cannot exceed $1,000,000',
336
+ constraint: 'maximum',
337
+ },
338
+ ]);
339
+ }
340
+ }
341
+ /**
342
+ * Validates Greeks values are within expected ranges
343
+ */
344
+ static validateGreeks(delta, gamma, theta, vega) {
345
+ (0, input_validator_1.validateFields)([
346
+ () => {
347
+ if (delta < -1 || delta > 1) {
348
+ throw new input_validator_1.ValidationError('Invalid delta', [
349
+ {
350
+ field: 'delta',
351
+ value: delta,
352
+ message: 'Delta must be between -1 and 1',
353
+ constraint: 'range',
354
+ },
355
+ ]);
356
+ }
357
+ },
358
+ () => {
359
+ if (gamma < 0) {
360
+ throw new input_validator_1.ValidationError('Invalid gamma', [
361
+ {
362
+ field: 'gamma',
363
+ value: gamma,
364
+ message: 'Gamma must be non-negative',
365
+ constraint: 'minimum',
366
+ },
367
+ ]);
368
+ }
369
+ },
370
+ () => {
371
+ if (theta > 0) {
372
+ throw new input_validator_1.ValidationError('Invalid theta', [
373
+ {
374
+ field: 'theta',
375
+ value: theta,
376
+ message: 'Theta must be negative or zero',
377
+ constraint: 'maximum',
378
+ },
379
+ ]);
380
+ }
381
+ },
382
+ () => {
383
+ if (vega < 0) {
384
+ throw new input_validator_1.ValidationError('Invalid vega', [
385
+ {
386
+ field: 'vega',
387
+ value: vega,
388
+ message: 'Vega must be non-negative',
389
+ constraint: 'minimum',
390
+ },
391
+ ]);
392
+ }
393
+ },
394
+ ]);
395
+ }
396
+ }
397
+ exports.CustomValidators = CustomValidators;
398
+ //# sourceMappingURL=validation-examples.js.map
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Example usage of validation functions in custom resolvers
3
+ *
4
+ * This file demonstrates how to use the validation utilities
5
+ * in custom resolver implementations.
6
+ */
7
+ /**
8
+ * Example: Portfolio allocation input with validation
9
+ */
10
+ declare class PortfolioAllocationInput {
11
+ equitiesPct: number;
12
+ optionsPct: number;
13
+ cryptoPct: number;
14
+ portfolioName: string;
15
+ }
16
+ /**
17
+ * Example: Trade configuration input with validation
18
+ */
19
+ declare class TradeConfigurationInput {
20
+ tradeAllocationPct: number;
21
+ minPercentageChange: number;
22
+ volumeThreshold: number;
23
+ quantity: number;
24
+ }
25
+ /**
26
+ * Example resolver demonstrating manual validation in custom resolvers
27
+ *
28
+ * Note: With the validation plugin enabled, these validations happen
29
+ * automatically. This example shows how to add ADDITIONAL custom validation
30
+ * logic beyond the automatic pattern-based validation.
31
+ */
32
+ export declare class ValidationExamplesResolver {
33
+ /**
34
+ * Example 1: Basic field validation in a mutation
35
+ */
36
+ updatePortfolioAllocation(input: PortfolioAllocationInput): Promise<boolean>;
37
+ /**
38
+ * Example 2: Batch validation using validateFields
39
+ */
40
+ updateTradeConfiguration(input: TradeConfigurationInput): Promise<boolean>;
41
+ /**
42
+ * Example 3: Conditional validation based on business logic
43
+ */
44
+ createTrade(quantity: number, isPremiumUser: boolean): Promise<boolean>;
45
+ /**
46
+ * Example 4: Validating related fields together
47
+ */
48
+ setTradingThresholds(minPrice: number, maxPrice: number, targetPrice: number): Promise<boolean>;
49
+ /**
50
+ * Example 5: Using manual validation for non-standard field names
51
+ */
52
+ updateCustomSettings(customAllocation: number, customQuantity: number): Promise<boolean>;
53
+ /**
54
+ * Example 6: Accumulating multiple validation errors
55
+ */
56
+ bulkUpdateAllocations(allocations: PortfolioAllocationInput[]): Promise<boolean>;
57
+ }
58
+ /**
59
+ * Example: Reusable validation functions for complex business rules
60
+ */
61
+ export declare class CustomValidators {
62
+ /**
63
+ * Validates that portfolio allocations sum to 100%
64
+ */
65
+ static validatePortfolioAllocationSum(equities: number, options: number, crypto: number): void;
66
+ /**
67
+ * Validates that a price is within acceptable market bounds
68
+ */
69
+ static validateMarketPrice(price: number, fieldName: string): void;
70
+ /**
71
+ * Validates Greeks values are within expected ranges
72
+ */
73
+ static validateGreeks(delta: number, gamma: number, theta: number, vega: number): void;
74
+ }
75
+ export {};
76
+ //# sourceMappingURL=validation-examples.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/backend",
3
- "version": "0.0.1056",
3
+ "version": "0.0.1058",
4
4
  "description": "Backend executable CRUD functions with dynamic variables construction, and type definitions for the Adaptic AI platform.",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",
@@ -22,12 +22,20 @@
22
22
  "resolvers/",
23
23
  "utils/",
24
24
  "validators/",
25
+ "auth/",
26
+ "readers/",
27
+ "config/",
28
+ "middleware/",
25
29
  "*.d.ts",
26
30
  "*.js",
27
31
  "*.cjs",
28
32
  "*.mjs",
29
33
  "*.ts",
30
- "!**/*.map"
34
+ "!**/*.map",
35
+ "!**/__tests__/**",
36
+ "!/server.cjs",
37
+ "!/health.cjs",
38
+ "!/config/tracing.cjs"
31
39
  ],
32
40
  "peerDependencies": {
33
41
  "@apollo/client": "^3.11.0",
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INTRADAY_LANE_PREFS_SELECTION = exports.readIntradayLanePrefs = void 0;
4
+ /**
5
+ * Narrow, hand-written reads of fields that the generated selection sets
6
+ * deliberately leave out (`GQL.SKIP`). Each read selects only its own field and
7
+ * the row's identity, so it fails alone and cannot take a generated read down
8
+ * with it.
9
+ *
10
+ * @module readers
11
+ */
12
+ var intraday_lane_prefs_1 = require("./intraday-lane-prefs.cjs");
13
+ Object.defineProperty(exports, "readIntradayLanePrefs", { enumerable: true, get: function () { return intraday_lane_prefs_1.readIntradayLanePrefs; } });
14
+ Object.defineProperty(exports, "INTRADAY_LANE_PREFS_SELECTION", { enumerable: true, get: function () { return intraday_lane_prefs_1.INTRADAY_LANE_PREFS_SELECTION; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Narrow, hand-written reads of fields that the generated selection sets
3
+ * deliberately leave out (`GQL.SKIP`). Each read selects only its own field and
4
+ * the row's identity, so it fails alone and cannot take a generated read down
5
+ * with it.
6
+ *
7
+ * @module readers
8
+ */
9
+ export { readIntradayLanePrefs, INTRADAY_LANE_PREFS_SELECTION, type IntradayLanePrefsRow, } from './intraday-lane-prefs';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.INTRADAY_LANE_PREFS_SELECTION = void 0;
4
+ exports.readIntradayLanePrefs = readIntradayLanePrefs;
5
+ const client_1 = require("../client.cjs");
6
+ /** The fields this read selects, and nothing else. */
7
+ exports.INTRADAY_LANE_PREFS_SELECTION = 'id alpacaAccountId intradayLanePrefs';
8
+ /** The backend's error message when no TradingPolicy row matches. */
9
+ const NO_POLICY_MESSAGE = 'No TradingPolicy found';
10
+ /** The shape of the `getTradingPolicy` answer this read accepts. */
11
+ function rowOf(value) {
12
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
13
+ throw new Error('readIntradayLanePrefs: the backend answered with no policy object');
14
+ }
15
+ const record = value;
16
+ if (typeof record.id !== 'string' || typeof record.alpacaAccountId !== 'string') {
17
+ throw new Error('readIntradayLanePrefs: the policy answer has no id or alpacaAccountId');
18
+ }
19
+ if (!('intradayLanePrefs' in record) || record.intradayLanePrefs === undefined) {
20
+ throw new Error('readIntradayLanePrefs: the policy answer omits intradayLanePrefs');
21
+ }
22
+ return {
23
+ policyId: record.id,
24
+ alpacaAccountId: record.alpacaAccountId,
25
+ intradayLanePrefs: record.intradayLanePrefs,
26
+ };
27
+ }
28
+ /**
29
+ * Read one account's lane preferences.
30
+ *
31
+ * @param alpacaAccountId - The account whose TradingPolicy to read.
32
+ * @param globalClient - The backend client; the shared client when omitted.
33
+ * @returns The stored preferences, or `null` when the account has no
34
+ * TradingPolicy row.
35
+ * @throws When the backend fails, answers with errors (including a server
36
+ * whose schema predates the column), or answers without the field.
37
+ */
38
+ async function readIntradayLanePrefs(alpacaAccountId, globalClient) {
39
+ var _a;
40
+ const [modules, client] = await Promise.all([
41
+ (0, client_1.getApolloModules)(),
42
+ globalClient ? Promise.resolve(globalClient) : (0, client_1.getApolloClient)(),
43
+ ]);
44
+ const query = modules.gql `
45
+ query readIntradayLanePrefs($where: TradingPolicyWhereUniqueInput!) {
46
+ getTradingPolicy(where: $where) {
47
+ ${exports.INTRADAY_LANE_PREFS_SELECTION}
48
+ }
49
+ }`;
50
+ let response;
51
+ try {
52
+ response = await client.query({
53
+ query,
54
+ variables: { where: { alpacaAccountId } },
55
+ fetchPolicy: 'network-only',
56
+ });
57
+ }
58
+ catch (error) {
59
+ if (error instanceof Error && error.message === NO_POLICY_MESSAGE)
60
+ return null;
61
+ throw error;
62
+ }
63
+ if (response.errors && response.errors.length > 0) {
64
+ if (response.errors[0].message === NO_POLICY_MESSAGE)
65
+ return null;
66
+ throw new Error(`readIntradayLanePrefs: ${response.errors[0].message}`);
67
+ }
68
+ const policy = (_a = response.data) === null || _a === void 0 ? void 0 : _a.getTradingPolicy;
69
+ if (policy === null)
70
+ return null;
71
+ if (policy === undefined) {
72
+ throw new Error('readIntradayLanePrefs: the backend answered with no getTradingPolicy field');
73
+ }
74
+ return rowOf(policy);
75
+ }
76
+ //# sourceMappingURL=intraday-lane-prefs.js.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The read of one account's multi-lane intraday preferences
3
+ * (`TradingPolicy.intradayLanePrefs`).
4
+ *
5
+ * The field is excluded from every generated selection set (`GQL.SKIP`). A
6
+ * GraphQL server whose schema predates the column rejects the WHOLE operation
7
+ * that selects it, and the generated TradingPolicy and AlpacaAccount selection
8
+ * sets carry the engine's order-chokepoint policy read and its broker-credential
9
+ * read. Leaving the field out of those reads keeps them working against a
10
+ * server whether or not the migration has run. This read is the only place the
11
+ * field is selected, so a server without the column fails this read alone.
12
+ *
13
+ * The read never turns a failure into a value. A transport or GraphQL error
14
+ * throws, and so does an answer that omits the field. Only a backend that
15
+ * answers "no policy row" yields `null`. The consumer (the engine's lane-arming
16
+ * resolver) maps every one of these outcomes to "lanes disarmed". It never
17
+ * blocks an exit, because the preferences govern entries only.
18
+ *
19
+ * @module readers/intraday-lane-prefs
20
+ */
21
+ import type { TradingPolicy as TradingPolicyType } from '../generated/typegraphql-prisma/models/TradingPolicy';
22
+ import { type ApolloClientType, type NormalizedCacheObject } from '../client';
23
+ /** The fields this read selects, and nothing else. */
24
+ export declare const INTRADAY_LANE_PREFS_SELECTION = "id alpacaAccountId intradayLanePrefs";
25
+ /** One account's lane preferences, as stored. */
26
+ export interface IntradayLanePrefsRow {
27
+ /** The TradingPolicy row id. */
28
+ readonly policyId: string;
29
+ /** The account the policy governs. */
30
+ readonly alpacaAccountId: string;
31
+ /** The stored preferences; `null` when none are set (lanes disarmed). */
32
+ readonly intradayLanePrefs: Exclude<TradingPolicyType['intradayLanePrefs'], undefined>;
33
+ }
34
+ /**
35
+ * Read one account's lane preferences.
36
+ *
37
+ * @param alpacaAccountId - The account whose TradingPolicy to read.
38
+ * @param globalClient - The backend client; the shared client when omitted.
39
+ * @returns The stored preferences, or `null` when the account has no
40
+ * TradingPolicy row.
41
+ * @throws When the backend fails, answers with errors (including a server
42
+ * whose schema predates the column), or answers without the field.
43
+ */
44
+ export declare function readIntradayLanePrefs(alpacaAccountId: string, globalClient?: ApolloClientType<NormalizedCacheObject>): Promise<IntradayLanePrefsRow | null>;
45
+ //# sourceMappingURL=intraday-lane-prefs.d.ts.map
@@ -1,12 +0,0 @@
1
- /**
2
- * Builds the GraphQL schema exactly as src/server.ts assembles it (generated
3
- * resolvers minus server-only models, residual surface stripped) and reports
4
- * anything of a server-only model that survives.
5
- *
6
- * The generated TypeGraphQL resolvers rely on `emitDecoratorMetadata`, which
7
- * vitest's esbuild transform does not emit, so this runs out of process under
8
- * ts-node (see src/middleware/__tests__/ts-node-harness.ts). Output is printed
9
- * between `<<<RESULTS>>>` and `<<<END>>>`.
10
- */
11
- import 'reflect-metadata';
12
- //# sourceMappingURL=server-only-surface.harness.d.ts.map