@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.
- package/Account.cjs +14 -0
- package/AccountLinkingRequest.cjs +14 -0
- package/AccountRiskMetrics.cjs +11 -0
- package/AdaConversation.cjs +14 -0
- package/Alert.cjs +11 -0
- package/Allocation.cjs +11 -0
- package/AlpacaAccount.cjs +36 -0
- package/Authenticator.cjs +14 -0
- package/AutoFollowRule.cjs +14 -0
- package/BrokerageAccount.cjs +11 -0
- package/Customer.cjs +14 -0
- package/DeskDecision.cjs +11 -0
- package/FeatureFlagOverride.cjs +14 -0
- package/Follow.cjs +14 -0
- package/Fund.cjs +56 -0
- package/FundAssignment.cjs +14 -0
- package/Investor.cjs +14 -0
- package/LinkedProvider.cjs +14 -0
- package/LlmConfiguration.cjs +14 -0
- package/Mandate.cjs +14 -0
- package/MandateApproval.cjs +14 -0
- package/MandateVersion.cjs +14 -0
- package/NotificationDelivery.cjs +14 -0
- package/NotificationPreference.cjs +14 -0
- package/OrgMembership.cjs +14 -0
- package/PolicyOverlay.cjs +64 -0
- package/PushSubscription.cjs +14 -0
- package/RiskEscalationEvent.cjs +33 -0
- package/Session.cjs +14 -0
- package/Strategy.cjs +28 -0
- package/StrategyHealthSnapshot.cjs +11 -0
- package/StrategySubscription.cjs +11 -0
- package/TradingPolicy.cjs +6 -0
- package/User.cjs +11 -0
- package/UserTotp.cjs +14 -0
- package/WaitlistEntry.cjs +14 -0
- package/auth/authorization-map.cjs +306 -0
- package/auth/authorization-map.d.ts +143 -0
- package/auth/cortex-auth-checker.cjs +172 -0
- package/auth/cortex-auth-checker.d.ts +114 -0
- package/auth/credential-fields.cjs +51 -0
- package/auth/credential-fields.d.ts +19 -0
- package/auth/credential-redaction.cjs +134 -0
- package/auth/credential-redaction.d.ts +60 -0
- package/auth/graphql-auth-shadow.cjs +317 -0
- package/auth/graphql-auth-shadow.d.ts +194 -0
- package/auth/membership-write-authority.cjs +131 -0
- package/auth/membership-write-authority.d.ts +110 -0
- package/auth/mutation-authorization.cjs +376 -0
- package/auth/mutation-authorization.d.ts +261 -0
- package/auth/nested-write-inspector.cjs +189 -0
- package/auth/nested-write-inspector.d.ts +94 -0
- package/auth/nested-write-policy.cjs +189 -0
- package/auth/nested-write-policy.d.ts +99 -0
- package/auth/service-token.cjs +316 -0
- package/auth/service-token.d.ts +94 -0
- package/auth/tenancy-scope.cjs +736 -0
- package/auth/tenancy-scope.d.ts +347 -0
- package/auth/token-verifier.cjs +451 -0
- package/auth/token-verifier.d.ts +153 -0
- package/auth/totp.cjs +265 -0
- package/auth/totp.d.ts +111 -0
- package/auth/user-write-content.cjs +116 -0
- package/auth/user-write-content.d.ts +47 -0
- package/auth/ws-auth-context.cjs +75 -0
- package/auth/ws-auth-context.d.ts +69 -0
- package/config/jwtConfig.cjs +52 -0
- package/config/jwtConfig.d.ts +16 -0
- package/config/metrics.cjs +356 -0
- package/config/metrics.d.ts +128 -0
- package/config/persisted-queries.cjs +122 -0
- package/config/persisted-queries.d.ts +40 -0
- package/config/server-only-models.cjs +166 -0
- package/config/server-only-models.d.ts +89 -0
- package/config/tracing.d.ts +24 -0
- package/esm/Account.mjs +14 -0
- package/esm/AccountLinkingRequest.mjs +14 -0
- package/esm/AccountRiskMetrics.mjs +11 -0
- package/esm/AdaConversation.mjs +14 -0
- package/esm/Alert.mjs +11 -0
- package/esm/Allocation.mjs +11 -0
- package/esm/AlpacaAccount.mjs +36 -0
- package/esm/Authenticator.mjs +14 -0
- package/esm/AutoFollowRule.mjs +14 -0
- package/esm/BrokerageAccount.mjs +11 -0
- package/esm/Customer.mjs +14 -0
- package/esm/DeskDecision.mjs +11 -0
- package/esm/FeatureFlagOverride.mjs +14 -0
- package/esm/Follow.mjs +14 -0
- package/esm/Fund.mjs +56 -0
- package/esm/FundAssignment.mjs +14 -0
- package/esm/Investor.mjs +14 -0
- package/esm/LinkedProvider.mjs +14 -0
- package/esm/LlmConfiguration.mjs +14 -0
- package/esm/Mandate.mjs +14 -0
- package/esm/MandateApproval.mjs +14 -0
- package/esm/MandateVersion.mjs +14 -0
- package/esm/NotificationDelivery.mjs +14 -0
- package/esm/NotificationPreference.mjs +14 -0
- package/esm/OrgMembership.mjs +14 -0
- package/esm/PolicyOverlay.mjs +64 -0
- package/esm/PushSubscription.mjs +14 -0
- package/esm/RiskEscalationEvent.mjs +33 -0
- package/esm/Session.mjs +14 -0
- package/esm/Strategy.mjs +28 -0
- package/esm/StrategyHealthSnapshot.mjs +11 -0
- package/esm/StrategySubscription.mjs +11 -0
- package/esm/TradingPolicy.mjs +6 -0
- package/esm/User.mjs +11 -0
- package/esm/UserTotp.mjs +14 -0
- package/esm/WaitlistEntry.mjs +14 -0
- package/esm/generated/typeStrings/PolicyOverlay.d.ts +1 -1
- package/esm/generated/typeStrings/PolicyOverlay.mjs +18 -0
- package/esm/generated/typeStrings/TradingPolicy.d.ts +1 -1
- package/esm/generated/typeStrings/TradingPolicy.mjs +18 -0
- package/esm/generated/typeStrings/index.d.ts +2 -2
- package/esm/generated/typegraphql-prisma/enhance.mjs +18 -18
- package/esm/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.mjs +1 -0
- package/esm/generated/typegraphql-prisma/models/TradingPolicy.d.ts +20 -0
- package/esm/generated/typegraphql-prisma/models/TradingPolicy.mjs +27 -0
- package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyArgs.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyOrThrowArgs.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindManyTradingPolicyArgs.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/GroupByTradingPolicyArgs.d.ts +1 -1
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.mjs +7 -0
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.d.ts +1 -0
- package/esm/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.mjs +7 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.mjs +2 -0
- package/esm/middleware/mutation-account-facts.d.ts +3 -0
- package/esm/middleware/mutation-account-facts.mjs +2 -0
- package/esm/middleware/trading-policy-audit.d.ts +16 -4
- package/esm/middleware/trading-policy-audit.mjs +40 -11
- package/esm/readers/index.d.ts +10 -0
- package/esm/readers/index.mjs +10 -0
- package/esm/readers/intraday-lane-prefs.d.ts +45 -0
- package/esm/readers/intraday-lane-prefs.mjs +71 -0
- package/esm/tests/trading-policy-lane-fields-roundtrip.harness.d.ts +14 -0
- package/esm/tests/trading-policy-lane-fields-roundtrip.harness.mjs +107 -0
- package/generated/typeStrings/PolicyOverlay.cjs +18 -0
- package/generated/typeStrings/PolicyOverlay.d.ts +1 -1
- package/generated/typeStrings/TradingPolicy.cjs +18 -0
- package/generated/typeStrings/TradingPolicy.d.ts +1 -1
- package/generated/typeStrings/index.d.ts +2 -2
- package/generated/typegraphql-prisma/enhance.cjs +21 -21
- package/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.cjs +1 -0
- package/generated/typegraphql-prisma/enums/TradingPolicyScalarFieldEnum.d.ts +1 -0
- package/generated/typegraphql-prisma/index.cjs +6 -6
- package/generated/typegraphql-prisma/models/TradingPolicy.cjs +7 -0
- package/generated/typegraphql-prisma/models/TradingPolicy.d.ts +20 -0
- package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyArgs.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindFirstTradingPolicyOrThrowArgs.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/FindManyTradingPolicyArgs.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/crud/TradingPolicy/args/GroupByTradingPolicyArgs.d.ts +1 -1
- package/generated/typegraphql-prisma/resolvers/crud/args.index.cjs +95 -95
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCountOrderByAggregateInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateManyInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutAlpacaAccountInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyCreateWithoutOverlaysInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithAggregationInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyOrderByWithRelationInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyScalarWhereWithAggregatesInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateManyMutationInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutAlpacaAccountInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyUpdateWithoutOverlaysInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/inputs/TradingPolicyWhereUniqueInput.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/outputs/CreateManyAndReturnTradingPolicy.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyCountAggregate.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.cjs +6 -0
- package/generated/typegraphql-prisma/resolvers/outputs/TradingPolicyGroupBy.d.ts +1 -0
- package/generated/typegraphql-prisma/resolvers/outputs/index.cjs +1 -1
- package/generated/typegraphql-prisma/resolvers/relations/args.index.cjs +32 -32
- package/index.cjs +2 -0
- package/index.d.ts +1 -0
- package/middleware/audit-log-write-redaction.cjs +143 -0
- package/middleware/audit-log-write-redaction.d.ts +82 -0
- package/middleware/audit-logger.cjs +378 -0
- package/middleware/audit-logger.d.ts +158 -0
- package/middleware/audit-payload-guard.cjs +107 -0
- package/middleware/audit-payload-guard.d.ts +85 -0
- package/middleware/auth.cjs +66 -0
- package/middleware/auth.d.ts +41 -0
- package/middleware/credential-field-guard.cjs +514 -0
- package/middleware/credential-field-guard.d.ts +173 -0
- package/middleware/generated-type-names.cjs +77 -0
- package/middleware/generated-type-names.d.ts +44 -0
- package/middleware/graphql-validation-plugin.cjs +310 -0
- package/middleware/graphql-validation-plugin.d.ts +98 -0
- package/middleware/guard-log-throttle.cjs +89 -0
- package/middleware/guard-log-throttle.d.ts +80 -0
- package/middleware/index.cjs +57 -0
- package/middleware/index.d.ts +14 -0
- package/middleware/input-validator.cjs +220 -0
- package/middleware/input-validator.d.ts +63 -0
- package/middleware/mandate-version-validation.cjs +131 -0
- package/middleware/mandate-version-validation.d.ts +41 -0
- package/middleware/mutation-account-facts.cjs +223 -0
- package/middleware/mutation-account-facts.d.ts +143 -0
- package/middleware/mutation-auth-guard.cjs +536 -0
- package/middleware/mutation-auth-guard.d.ts +100 -0
- package/middleware/mutation-membership-facts.cjs +276 -0
- package/middleware/mutation-membership-facts.d.ts +133 -0
- package/middleware/mutation-tenant-facts.cjs +132 -0
- package/middleware/mutation-tenant-facts.d.ts +81 -0
- package/middleware/query-complexity.cjs +182 -0
- package/middleware/query-complexity.d.ts +56 -0
- package/middleware/rate-limiter.cjs +223 -0
- package/middleware/rate-limiter.d.ts +93 -0
- package/middleware/rate-tier.cjs +111 -0
- package/middleware/rate-tier.d.ts +56 -0
- package/middleware/soft-delete.cjs +175 -0
- package/middleware/soft-delete.d.ts +146 -0
- package/middleware/tenancy-scoping.cjs +229 -0
- package/middleware/tenancy-scoping.d.ts +67 -0
- package/middleware/trading-policy-audit.cjs +353 -0
- package/middleware/trading-policy-audit.d.ts +184 -0
- package/middleware/types.cjs +17 -0
- package/middleware/types.d.ts +87 -0
- package/middleware/validation-examples.cjs +398 -0
- package/middleware/validation-examples.d.ts +76 -0
- package/package.json +10 -2
- package/readers/index.cjs +15 -0
- package/readers/index.d.ts +10 -0
- package/readers/intraday-lane-prefs.cjs +76 -0
- package/readers/intraday-lane-prefs.d.ts +45 -0
- package/esm/config/__tests__/server-only-surface.harness.d.ts +0 -12
- package/esm/config/__tests__/server-only-surface.harness.mjs +0 -41
- package/esm/middleware/__tests__/audit-log-write-redaction.harness.d.ts +0 -144
- package/esm/middleware/__tests__/audit-log-write-redaction.harness.mjs +0 -920
- package/esm/middleware/__tests__/credential-field-coverage.harness.d.ts +0 -55
- package/esm/middleware/__tests__/credential-field-coverage.harness.mjs +0 -440
- package/esm/middleware/__tests__/credential-field-guard.harness.d.ts +0 -34
- package/esm/middleware/__tests__/credential-field-guard.harness.mjs +0 -212
- package/esm/middleware/__tests__/mutation-auth-guard.harness.d.ts +0 -56
- package/esm/middleware/__tests__/mutation-auth-guard.harness.mjs +0 -570
- package/esm/middleware/__tests__/rate-limit-test-utils.d.ts +0 -60
- package/esm/middleware/__tests__/rate-limit-test-utils.mjs +0 -85
- package/esm/middleware/__tests__/ts-node-harness.d.ts +0 -10
- package/esm/middleware/__tests__/ts-node-harness.mjs +0 -71
- package/health.cjs +0 -274
- package/server.cjs +0 -607
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InMemoryAPQCache = void 0;
|
|
4
|
+
exports.isAPQEnabled = isAPQEnabled;
|
|
5
|
+
exports.createAPQCache = createAPQCache;
|
|
6
|
+
exports.getCacheControlPlugin = getCacheControlPlugin;
|
|
7
|
+
const disabled_1 = require("@apollo/server/plugin/disabled");
|
|
8
|
+
const logger_1 = require("../utils/logger.cjs");
|
|
9
|
+
/**
|
|
10
|
+
* Default cache TTL for persisted query hashes in seconds.
|
|
11
|
+
* Set to 0 to disable TTL (hashes persist indefinitely in memory).
|
|
12
|
+
*/
|
|
13
|
+
const DEFAULT_CACHE_TTL_SECONDS = 0;
|
|
14
|
+
/**
|
|
15
|
+
* Maximum size of the in-memory persisted query cache.
|
|
16
|
+
* Once exceeded, oldest entries are evicted (LRU).
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_MAX_CACHE_SIZE = 1000;
|
|
19
|
+
/**
|
|
20
|
+
* Simple in-memory key-value cache implementing Apollo's KeyValueCache interface.
|
|
21
|
+
* Provides LRU eviction when the cache reaches maximum capacity.
|
|
22
|
+
*/
|
|
23
|
+
class InMemoryAPQCache {
|
|
24
|
+
constructor(maxSize) {
|
|
25
|
+
this.maxSize = maxSize || DEFAULT_MAX_CACHE_SIZE;
|
|
26
|
+
this.cache = new Map();
|
|
27
|
+
}
|
|
28
|
+
async get(key) {
|
|
29
|
+
const entry = this.cache.get(key);
|
|
30
|
+
if (!entry)
|
|
31
|
+
return undefined;
|
|
32
|
+
// Check TTL expiration
|
|
33
|
+
if (entry.expiresAt !== null && Date.now() > entry.expiresAt) {
|
|
34
|
+
this.cache.delete(key);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
// Move to end for LRU ordering (Map preserves insertion order)
|
|
38
|
+
this.cache.delete(key);
|
|
39
|
+
this.cache.set(key, entry);
|
|
40
|
+
return entry.value;
|
|
41
|
+
}
|
|
42
|
+
async set(key, value, options) {
|
|
43
|
+
var _a;
|
|
44
|
+
// Evict oldest entry if at capacity
|
|
45
|
+
if (this.cache.size >= this.maxSize && !this.cache.has(key)) {
|
|
46
|
+
const oldestKey = this.cache.keys().next().value;
|
|
47
|
+
if (oldestKey !== undefined) {
|
|
48
|
+
this.cache.delete(oldestKey);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const ttlSeconds = (_a = options === null || options === void 0 ? void 0 : options.ttl) !== null && _a !== void 0 ? _a : DEFAULT_CACHE_TTL_SECONDS;
|
|
52
|
+
const expiresAt = ttlSeconds > 0 ? Date.now() + ttlSeconds * 1000 : null;
|
|
53
|
+
this.cache.set(key, { value, expiresAt });
|
|
54
|
+
}
|
|
55
|
+
async delete(key) {
|
|
56
|
+
return this.cache.delete(key);
|
|
57
|
+
}
|
|
58
|
+
/** Returns the current number of cached entries */
|
|
59
|
+
get size() {
|
|
60
|
+
return this.cache.size;
|
|
61
|
+
}
|
|
62
|
+
/** Clears all cached entries */
|
|
63
|
+
clear() {
|
|
64
|
+
this.cache.clear();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.InMemoryAPQCache = InMemoryAPQCache;
|
|
68
|
+
/**
|
|
69
|
+
* Determines if APQ (Automatic Persisted Queries) is enabled.
|
|
70
|
+
* Enabled by default. Disable via APQ_ENABLED=false.
|
|
71
|
+
*/
|
|
72
|
+
function isAPQEnabled() {
|
|
73
|
+
const setting = process.env.APQ_ENABLED;
|
|
74
|
+
if (setting !== undefined) {
|
|
75
|
+
return setting !== 'false' && setting !== '0';
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Resolves the maximum APQ cache size from environment variables.
|
|
81
|
+
*/
|
|
82
|
+
function getMaxCacheSize() {
|
|
83
|
+
const envValue = process.env.APQ_MAX_CACHE_SIZE;
|
|
84
|
+
if (envValue) {
|
|
85
|
+
const parsed = parseInt(envValue, 10);
|
|
86
|
+
if (!isNaN(parsed) && parsed > 0)
|
|
87
|
+
return parsed;
|
|
88
|
+
}
|
|
89
|
+
return DEFAULT_MAX_CACHE_SIZE;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Creates and returns an APQ cache instance for use with Apollo Server.
|
|
93
|
+
*
|
|
94
|
+
* Apollo Server 5 enables APQ by default when a cache is available.
|
|
95
|
+
* To disable APQ entirely, set APQ_ENABLED=false.
|
|
96
|
+
*
|
|
97
|
+
* @returns The configured APQ cache, or undefined if APQ is disabled
|
|
98
|
+
*/
|
|
99
|
+
function createAPQCache() {
|
|
100
|
+
if (!isAPQEnabled()) {
|
|
101
|
+
logger_1.logger.info('Automatic Persisted Queries (APQ) disabled');
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
const maxSize = getMaxCacheSize();
|
|
105
|
+
const cache = new InMemoryAPQCache(maxSize);
|
|
106
|
+
logger_1.logger.info('Automatic Persisted Queries (APQ) enabled', {
|
|
107
|
+
maxCacheSize: maxSize,
|
|
108
|
+
});
|
|
109
|
+
return cache;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Returns the Apollo Server cache control plugin configuration.
|
|
113
|
+
* When APQ is disabled, this returns the cache control disabled plugin
|
|
114
|
+
* to explicitly disable caching behavior.
|
|
115
|
+
*/
|
|
116
|
+
function getCacheControlPlugin() {
|
|
117
|
+
if (!isAPQEnabled()) {
|
|
118
|
+
return (0, disabled_1.ApolloServerPluginCacheControlDisabled)();
|
|
119
|
+
}
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=persisted-queries.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApolloServerPluginCacheControlDisabled } from '@apollo/server/plugin/disabled';
|
|
2
|
+
/**
|
|
3
|
+
* Simple in-memory key-value cache implementing Apollo's KeyValueCache interface.
|
|
4
|
+
* Provides LRU eviction when the cache reaches maximum capacity.
|
|
5
|
+
*/
|
|
6
|
+
export declare class InMemoryAPQCache {
|
|
7
|
+
private cache;
|
|
8
|
+
private readonly maxSize;
|
|
9
|
+
constructor(maxSize?: number);
|
|
10
|
+
get(key: string): Promise<string | undefined>;
|
|
11
|
+
set(key: string, value: string, options?: {
|
|
12
|
+
ttl?: number | null;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
delete(key: string): Promise<boolean>;
|
|
15
|
+
/** Returns the current number of cached entries */
|
|
16
|
+
get size(): number;
|
|
17
|
+
/** Clears all cached entries */
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Determines if APQ (Automatic Persisted Queries) is enabled.
|
|
22
|
+
* Enabled by default. Disable via APQ_ENABLED=false.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isAPQEnabled(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Creates and returns an APQ cache instance for use with Apollo Server.
|
|
27
|
+
*
|
|
28
|
+
* Apollo Server 5 enables APQ by default when a cache is available.
|
|
29
|
+
* To disable APQ entirely, set APQ_ENABLED=false.
|
|
30
|
+
*
|
|
31
|
+
* @returns The configured APQ cache, or undefined if APQ is disabled
|
|
32
|
+
*/
|
|
33
|
+
export declare function createAPQCache(): InMemoryAPQCache | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the Apollo Server cache control plugin configuration.
|
|
36
|
+
* When APQ is disabled, this returns the cache control disabled plugin
|
|
37
|
+
* to explicitly disable caching behavior.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getCacheControlPlugin(): ReturnType<typeof ApolloServerPluginCacheControlDisabled> | undefined;
|
|
40
|
+
//# sourceMappingURL=persisted-queries.d.ts.map
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WRITE_ONLY_FIELDS = exports.SERVER_ONLY_MODELS = void 0;
|
|
4
|
+
exports.isServerOnlyModel = isServerOnlyModel;
|
|
5
|
+
exports.withoutServerOnlyResolvers = withoutServerOnlyResolvers;
|
|
6
|
+
exports.isServerOnlyTypeName = isServerOnlyTypeName;
|
|
7
|
+
exports.writeOnlyOutputFieldsFor = writeOnlyOutputFieldsFor;
|
|
8
|
+
exports.withoutServerOnlySchemaSurface = withoutServerOnlySchemaSurface;
|
|
9
|
+
const graphql_1 = require("graphql");
|
|
10
|
+
const generated_type_names_1 = require("../middleware/generated-type-names.cjs");
|
|
11
|
+
/**
|
|
12
|
+
* Prisma models that are server-only: they live in the schema (so Prisma owns
|
|
13
|
+
* their migrations and the client can read them) but are NEVER part of the
|
|
14
|
+
* GraphQL API or the published `adaptic.*` client surface.
|
|
15
|
+
*
|
|
16
|
+
* typegraphql-prisma has no model-level opt-out, so the exclusion is applied at
|
|
17
|
+
* every point where the generated surface is assembled:
|
|
18
|
+
* - `src/server.ts` drops the model's generated resolver classes before
|
|
19
|
+
* `buildSchema`, so no query, mutation or object type for it exists, and
|
|
20
|
+
* strips what the omit directive cannot reach from the built schema (the
|
|
21
|
+
* relation count on the parent's `_count` type and the filter inputs it
|
|
22
|
+
* drags in);
|
|
23
|
+
* - `src/modules/index.ts`, `generateSelections.ts` and `generateStrings.ts`
|
|
24
|
+
* skip it, so no CRUD functions, selection set or typeString is published;
|
|
25
|
+
* - any relation field that points at it from an exposed model carries
|
|
26
|
+
* `@TypeGraphQL.omit(output: true, input: true)` plus `GQL.SKIP=true` and
|
|
27
|
+
* `TYPESTRING.SKIP=true` in the schema.
|
|
28
|
+
*
|
|
29
|
+
* TradeRestatement: the trade restatement ledger. Written only by operator
|
|
30
|
+
* restatement scripts inside the repair transaction; with the resolver
|
|
31
|
+
* authChecker and the mutation guard both still shadow-first, a generated CRUD
|
|
32
|
+
* surface would let any caller rewrite or delete the record of what was
|
|
33
|
+
* restated, and expose whole prior trade rows.
|
|
34
|
+
*/
|
|
35
|
+
exports.SERVER_ONLY_MODELS = ['TradeRestatement'];
|
|
36
|
+
const SERVER_ONLY_MODEL_SET = new Set(exports.SERVER_ONLY_MODELS);
|
|
37
|
+
/**
|
|
38
|
+
* @param modelName - A Prisma model name (PascalCase).
|
|
39
|
+
* @returns Whether the model must be kept off the GraphQL/client surface.
|
|
40
|
+
*/
|
|
41
|
+
function isServerOnlyModel(modelName) {
|
|
42
|
+
return SERVER_ONLY_MODEL_SET.has(modelName);
|
|
43
|
+
}
|
|
44
|
+
/** Suffixes typegraphql-prisma gives the per-model classes in its `resolvers` export. */
|
|
45
|
+
const GENERATED_RESOLVER_SUFFIXES = ['CrudResolver', 'RelationsResolver'];
|
|
46
|
+
/**
|
|
47
|
+
* Removes the generated resolver classes of server-only models.
|
|
48
|
+
*
|
|
49
|
+
* @param resolvers - The generated `resolvers` array from typegraphql-prisma.
|
|
50
|
+
* @returns The array without any `<Model>CrudResolver` / `<Model>RelationsResolver`
|
|
51
|
+
* whose model is server-only, non-empty as `buildSchema` requires.
|
|
52
|
+
*/
|
|
53
|
+
function withoutServerOnlyResolvers(resolvers) {
|
|
54
|
+
const kept = resolvers.filter((resolver) => {
|
|
55
|
+
for (const suffix of GENERATED_RESOLVER_SUFFIXES) {
|
|
56
|
+
if (resolver.name.endsWith(suffix)) {
|
|
57
|
+
return !isServerOnlyModel(resolver.name.slice(0, -suffix.length));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
});
|
|
62
|
+
const [first, ...rest] = kept;
|
|
63
|
+
if (first === undefined) {
|
|
64
|
+
throw new Error('withoutServerOnlyResolvers: no resolvers left');
|
|
65
|
+
}
|
|
66
|
+
return [first, ...rest];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @param typeName - A GraphQL type name.
|
|
70
|
+
* @returns Whether the type is a server-only model or one of its generated
|
|
71
|
+
* companions (`<Model>WhereInput`, `<Model>ListRelationFilter`, ...).
|
|
72
|
+
*/
|
|
73
|
+
function isServerOnlyTypeName(typeName) {
|
|
74
|
+
return exports.SERVER_ONLY_MODELS.some((model) => typeName === model ||
|
|
75
|
+
(typeName.startsWith(model) &&
|
|
76
|
+
/^[A-Z]/.test(typeName.slice(model.length))));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Write-only columns, by Prisma model: a caller may set them through the
|
|
80
|
+
* generated create / update inputs, but no output type returns them. They are
|
|
81
|
+
* read only server-side, through Prisma.
|
|
82
|
+
*
|
|
83
|
+
* Each column also carries `@TypeGraphQL.omit(output: true, input: ["where",
|
|
84
|
+
* "orderBy"])`, `GQL.SKIP=true` and `TYPESTRING.SKIP=true` in the schema. The
|
|
85
|
+
* omit directive removes the column from the model type and the predicate
|
|
86
|
+
* inputs only: typegraphql-prisma still emits it on the model's `GroupBy`,
|
|
87
|
+
* `MinAggregate`, `MaxAggregate` and `CountAggregate` types and on the
|
|
88
|
+
* `CreateManyAndReturn` / `UpdateManyAndReturn` row types, where it would be
|
|
89
|
+
* served by value. {@link withoutServerOnlySchemaSurface} removes it there.
|
|
90
|
+
*
|
|
91
|
+
* UserTotp: the TOTP shared secret (encrypted at rest) and the hashes of the
|
|
92
|
+
* unused recovery codes. Either lets its holder pass the second factor.
|
|
93
|
+
*/
|
|
94
|
+
exports.WRITE_ONLY_FIELDS = new Map([['UserTotp', new Set(['secretEnc', 'recoveryCodesHash'])]]);
|
|
95
|
+
const WRITE_ONLY_OUTPUTS = (0, generated_type_names_1.indexGeneratedTypes)(exports.WRITE_ONLY_FIELDS);
|
|
96
|
+
/** Suffix of the generated per-model count aggregate output type. */
|
|
97
|
+
const COUNT_AGGREGATE_SUFFIX = 'CountAggregate';
|
|
98
|
+
/**
|
|
99
|
+
* @param typeName - A GraphQL output type name.
|
|
100
|
+
* @returns The write-only columns that type would serve, or `undefined`.
|
|
101
|
+
*/
|
|
102
|
+
function writeOnlyOutputFieldsFor(typeName) {
|
|
103
|
+
const valued = WRITE_ONLY_OUTPUTS.outputFields(typeName);
|
|
104
|
+
if (valued)
|
|
105
|
+
return valued;
|
|
106
|
+
// The count aggregate returns how many rows hold a value, not the value;
|
|
107
|
+
// it is removed too so no output type names a write-only column at all.
|
|
108
|
+
return typeName.endsWith(COUNT_AGGREGATE_SUFFIX)
|
|
109
|
+
? exports.WRITE_ONLY_FIELDS.get(typeName.slice(0, -COUNT_AGGREGATE_SUFFIX.length))
|
|
110
|
+
: undefined;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Removes every field that returns, or takes an argument of, a server-only
|
|
114
|
+
* type, and every write-only column ({@link WRITE_ONLY_FIELDS}) from the
|
|
115
|
+
* output types that would serve it, then rebuilds the schema so types
|
|
116
|
+
* reachable only through those fields drop out of the type map (and out of
|
|
117
|
+
* introspection).
|
|
118
|
+
*
|
|
119
|
+
* typegraphql-prisma's `@TypeGraphQL.omit` hides a relation field from the
|
|
120
|
+
* model type and its inputs but still emits the relation's count on the
|
|
121
|
+
* parent's `<Model>Count` type (e.g. `TradeCount.restatements(where:
|
|
122
|
+
* TradeRestatementWhereInput)`), which would let a caller count and filter
|
|
123
|
+
* ledger rows. Resolver functions are untouched: the rebuilt schema reuses the
|
|
124
|
+
* same type objects, so middleware and auth decorators applied by `buildSchema`
|
|
125
|
+
* carry over.
|
|
126
|
+
*
|
|
127
|
+
* @param schema - The schema returned by `buildSchema`.
|
|
128
|
+
* @returns A schema with no server-only type or field.
|
|
129
|
+
*/
|
|
130
|
+
function withoutServerOnlySchemaSurface(schema) {
|
|
131
|
+
for (const type of Object.values(schema.getTypeMap())) {
|
|
132
|
+
if (type.name.startsWith('__') || isServerOnlyTypeName(type.name)) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if ((0, graphql_1.isObjectType)(type) || (0, graphql_1.isInterfaceType)(type)) {
|
|
136
|
+
const fields = type.getFields();
|
|
137
|
+
const writeOnly = writeOnlyOutputFieldsFor(type.name);
|
|
138
|
+
for (const [name, field] of Object.entries(fields)) {
|
|
139
|
+
if (writeOnly === null || writeOnly === void 0 ? void 0 : writeOnly.has(name)) {
|
|
140
|
+
delete fields[name];
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
const touchesServerOnly = isServerOnlyTypeName((0, graphql_1.getNamedType)(field.type).name) ||
|
|
144
|
+
field.args.some((arg) => isServerOnlyTypeName((0, graphql_1.getNamedType)(arg.type).name));
|
|
145
|
+
if (touchesServerOnly) {
|
|
146
|
+
delete fields[name];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else if ((0, graphql_1.isInputObjectType)(type)) {
|
|
151
|
+
const fields = type.getFields();
|
|
152
|
+
for (const [name, field] of Object.entries(fields)) {
|
|
153
|
+
if (isServerOnlyTypeName((0, graphql_1.getNamedType)(field.type).name)) {
|
|
154
|
+
delete fields[name];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Rebuild from the root types only, so companions that were reachable solely
|
|
160
|
+
// through the stripped fields (filters for the ledger's own columns) leave the
|
|
161
|
+
// type map too. `buildSchema` is not given `orphanedTypes`, so every type it
|
|
162
|
+
// emits is reachable from a root; nothing legitimate is lost.
|
|
163
|
+
const config = schema.toConfig();
|
|
164
|
+
return new graphql_1.GraphQLSchema({ ...config, types: [] });
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=server-only-models.js.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { GraphQLSchema } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Prisma models that are server-only: they live in the schema (so Prisma owns
|
|
4
|
+
* their migrations and the client can read them) but are NEVER part of the
|
|
5
|
+
* GraphQL API or the published `adaptic.*` client surface.
|
|
6
|
+
*
|
|
7
|
+
* typegraphql-prisma has no model-level opt-out, so the exclusion is applied at
|
|
8
|
+
* every point where the generated surface is assembled:
|
|
9
|
+
* - `src/server.ts` drops the model's generated resolver classes before
|
|
10
|
+
* `buildSchema`, so no query, mutation or object type for it exists, and
|
|
11
|
+
* strips what the omit directive cannot reach from the built schema (the
|
|
12
|
+
* relation count on the parent's `_count` type and the filter inputs it
|
|
13
|
+
* drags in);
|
|
14
|
+
* - `src/modules/index.ts`, `generateSelections.ts` and `generateStrings.ts`
|
|
15
|
+
* skip it, so no CRUD functions, selection set or typeString is published;
|
|
16
|
+
* - any relation field that points at it from an exposed model carries
|
|
17
|
+
* `@TypeGraphQL.omit(output: true, input: true)` plus `GQL.SKIP=true` and
|
|
18
|
+
* `TYPESTRING.SKIP=true` in the schema.
|
|
19
|
+
*
|
|
20
|
+
* TradeRestatement: the trade restatement ledger. Written only by operator
|
|
21
|
+
* restatement scripts inside the repair transaction; with the resolver
|
|
22
|
+
* authChecker and the mutation guard both still shadow-first, a generated CRUD
|
|
23
|
+
* surface would let any caller rewrite or delete the record of what was
|
|
24
|
+
* restated, and expose whole prior trade rows.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SERVER_ONLY_MODELS: readonly string[];
|
|
27
|
+
/**
|
|
28
|
+
* @param modelName - A Prisma model name (PascalCase).
|
|
29
|
+
* @returns Whether the model must be kept off the GraphQL/client surface.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isServerOnlyModel(modelName: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Removes the generated resolver classes of server-only models.
|
|
34
|
+
*
|
|
35
|
+
* @param resolvers - The generated `resolvers` array from typegraphql-prisma.
|
|
36
|
+
* @returns The array without any `<Model>CrudResolver` / `<Model>RelationsResolver`
|
|
37
|
+
* whose model is server-only, non-empty as `buildSchema` requires.
|
|
38
|
+
*/
|
|
39
|
+
export declare function withoutServerOnlyResolvers<T extends {
|
|
40
|
+
name: string;
|
|
41
|
+
}>(resolvers: readonly T[]): [T, ...T[]];
|
|
42
|
+
/**
|
|
43
|
+
* @param typeName - A GraphQL type name.
|
|
44
|
+
* @returns Whether the type is a server-only model or one of its generated
|
|
45
|
+
* companions (`<Model>WhereInput`, `<Model>ListRelationFilter`, ...).
|
|
46
|
+
*/
|
|
47
|
+
export declare function isServerOnlyTypeName(typeName: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Write-only columns, by Prisma model: a caller may set them through the
|
|
50
|
+
* generated create / update inputs, but no output type returns them. They are
|
|
51
|
+
* read only server-side, through Prisma.
|
|
52
|
+
*
|
|
53
|
+
* Each column also carries `@TypeGraphQL.omit(output: true, input: ["where",
|
|
54
|
+
* "orderBy"])`, `GQL.SKIP=true` and `TYPESTRING.SKIP=true` in the schema. The
|
|
55
|
+
* omit directive removes the column from the model type and the predicate
|
|
56
|
+
* inputs only: typegraphql-prisma still emits it on the model's `GroupBy`,
|
|
57
|
+
* `MinAggregate`, `MaxAggregate` and `CountAggregate` types and on the
|
|
58
|
+
* `CreateManyAndReturn` / `UpdateManyAndReturn` row types, where it would be
|
|
59
|
+
* served by value. {@link withoutServerOnlySchemaSurface} removes it there.
|
|
60
|
+
*
|
|
61
|
+
* UserTotp: the TOTP shared secret (encrypted at rest) and the hashes of the
|
|
62
|
+
* unused recovery codes. Either lets its holder pass the second factor.
|
|
63
|
+
*/
|
|
64
|
+
export declare const WRITE_ONLY_FIELDS: ReadonlyMap<string, ReadonlySet<string>>;
|
|
65
|
+
/**
|
|
66
|
+
* @param typeName - A GraphQL output type name.
|
|
67
|
+
* @returns The write-only columns that type would serve, or `undefined`.
|
|
68
|
+
*/
|
|
69
|
+
export declare function writeOnlyOutputFieldsFor(typeName: string): ReadonlySet<string> | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Removes every field that returns, or takes an argument of, a server-only
|
|
72
|
+
* type, and every write-only column ({@link WRITE_ONLY_FIELDS}) from the
|
|
73
|
+
* output types that would serve it, then rebuilds the schema so types
|
|
74
|
+
* reachable only through those fields drop out of the type map (and out of
|
|
75
|
+
* introspection).
|
|
76
|
+
*
|
|
77
|
+
* typegraphql-prisma's `@TypeGraphQL.omit` hides a relation field from the
|
|
78
|
+
* model type and its inputs but still emits the relation's count on the
|
|
79
|
+
* parent's `<Model>Count` type (e.g. `TradeCount.restatements(where:
|
|
80
|
+
* TradeRestatementWhereInput)`), which would let a caller count and filter
|
|
81
|
+
* ledger rows. Resolver functions are untouched: the rebuilt schema reuses the
|
|
82
|
+
* same type objects, so middleware and auth decorators applied by `buildSchema`
|
|
83
|
+
* carry over.
|
|
84
|
+
*
|
|
85
|
+
* @param schema - The schema returned by `buildSchema`.
|
|
86
|
+
* @returns A schema with no server-only type or field.
|
|
87
|
+
*/
|
|
88
|
+
export declare function withoutServerOnlySchemaSurface(schema: GraphQLSchema): GraphQLSchema;
|
|
89
|
+
//# sourceMappingURL=server-only-models.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initializes OpenTelemetry tracing for the backend-legacy service.
|
|
3
|
+
*
|
|
4
|
+
* Configures:
|
|
5
|
+
* - HTTP instrumentation for incoming/outgoing HTTP requests
|
|
6
|
+
* - Express instrumentation for route-level spans
|
|
7
|
+
* - GraphQL instrumentation for resolver-level spans
|
|
8
|
+
* - OTLP HTTP exporter for sending traces to a collector (e.g., Jaeger, Grafana Tempo)
|
|
9
|
+
*
|
|
10
|
+
* Environment variables:
|
|
11
|
+
* - OTEL_TRACING_ENABLED: Explicit on/off ('true'/'false'). Defaults to on in production/staging.
|
|
12
|
+
* - OTEL_EXPORTER_OTLP_ENDPOINT: Collector endpoint (default: http://localhost:4318/v1/traces)
|
|
13
|
+
* - OTEL_SERVICE_NAME: Override service name (default: 'backend-legacy')
|
|
14
|
+
*
|
|
15
|
+
* Call this function before any other imports that need instrumentation (e.g., before Express/Apollo setup).
|
|
16
|
+
*/
|
|
17
|
+
export declare function initTracing(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Gracefully shuts down the OpenTelemetry SDK.
|
|
20
|
+
* Should be called during application shutdown (SIGTERM/SIGINT handlers).
|
|
21
|
+
* Flushes any pending spans before shutting down.
|
|
22
|
+
*/
|
|
23
|
+
export declare function shutdownTracing(): Promise<void>;
|
|
24
|
+
//# sourceMappingURL=tracing.d.ts.map
|
package/esm/Account.mjs
CHANGED
|
@@ -360,6 +360,7 @@ export const Account = {
|
|
|
360
360
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
361
361
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
362
362
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
363
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
363
364
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
364
365
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
365
366
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -4079,6 +4080,7 @@ export const Account = {
|
|
|
4079
4080
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? {
|
|
4080
4081
|
set: item.tradingPolicy.dayTradeOnly
|
|
4081
4082
|
} : undefined,
|
|
4083
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
4082
4084
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
4083
4085
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
4084
4086
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -4207,6 +4209,7 @@ export const Account = {
|
|
|
4207
4209
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
4208
4210
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
4209
4211
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
4212
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
4210
4213
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
4211
4214
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
4212
4215
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -5026,6 +5029,7 @@ export const Account = {
|
|
|
5026
5029
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
5027
5030
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
5028
5031
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
5032
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
5029
5033
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
5030
5034
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
5031
5035
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -12451,6 +12455,7 @@ export const Account = {
|
|
|
12451
12455
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
12452
12456
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
12453
12457
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
12458
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
12454
12459
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
12455
12460
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
12456
12461
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -15623,6 +15628,7 @@ export const Account = {
|
|
|
15623
15628
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
15624
15629
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
15625
15630
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
15631
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
15626
15632
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
15627
15633
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
15628
15634
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -19049,6 +19055,7 @@ export const Account = {
|
|
|
19049
19055
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? {
|
|
19050
19056
|
set: item.tradingPolicy.dayTradeOnly
|
|
19051
19057
|
} : undefined,
|
|
19058
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
19052
19059
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
19053
19060
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
19054
19061
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -19177,6 +19184,7 @@ export const Account = {
|
|
|
19177
19184
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
19178
19185
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
19179
19186
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
19187
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
19180
19188
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
19181
19189
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
19182
19190
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -19996,6 +20004,7 @@ export const Account = {
|
|
|
19996
20004
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
19997
20005
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
19998
20006
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
20007
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
19999
20008
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
20000
20009
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
20001
20010
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -27421,6 +27430,7 @@ export const Account = {
|
|
|
27421
27430
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
27422
27431
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
27423
27432
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
27433
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
27424
27434
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
27425
27435
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
27426
27436
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -30995,6 +31005,7 @@ export const Account = {
|
|
|
30995
31005
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? {
|
|
30996
31006
|
set: item.tradingPolicy.dayTradeOnly
|
|
30997
31007
|
} : undefined,
|
|
31008
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
30998
31009
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
30999
31010
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
31000
31011
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -31123,6 +31134,7 @@ export const Account = {
|
|
|
31123
31134
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
31124
31135
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
31125
31136
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
31137
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
31126
31138
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
31127
31139
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
31128
31140
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -31942,6 +31954,7 @@ export const Account = {
|
|
|
31942
31954
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
31943
31955
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
31944
31956
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
31957
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
31945
31958
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
31946
31959
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
31947
31960
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|
|
@@ -39367,6 +39380,7 @@ export const Account = {
|
|
|
39367
39380
|
maxOrdersPerWindow: item.tradingPolicy.maxOrdersPerWindow !== undefined ? item.tradingPolicy.maxOrdersPerWindow : undefined,
|
|
39368
39381
|
orderWindowSeconds: item.tradingPolicy.orderWindowSeconds !== undefined ? item.tradingPolicy.orderWindowSeconds : undefined,
|
|
39369
39382
|
dayTradeOnly: item.tradingPolicy.dayTradeOnly !== undefined ? item.tradingPolicy.dayTradeOnly : undefined,
|
|
39383
|
+
intradayLanePrefs: item.tradingPolicy.intradayLanePrefs !== undefined ? item.tradingPolicy.intradayLanePrefs : undefined,
|
|
39370
39384
|
riskBudgetPrefs: item.tradingPolicy.riskBudgetPrefs !== undefined ? item.tradingPolicy.riskBudgetPrefs : undefined,
|
|
39371
39385
|
signalConsumptionPrefs: item.tradingPolicy.signalConsumptionPrefs !== undefined ? item.tradingPolicy.signalConsumptionPrefs : undefined,
|
|
39372
39386
|
executionPrefs: item.tradingPolicy.executionPrefs !== undefined ? item.tradingPolicy.executionPrefs : undefined,
|