@adaptic/backend 0.0.1049 → 0.0.1051
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/esm/resolvers/custom/AccountEquityCurveResolver.d.ts +32 -0
- package/esm/resolvers/custom/AccountEquityCurveResolver.d.ts.map +1 -0
- package/esm/resolvers/custom/AccountEquityCurveResolver.js.map +1 -0
- package/esm/resolvers/custom/AccountEquityCurveResolver.mjs +206 -0
- package/esm/resolvers/custom/account-audit-read.d.ts +182 -0
- package/esm/resolvers/custom/account-audit-read.d.ts.map +1 -0
- package/esm/resolvers/custom/account-audit-read.js.map +1 -0
- package/esm/resolvers/custom/account-audit-read.mjs +315 -0
- package/esm/resolvers/custom/index.d.ts +1 -0
- package/esm/resolvers/custom/index.d.ts.map +1 -1
- package/esm/resolvers/custom/index.js.map +1 -1
- package/esm/resolvers/custom/index.mjs +1 -0
- package/package.json +1 -1
- package/resolvers/custom/AccountEquityCurveResolver.cjs +233 -0
- package/resolvers/custom/AccountEquityCurveResolver.d.ts +32 -0
- package/resolvers/custom/AccountEquityCurveResolver.d.ts.map +1 -0
- package/resolvers/custom/AccountEquityCurveResolver.js.map +1 -0
- package/resolvers/custom/account-audit-read.cjs +333 -0
- package/resolvers/custom/account-audit-read.d.ts +182 -0
- package/resolvers/custom/account-audit-read.d.ts.map +1 -0
- package/resolvers/custom/account-audit-read.js.map +1 -0
- package/resolvers/custom/index.cjs +5 -1
- package/resolvers/custom/index.d.ts +1 -0
- package/resolvers/custom/index.d.ts.map +1 -1
- package/resolvers/custom/index.js.map +1 -1
- package/server.cjs +1 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AlpacaFetch } from './account-audit-read';
|
|
2
|
+
export declare class EquityCurvePoint {
|
|
3
|
+
ms: number;
|
|
4
|
+
equity: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class AccountEquityCurve {
|
|
7
|
+
accountId: string;
|
|
8
|
+
accountType: string;
|
|
9
|
+
accountName: string;
|
|
10
|
+
sessionDate: string;
|
|
11
|
+
points: EquityCurvePoint[];
|
|
12
|
+
lastEquity: number;
|
|
13
|
+
equity: number;
|
|
14
|
+
source: string;
|
|
15
|
+
}
|
|
16
|
+
interface GraphQLContext {
|
|
17
|
+
req?: {
|
|
18
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Injectable HTTP client. Exported as a test seam only: nothing in production
|
|
23
|
+
* reassigns `current`, and the default is the global `fetch`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const alpacaFetch: {
|
|
26
|
+
current: AlpacaFetch;
|
|
27
|
+
};
|
|
28
|
+
export declare class AccountEquityCurveResolver {
|
|
29
|
+
accountEquityCurve(ctx: GraphQLContext, accountId: string, sessionDate?: string): Promise<AccountEquityCurve>;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=AccountEquityCurveResolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountEquityCurveResolver.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/custom/AccountEquityCurveResolver.ts"],"names":[],"mappings":"AAsBA,OAAO,EASL,KAAK,WAAW,EAGjB,MAAM,sBAAsB,CAAC;AAE9B,qBACa,gBAAgB;IAE3B,EAAE,EAAG,MAAM,CAAC;IAGZ,MAAM,EAAG,MAAM,CAAC;CACjB;AAED,qBACa,kBAAkB;IAE7B,SAAS,EAAG,MAAM,CAAC;IAGnB,WAAW,EAAG,MAAM,CAAC;IAGrB,WAAW,EAAG,MAAM,CAAC;IAGrB,WAAW,EAAG,MAAM,CAAC;IAGrB,MAAM,EAAG,gBAAgB,EAAE,CAAC;IAG5B,UAAU,EAAG,MAAM,CAAC;IAGpB,MAAM,EAAG,MAAM,CAAC;IAGhB,MAAM,EAAG,MAAM,CAAC;CACjB;AAED,UAAU,cAAc;IACtB,GAAG,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAA;KAAE,CAAC;CACnE;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE;IAAE,OAAO,EAAE,WAAW,CAAA;CAE/C,CAAC;AAqEF,qBACa,0BAA0B;IAK/B,kBAAkB,CACH,GAAG,EAAE,cAAc,EACQ,SAAS,EAAE,MAAM,EACK,WAAW,CAAC,EAAE,MAAM,GACvF,OAAO,CAAC,kBAAkB,CAAC;CA4B/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountEquityCurveResolver.js","sourceRoot":"","sources":["../../../../src/resolvers/custom/AccountEquityCurveResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,WAAW,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAIhB,MAAM,sBAAsB,CAAC;AAGvB,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAE3B,EAAE,CAAU;IAGZ,MAAM,CAAU;CACjB,CAAA;AAJC;IADC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;;4CACjC;AAGZ;IADC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC;;gDAC7B;AALL,gBAAgB;IAD5B,WAAW,CAAC,UAAU,CAAC,kBAAkB,EAAE,EAAE,CAAC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AAC;CACF,CAAA;AAhCO;IAJL,WAAW,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,kBAAkB,EAAE;QACnD,WAAW,EACT,yHAAyH;KAC5H,CAAC;IAEC,WAAA,WAAW,CAAC,GAAG,EAAE,CAAA;IACjB,WAAA,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,CAAA;IAC5C,WAAA,WAAW,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;;;;oEA4BpE;AApCU,0BAA0B;IADtC,WAAW,CAAC,QAAQ,EAAE;GACV,0BAA0B,CAqCtC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* `accountEquityCurve` — server-side audit read.
|
|
15
|
+
*
|
|
16
|
+
* Returns an account's 1-minute equity curve without the caller ever holding
|
|
17
|
+
* the account's broker key. Requires an audit-read token in the
|
|
18
|
+
* `x-adaptic-audit-token` header (see `assertAuditRead`) and refuses LIVE
|
|
19
|
+
* accounts.
|
|
20
|
+
* Read-only on the broker; every read spends a per-account request budget and
|
|
21
|
+
* writes an `AuditLog` row naming the operator, account and operation. Once the
|
|
22
|
+
* token verifies, a refusal (unknown or deleted account, LIVE account, incomplete
|
|
23
|
+
* broker snapshot) also writes a row, with its reason. No row is written for an
|
|
24
|
+
* unverified caller, a bad `sessionDate`, a failed account lookup, or a rate-limited
|
|
25
|
+
* or failed broker call (those after the read row leave only that row).
|
|
26
|
+
*
|
|
27
|
+
* @module resolvers/custom/AccountEquityCurveResolver
|
|
28
|
+
*/
|
|
29
|
+
import * as TypeGraphQL from 'type-graphql';
|
|
30
|
+
import { GraphQLError } from 'graphql';
|
|
31
|
+
import { getPrismaFromContext } from '../../generated/typegraphql-prisma/helpers.mjs';
|
|
32
|
+
import { logger } from '../../utils/logger.mjs';
|
|
33
|
+
import { AuditReadRefused, assertAccountIdShape, assertAccountReadable, assertAuditRead, auditTokenFromHeaders, createAccountBudgets, parseSessionDate, readEquityCurve, } from './account-audit-read.mjs';
|
|
34
|
+
let EquityCurvePoint = class EquityCurvePoint {
|
|
35
|
+
ms;
|
|
36
|
+
equity;
|
|
37
|
+
};
|
|
38
|
+
__decorate([
|
|
39
|
+
TypeGraphQL.Field((_t) => TypeGraphQL.Float),
|
|
40
|
+
__metadata("design:type", Number)
|
|
41
|
+
], EquityCurvePoint.prototype, "ms", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
TypeGraphQL.Field((_t) => TypeGraphQL.Float),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], EquityCurvePoint.prototype, "equity", void 0);
|
|
46
|
+
EquityCurvePoint = __decorate([
|
|
47
|
+
TypeGraphQL.ObjectType('EquityCurvePoint', {})
|
|
48
|
+
], EquityCurvePoint);
|
|
49
|
+
export { EquityCurvePoint };
|
|
50
|
+
let AccountEquityCurve = class AccountEquityCurve {
|
|
51
|
+
accountId;
|
|
52
|
+
accountType;
|
|
53
|
+
accountName;
|
|
54
|
+
sessionDate;
|
|
55
|
+
points;
|
|
56
|
+
lastEquity;
|
|
57
|
+
equity;
|
|
58
|
+
source;
|
|
59
|
+
};
|
|
60
|
+
__decorate([
|
|
61
|
+
TypeGraphQL.Field((_t) => String),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], AccountEquityCurve.prototype, "accountId", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
TypeGraphQL.Field((_t) => String),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], AccountEquityCurve.prototype, "accountType", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
TypeGraphQL.Field((_t) => String),
|
|
70
|
+
__metadata("design:type", String)
|
|
71
|
+
], AccountEquityCurve.prototype, "accountName", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
TypeGraphQL.Field((_t) => String),
|
|
74
|
+
__metadata("design:type", String)
|
|
75
|
+
], AccountEquityCurve.prototype, "sessionDate", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
TypeGraphQL.Field((_t) => [EquityCurvePoint]),
|
|
78
|
+
__metadata("design:type", Array)
|
|
79
|
+
], AccountEquityCurve.prototype, "points", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
TypeGraphQL.Field((_t) => TypeGraphQL.Float),
|
|
82
|
+
__metadata("design:type", Number)
|
|
83
|
+
], AccountEquityCurve.prototype, "lastEquity", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
TypeGraphQL.Field((_t) => TypeGraphQL.Float),
|
|
86
|
+
__metadata("design:type", Number)
|
|
87
|
+
], AccountEquityCurve.prototype, "equity", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
TypeGraphQL.Field((_t) => String),
|
|
90
|
+
__metadata("design:type", String)
|
|
91
|
+
], AccountEquityCurve.prototype, "source", void 0);
|
|
92
|
+
AccountEquityCurve = __decorate([
|
|
93
|
+
TypeGraphQL.ObjectType('AccountEquityCurve', {})
|
|
94
|
+
], AccountEquityCurve);
|
|
95
|
+
export { AccountEquityCurve };
|
|
96
|
+
/**
|
|
97
|
+
* Injectable HTTP client. Exported as a test seam only: nothing in production
|
|
98
|
+
* reassigns `current`, and the default is the global `fetch`.
|
|
99
|
+
*/
|
|
100
|
+
export const alpacaFetch = {
|
|
101
|
+
current: (url, init) => fetch(url, init),
|
|
102
|
+
};
|
|
103
|
+
const accountBudget = createAccountBudgets();
|
|
104
|
+
/** Width of `AuditLog.recordId`; only a malformed (refused) account id can exceed it. */
|
|
105
|
+
const RECORD_ID_MAX = 255;
|
|
106
|
+
function auditRowData(p, outcome) {
|
|
107
|
+
const accountId = p.accountId.slice(0, RECORD_ID_MAX);
|
|
108
|
+
return {
|
|
109
|
+
operationType: 'CREATE',
|
|
110
|
+
modelName: 'AuditRead',
|
|
111
|
+
recordId: accountId,
|
|
112
|
+
operationName: p.op,
|
|
113
|
+
changedFields: {},
|
|
114
|
+
metadata: { operator: p.operator, accountId, op: p.op, ...p.detail, ...outcome },
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/** `AuditLog.operationType` has no READ member, so a read is recorded as a CREATE of an `AuditRead` record. */
|
|
118
|
+
async function recordRead(prisma, p) {
|
|
119
|
+
try {
|
|
120
|
+
await prisma.auditLog.create({ data: auditRowData(p, { outcome: 'read' }) });
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
// Fail closed: an unrecorded read is not served.
|
|
124
|
+
logger.error('[audit-read] could not write the AuditLog row; refusing the read', { operator: p.operator, accountId: p.accountId, op: p.op, ...errDetail(err) });
|
|
125
|
+
throw new GraphQLError('Audit read could not be recorded', { extensions: { code: 'INTERNAL_SERVER_ERROR' } });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Record a refusal of a verified caller's read. The caller still gets the
|
|
130
|
+
* refusal if the row cannot be written: nothing is served either way, and the
|
|
131
|
+
* refusal is the truthful answer.
|
|
132
|
+
*/
|
|
133
|
+
async function recordRefusal(prisma, p, reason) {
|
|
134
|
+
try {
|
|
135
|
+
await prisma.auditLog.create({ data: auditRowData(p, { outcome: 'refused', reason }) });
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
logger.error('[audit-read] could not write the AuditLog row for a refused read', { operator: p.operator, accountId: p.accountId, op: p.op, reason, ...errDetail(err) });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** A soft-deleted account is not found. */
|
|
142
|
+
async function loadAccount(prisma, id) {
|
|
143
|
+
assertAccountIdShape(id);
|
|
144
|
+
const account = await prisma.alpacaAccount.findFirst({
|
|
145
|
+
where: { id, deletedAt: null },
|
|
146
|
+
select: { id: true, type: true, APIKey: true, APISecret: true, configuration: true },
|
|
147
|
+
});
|
|
148
|
+
if (!account)
|
|
149
|
+
throw new AuditReadRefused('ACCOUNT_NOT_FOUND', 'Account not found', 'NOT_FOUND');
|
|
150
|
+
return account;
|
|
151
|
+
}
|
|
152
|
+
/** The error's message and code, since logging the object itself serialises as `{}`. */
|
|
153
|
+
function errDetail(err) {
|
|
154
|
+
return {
|
|
155
|
+
err: err instanceof Error ? err.message : String(err),
|
|
156
|
+
code: err?.code,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
let AccountEquityCurveResolver = class AccountEquityCurveResolver {
|
|
160
|
+
async accountEquityCurve(ctx, accountId, sessionDate) {
|
|
161
|
+
// Throws before any row: a caller whose token does not verify is unattributed.
|
|
162
|
+
const operator = assertAuditRead(auditTokenFromHeaders(ctx.req?.headers));
|
|
163
|
+
const date = parseSessionDate(sessionDate);
|
|
164
|
+
const prisma = getPrismaFromContext(ctx);
|
|
165
|
+
// `row.accountId` is the caller's text until the lookup answers, then the
|
|
166
|
+
// stored id: Postgres matches a uuid in either case, so the budget and the
|
|
167
|
+
// rows key on the stored form or one account would get a budget per spelling.
|
|
168
|
+
const row = { operator, accountId, op: 'accountEquityCurve', detail: { sessionDate: date } };
|
|
169
|
+
try {
|
|
170
|
+
const account = await loadAccount(prisma, accountId);
|
|
171
|
+
row.accountId = account.id;
|
|
172
|
+
assertAccountReadable(account);
|
|
173
|
+
await recordRead(prisma, row);
|
|
174
|
+
return await readEquityCurve({
|
|
175
|
+
account,
|
|
176
|
+
sessionDate: date,
|
|
177
|
+
nowMs: Date.now(),
|
|
178
|
+
fetchImpl: alpacaFetch.current,
|
|
179
|
+
budget: accountBudget(account.id),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
// An incomplete snapshot is refused after the read row is written, so
|
|
184
|
+
// that read leaves two rows: the key use, then the refusal.
|
|
185
|
+
if (err instanceof AuditReadRefused)
|
|
186
|
+
await recordRefusal(prisma, row, err.reason);
|
|
187
|
+
throw err;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
__decorate([
|
|
192
|
+
TypeGraphQL.Query((_returns) => AccountEquityCurve, {
|
|
193
|
+
description: 'A session’s 1-minute equity curve for one account, read server-side. Requires an audit-read token. PAPER accounts only.',
|
|
194
|
+
}),
|
|
195
|
+
__param(0, TypeGraphQL.Ctx()),
|
|
196
|
+
__param(1, TypeGraphQL.Arg('accountId', (_t) => String)),
|
|
197
|
+
__param(2, TypeGraphQL.Arg('sessionDate', (_t) => String, { nullable: true })),
|
|
198
|
+
__metadata("design:type", Function),
|
|
199
|
+
__metadata("design:paramtypes", [Object, String, String]),
|
|
200
|
+
__metadata("design:returntype", Promise)
|
|
201
|
+
], AccountEquityCurveResolver.prototype, "accountEquityCurve", null);
|
|
202
|
+
AccountEquityCurveResolver = __decorate([
|
|
203
|
+
TypeGraphQL.Resolver()
|
|
204
|
+
], AccountEquityCurveResolver);
|
|
205
|
+
export { AccountEquityCurveResolver };
|
|
206
|
+
//# sourceMappingURL=AccountEquityCurveResolver.js.map
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side audit read of an account's equity curve.
|
|
3
|
+
*
|
|
4
|
+
* The audit toolkit used to read an account's broker key and secret and call
|
|
5
|
+
* Alpaca itself, which meant issuing an audit principal handed out live broker
|
|
6
|
+
* credentials. This read moves the Alpaca call here: the caller names an
|
|
7
|
+
* account and receives the curve, and the key never leaves this process.
|
|
8
|
+
*
|
|
9
|
+
* Everything in this module is pure or takes its collaborators as arguments
|
|
10
|
+
* (`fetchImpl`, `nowMs`), so it is unit-testable without a database or network.
|
|
11
|
+
*
|
|
12
|
+
* @module resolvers/custom/account-audit-read
|
|
13
|
+
*/
|
|
14
|
+
import { GraphQLError } from 'graphql';
|
|
15
|
+
/** `sub` prefix the audit toolkit mints (`adaptic-audit:<who>@<host>:<pid>`). */
|
|
16
|
+
export declare const AUDIT_SUBJECT_PREFIX = "adaptic-audit:";
|
|
17
|
+
/** Env var holding the comma-separated operators admitted to the audit-read role. */
|
|
18
|
+
export declare const AUDIT_READ_OPERATORS_ENV = "AUDIT_READ_OPERATORS";
|
|
19
|
+
/** Env var holding the HS256 secret that signs audit-read tokens, and nothing else. */
|
|
20
|
+
export declare const AUDIT_READ_JWT_SECRET_ENV = "AUDIT_READ_JWT_SECRET";
|
|
21
|
+
/**
|
|
22
|
+
* Request header the audit token travels in.
|
|
23
|
+
*
|
|
24
|
+
* Not `Authorization`: the shared verifier would refuse a token it cannot
|
|
25
|
+
* verify with HTTP 401 before any resolver ran, and teaching it this secret
|
|
26
|
+
* would make audit-read one more way to become a `server` principal. A
|
|
27
|
+
* separate header keeps the two trust roots apart.
|
|
28
|
+
*/
|
|
29
|
+
export declare const AUDIT_READ_TOKEN_HEADER = "x-adaptic-audit-token";
|
|
30
|
+
/** Issuer every audit-read token must carry. */
|
|
31
|
+
export declare const AUDIT_READ_ISSUER = "adaptic-audit";
|
|
32
|
+
/** Audience every audit-read token must carry. */
|
|
33
|
+
export declare const AUDIT_READ_AUDIENCE = "adaptic-backend:audit-read";
|
|
34
|
+
/** Minimum length for the audit-read secret, in characters. */
|
|
35
|
+
export declare const MINIMUM_AUDIT_SECRET_LENGTH = 32;
|
|
36
|
+
/** Largest lifetime (`exp - iat`) honoured on an audit-read token, and the longest it is accepted ahead of its `exp`, seconds. */
|
|
37
|
+
export declare const MAX_AUDIT_TOKEN_LIFETIME_SEC = 300;
|
|
38
|
+
/** How far in the future an `iat` may sit before the token is refused, seconds. */
|
|
39
|
+
export declare const MAX_AUDIT_TOKEN_CLOCK_SKEW_SEC = 60;
|
|
40
|
+
/** Upstream Alpaca requests allowed per account per window, shared by every operator reading it. */
|
|
41
|
+
export declare const ACCOUNT_REQUEST_BUDGET = 40;
|
|
42
|
+
/** Length of the per-account budget window, ms. */
|
|
43
|
+
export declare const ACCOUNT_BUDGET_WINDOW_MS = 60000;
|
|
44
|
+
/** Longest one Alpaca request may take before it is abandoned, ms. */
|
|
45
|
+
export declare const ALPACA_TIMEOUT_MS = 10000;
|
|
46
|
+
/** The stored account fields a read needs. Never returned to the caller. */
|
|
47
|
+
export interface AuditAccountRow {
|
|
48
|
+
id: string;
|
|
49
|
+
type: 'PAPER' | 'LIVE';
|
|
50
|
+
APIKey: string;
|
|
51
|
+
APISecret: string;
|
|
52
|
+
configuration?: unknown;
|
|
53
|
+
}
|
|
54
|
+
/** A request to Alpaca with the stored key. */
|
|
55
|
+
export type AlpacaFetch = (url: string, init: {
|
|
56
|
+
headers: Record<string, string>;
|
|
57
|
+
signal?: AbortSignal;
|
|
58
|
+
}) => Promise<{
|
|
59
|
+
ok: boolean;
|
|
60
|
+
status: number;
|
|
61
|
+
text: () => Promise<string>;
|
|
62
|
+
}>;
|
|
63
|
+
/** Spends upstream requests against an account's budget; throws when it is exhausted. */
|
|
64
|
+
export type RequestBudget = (n?: number) => void;
|
|
65
|
+
/**
|
|
66
|
+
* A sliding-window request budget per account.
|
|
67
|
+
*
|
|
68
|
+
* Audit reads spend the book's own trading key, so the window is keyed on the
|
|
69
|
+
* account (the key being protected), not the operator: several operators on one
|
|
70
|
+
* book share one budget, and the engine's order traffic cannot be starved. State is
|
|
71
|
+
* in-process: with several backend instances the effective ceiling is the
|
|
72
|
+
* budget times the instance count, still bounded.
|
|
73
|
+
*
|
|
74
|
+
* @param limit - Requests allowed per window.
|
|
75
|
+
* @param windowMs - Window length.
|
|
76
|
+
* @param now - Clock, injectable for tests.
|
|
77
|
+
* @returns A function that returns the account's `RequestBudget`.
|
|
78
|
+
*/
|
|
79
|
+
export declare function createAccountBudgets(limit?: number, windowMs?: number, now?: () => number): (accountId: string) => RequestBudget;
|
|
80
|
+
/**
|
|
81
|
+
* The audit-read token from a request's headers, or null when absent.
|
|
82
|
+
*
|
|
83
|
+
* A repeated header arrives as an array and is refused rather than guessed at.
|
|
84
|
+
*/
|
|
85
|
+
export declare function auditTokenFromHeaders(headers: Record<string, string | string[] | undefined> | undefined): string | null;
|
|
86
|
+
/**
|
|
87
|
+
* The audit-read role, enforced in the resolver.
|
|
88
|
+
*
|
|
89
|
+
* Fail-closed, and independent of the request's principal. A `server`
|
|
90
|
+
* principal otherwise bypasses every role gate and `@Authorized()` is
|
|
91
|
+
* shadow-first, so neither can carry this; and any holder of the shared
|
|
92
|
+
* service secret can mint a `server` principal with whatever `sub` it likes.
|
|
93
|
+
* So the caller must present a token signed with `AUDIT_READ_JWT_SECRET`, a
|
|
94
|
+
* secret with no other use, bound to this issuer and audience, short-lived,
|
|
95
|
+
* whose `sub` is `adaptic-audit:<who>@…` with `<who>` in
|
|
96
|
+
* `AUDIT_READ_OPERATORS`. A token signed with any other secret is refused
|
|
97
|
+
* whatever its `sub` says. An unset secret or an empty list admits nobody.
|
|
98
|
+
*
|
|
99
|
+
* @param token - The raw audit-read token, or null/undefined when absent.
|
|
100
|
+
* @param env - Environment to read the secret and operator list from.
|
|
101
|
+
* @param nowSec - Current time, seconds since the epoch.
|
|
102
|
+
* @returns The operator the read is attributed to.
|
|
103
|
+
* @throws {GraphQLError} `UNAUTHENTICATED` without a token, `FORBIDDEN` otherwise.
|
|
104
|
+
*/
|
|
105
|
+
export declare function assertAuditRead(token: string | null | undefined, env?: Record<string, string | undefined>, nowSec?: number): string;
|
|
106
|
+
/** Why a read was refused after its audit token verified. Recorded on the refusal's AuditLog row. */
|
|
107
|
+
export type AuditReadRefusalReason = 'ACCOUNT_NOT_FOUND' | 'ACCOUNT_NOT_PAPER' | 'SNAPSHOT_INCOMPLETE';
|
|
108
|
+
/**
|
|
109
|
+
* A read refused after the audit token verified, so the operator is known.
|
|
110
|
+
*
|
|
111
|
+
* Token failures from `assertAuditRead` are plain `GraphQLError`s and leave no
|
|
112
|
+
* record: the caller is unattributed. This class marks the refusals that do get
|
|
113
|
+
* an AuditLog row, and carries the reason that goes on it.
|
|
114
|
+
*/
|
|
115
|
+
export declare class AuditReadRefused extends GraphQLError {
|
|
116
|
+
readonly reason: AuditReadRefusalReason;
|
|
117
|
+
constructor(reason: AuditReadRefusalReason, message: string, code: 'NOT_FOUND' | 'FORBIDDEN' | 'BAD_GATEWAY');
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Refuse an account id that cannot name a stored account.
|
|
121
|
+
*
|
|
122
|
+
* `AlpacaAccount.id` is a Postgres uuid, and Prisma throws on a non-uuid
|
|
123
|
+
* lookup, so a malformed id would otherwise surface as an internal error with
|
|
124
|
+
* no refusal recorded.
|
|
125
|
+
*
|
|
126
|
+
* @throws {AuditReadRefused} `ACCOUNT_NOT_FOUND` for anything but a uuid.
|
|
127
|
+
*/
|
|
128
|
+
export declare function assertAccountIdShape(accountId: string): void;
|
|
129
|
+
/** Audit reads are PAPER-only; a LIVE account is refused. */
|
|
130
|
+
export declare function assertAccountReadable(account: AuditAccountRow): void;
|
|
131
|
+
/**
|
|
132
|
+
* The snapshot's `equity` and `last_equity` as finite numbers.
|
|
133
|
+
*
|
|
134
|
+
* Alpaca sends both as decimal strings. A missing, empty or non-numeric value
|
|
135
|
+
* refuses the read rather than serving `NaN` (or `0`, which `Number('')` and
|
|
136
|
+
* `Number(null)` would give): either reads as a real figure to whoever audits it.
|
|
137
|
+
*
|
|
138
|
+
* @throws {AuditReadRefused} `SNAPSHOT_INCOMPLETE` naming the unusable fields.
|
|
139
|
+
*/
|
|
140
|
+
export declare function snapshotEquity(snap: unknown): {
|
|
141
|
+
equity: number;
|
|
142
|
+
lastEquity: number;
|
|
143
|
+
};
|
|
144
|
+
/** The ET calendar date of an instant, YYYY-MM-DD. */
|
|
145
|
+
export declare function etDateOf(ms: number): string;
|
|
146
|
+
/**
|
|
147
|
+
* Validate a `YYYY-MM-DD` session date.
|
|
148
|
+
*
|
|
149
|
+
* @throws {GraphQLError} `BAD_USER_INPUT` for anything else, so nothing the
|
|
150
|
+
* caller sends is ever spliced into a URL unchecked.
|
|
151
|
+
*/
|
|
152
|
+
export declare function parseSessionDate(raw: string | null | undefined): string | null;
|
|
153
|
+
/** The curve as returned to the caller. */
|
|
154
|
+
export interface EquityCurve {
|
|
155
|
+
accountId: string;
|
|
156
|
+
accountType: 'PAPER' | 'LIVE';
|
|
157
|
+
accountName: string;
|
|
158
|
+
sessionDate: string;
|
|
159
|
+
points: Array<{
|
|
160
|
+
ms: number;
|
|
161
|
+
equity: number;
|
|
162
|
+
}>;
|
|
163
|
+
lastEquity: number;
|
|
164
|
+
equity: number;
|
|
165
|
+
source: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Read one session's 1-minute equity curve and the account snapshot.
|
|
169
|
+
*
|
|
170
|
+
* @param p.account - The stored account row (carries the key; not returned).
|
|
171
|
+
* @param p.sessionDate - Pin a past session, or null for today's ET date.
|
|
172
|
+
* @param p.fetchImpl - Injected HTTP client.
|
|
173
|
+
* @throws {AuditReadRefused} for a LIVE account or an incomplete snapshot.
|
|
174
|
+
*/
|
|
175
|
+
export declare function readEquityCurve(p: {
|
|
176
|
+
account: AuditAccountRow;
|
|
177
|
+
sessionDate: string | null;
|
|
178
|
+
nowMs: number;
|
|
179
|
+
fetchImpl: AlpacaFetch;
|
|
180
|
+
budget: RequestBudget;
|
|
181
|
+
}): Promise<EquityCurve>;
|
|
182
|
+
//# sourceMappingURL=account-audit-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-audit-read.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/custom/account-audit-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC,iFAAiF;AACjF,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAErD,qFAAqF;AACrF,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAE/D,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,0BAA0B,CAAC;AAE/D,gDAAgD;AAChD,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,+BAA+B,CAAC;AAEhE,+DAA+D;AAC/D,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,kIAAkI;AAClI,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,mFAAmF;AACnF,eAAO,MAAM,8BAA8B,KAAK,CAAC;AAEjD,oGAAoG;AACpG,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,mDAAmD;AACnD,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,sEAAsE;AACtE,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAGxC,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,+CAA+C;AAC/C,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE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oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAI5D;AAED,6DAA6D;AAC7D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAIpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAepF;AAED,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAM9E;AAiCD,2CAA2C;AAC3C,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,GAAG,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE;IACvC,OAAO,EAAE,eAAe,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,aAAa,CAAC;CACvB,GAAG,OAAO,CAAC,WAAW,CAAC,CAkCvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-audit-read.js","sourceRoot":"","sources":["../../../../src/resolvers/custom/account-audit-read.ts"],"names":[],"mappings":"A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