@tansohq/credit-forecast-tanso 0.1.0
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/dist/index.d.ts +48 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type DecimalString, type ForecastInput, type ISODate } from "@tansohq/credit-forecast-schema";
|
|
2
|
+
export interface TansoForecastSnapshot {
|
|
3
|
+
readonly sourceSchemaVersion: "1.0";
|
|
4
|
+
readonly asOf: ISODate;
|
|
5
|
+
readonly currentBalance: DecimalString;
|
|
6
|
+
readonly dailyUsage: readonly {
|
|
7
|
+
readonly date: ISODate;
|
|
8
|
+
readonly creditsUsed: DecimalString;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
export interface TansoForecastAssumptions {
|
|
12
|
+
readonly schemaVersion: string;
|
|
13
|
+
readonly methodologyVersion: string;
|
|
14
|
+
readonly period: {
|
|
15
|
+
readonly startDate: ISODate;
|
|
16
|
+
readonly endDate: ISODate;
|
|
17
|
+
readonly allocation: DecimalString;
|
|
18
|
+
readonly lowBalanceThreshold: DecimalString;
|
|
19
|
+
};
|
|
20
|
+
readonly lookbackDays: number;
|
|
21
|
+
readonly scheduledBalanceDeltas: readonly {
|
|
22
|
+
readonly date: ISODate;
|
|
23
|
+
readonly creditDelta: DecimalString;
|
|
24
|
+
readonly reason?: string | undefined;
|
|
25
|
+
}[];
|
|
26
|
+
readonly scenarioMultipliers: {
|
|
27
|
+
readonly low: DecimalString;
|
|
28
|
+
readonly base: DecimalString;
|
|
29
|
+
readonly high: DecimalString;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface TansoMappingIssue {
|
|
33
|
+
readonly code: string;
|
|
34
|
+
readonly path: string;
|
|
35
|
+
readonly message: string;
|
|
36
|
+
}
|
|
37
|
+
export interface TansoMappingFailure {
|
|
38
|
+
readonly code: "TANSO_MAPPING_FAILED";
|
|
39
|
+
readonly issues: readonly TansoMappingIssue[];
|
|
40
|
+
}
|
|
41
|
+
export declare class TansoMappingError extends Error {
|
|
42
|
+
readonly code: "TANSO_MAPPING_FAILED";
|
|
43
|
+
readonly issues: readonly TansoMappingIssue[];
|
|
44
|
+
constructor(issues: readonly TansoMappingIssue[]);
|
|
45
|
+
toJSON(): TansoMappingFailure;
|
|
46
|
+
}
|
|
47
|
+
export declare function mapTansoSnapshotToForecastInput(snapshot: TansoForecastSnapshot, assumptions: TansoForecastAssumptions): ForecastInput;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,OAAO,EACb,MAAM,iCAAiC,CAAC;AAGzC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,aAAa,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,SAAS;QAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;QACvB,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;KACrC,EAAE,CAAC;CACL;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;QAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC;QACnC,QAAQ,CAAC,mBAAmB,EA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UsageSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
date: ISODateSchema,
|
|
6
|
+
creditsUsed: DecimalStringSchema,
|
|
7
|
+
})
|
|
8
|
+
.strict();
|
|
9
|
+
const ScheduledBalanceDeltaSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
date: ISODateSchema,
|
|
12
|
+
creditDelta: DecimalStringSchema,
|
|
13
|
+
reason: z.string().min(1).optional(),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
const TansoForecastSnapshotSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
sourceSchemaVersion: z.literal("1.0"),
|
|
19
|
+
asOf: ISODateSchema,
|
|
20
|
+
currentBalance: DecimalStringSchema,
|
|
21
|
+
dailyUsage: z.array(DailyUsageSchema),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
const TansoForecastAssumptionsSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
schemaVersion: z.string().min(1),
|
|
27
|
+
methodologyVersion: z.string().min(1),
|
|
28
|
+
period: z
|
|
29
|
+
.object({
|
|
30
|
+
startDate: ISODateSchema,
|
|
31
|
+
endDate: ISODateSchema,
|
|
32
|
+
allocation: DecimalStringSchema,
|
|
33
|
+
lowBalanceThreshold: DecimalStringSchema,
|
|
34
|
+
})
|
|
35
|
+
.strict(),
|
|
36
|
+
lookbackDays: z.number().int(),
|
|
37
|
+
scheduledBalanceDeltas: z.array(ScheduledBalanceDeltaSchema),
|
|
38
|
+
scenarioMultipliers: z
|
|
39
|
+
.object({
|
|
40
|
+
low: DecimalStringSchema,
|
|
41
|
+
base: DecimalStringSchema,
|
|
42
|
+
high: DecimalStringSchema,
|
|
43
|
+
})
|
|
44
|
+
.strict(),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
47
|
+
const pathToString = (prefix, path) => path.reduce((result, segment) => typeof segment === "number" ? `${result}[${segment}]` : `${result}.${segment}`, prefix);
|
|
48
|
+
const localIssueCode = (issue, path) => {
|
|
49
|
+
if (issue.code === "invalid_type" && issue.received === "undefined") {
|
|
50
|
+
return "REQUIRED_FIELD";
|
|
51
|
+
}
|
|
52
|
+
if (issue.code === "unrecognized_keys") {
|
|
53
|
+
return "UNRECOGNIZED_FIELD";
|
|
54
|
+
}
|
|
55
|
+
if (path === "snapshot.sourceSchemaVersion") {
|
|
56
|
+
return "UNSUPPORTED_SOURCE_SCHEMA_VERSION";
|
|
57
|
+
}
|
|
58
|
+
if (path.endsWith(".asOf") || path.endsWith("Date") || path.endsWith(".date")) {
|
|
59
|
+
return "INVALID_DATE";
|
|
60
|
+
}
|
|
61
|
+
if (path.endsWith(".currentBalance") ||
|
|
62
|
+
path.endsWith(".creditsUsed") ||
|
|
63
|
+
path.endsWith(".allocation") ||
|
|
64
|
+
path.endsWith(".lowBalanceThreshold") ||
|
|
65
|
+
path.endsWith(".creditDelta") ||
|
|
66
|
+
path.endsWith(".low") ||
|
|
67
|
+
path.endsWith(".base") ||
|
|
68
|
+
path.endsWith(".high")) {
|
|
69
|
+
return "INVALID_DECIMAL";
|
|
70
|
+
}
|
|
71
|
+
return "INVALID_VALUE";
|
|
72
|
+
};
|
|
73
|
+
const localIssues = (prefix, issues) => issues.map((issue) => {
|
|
74
|
+
const path = pathToString(prefix, issue.path);
|
|
75
|
+
const unknownKeys = issue.keys?.join(", ");
|
|
76
|
+
return {
|
|
77
|
+
code: localIssueCode(issue, path),
|
|
78
|
+
path,
|
|
79
|
+
message: unknownKeys === undefined ? issue.message : `${issue.message}: ${unknownKeys}`,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
const scenarioKeys = ["low", "base", "high"];
|
|
83
|
+
const forecastIssuePath = (path) => {
|
|
84
|
+
const [root, second, third] = path;
|
|
85
|
+
if (root === "schemaVersion")
|
|
86
|
+
return "assumptions.schemaVersion";
|
|
87
|
+
if (root === "methodologyVersion")
|
|
88
|
+
return "assumptions.methodologyVersion";
|
|
89
|
+
if (root === "asOf")
|
|
90
|
+
return "snapshot.asOf";
|
|
91
|
+
if (root === "period") {
|
|
92
|
+
return pathToString("assumptions", path);
|
|
93
|
+
}
|
|
94
|
+
if (root === "lookbackDays")
|
|
95
|
+
return "assumptions.lookbackDays";
|
|
96
|
+
if (root === "dailyUsage") {
|
|
97
|
+
return pathToString("snapshot", path);
|
|
98
|
+
}
|
|
99
|
+
if (root === "balance" && second === "current")
|
|
100
|
+
return "snapshot.currentBalance";
|
|
101
|
+
if (root === "balance" && second === "schedule") {
|
|
102
|
+
return pathToString("assumptions", ["scheduledBalanceDeltas", ...path.slice(2)]);
|
|
103
|
+
}
|
|
104
|
+
if (root === "scenarios") {
|
|
105
|
+
if (typeof second === "number" && third === "burnMultiplier") {
|
|
106
|
+
const scenarioKey = scenarioKeys[second];
|
|
107
|
+
if (scenarioKey !== undefined) {
|
|
108
|
+
return `assumptions.scenarioMultipliers.${scenarioKey}`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return "assumptions.scenarioMultipliers";
|
|
112
|
+
}
|
|
113
|
+
return "assumptions";
|
|
114
|
+
};
|
|
115
|
+
const forecastIssues = (issues) => issues.map((issue) => ({
|
|
116
|
+
code: typeof issue.params?.forecastCode === "string"
|
|
117
|
+
? issue.params.forecastCode
|
|
118
|
+
: "INVALID_FORECAST_INPUT",
|
|
119
|
+
path: forecastIssuePath(issue.path),
|
|
120
|
+
message: issue.message,
|
|
121
|
+
}));
|
|
122
|
+
export class TansoMappingError extends Error {
|
|
123
|
+
code = "TANSO_MAPPING_FAILED";
|
|
124
|
+
issues;
|
|
125
|
+
constructor(issues) {
|
|
126
|
+
super("Tanso snapshot mapping failed");
|
|
127
|
+
this.name = "TansoMappingError";
|
|
128
|
+
this.issues = issues;
|
|
129
|
+
}
|
|
130
|
+
toJSON() {
|
|
131
|
+
return {
|
|
132
|
+
code: this.code,
|
|
133
|
+
issues: this.issues,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export function mapTansoSnapshotToForecastInput(snapshot, assumptions) {
|
|
138
|
+
const parsedSnapshot = TansoForecastSnapshotSchema.safeParse(snapshot);
|
|
139
|
+
const parsedAssumptions = TansoForecastAssumptionsSchema.safeParse(assumptions);
|
|
140
|
+
if (!parsedSnapshot.success || !parsedAssumptions.success) {
|
|
141
|
+
const issues = [
|
|
142
|
+
...(!parsedSnapshot.success
|
|
143
|
+
? localIssues("snapshot", parsedSnapshot.error.issues)
|
|
144
|
+
: []),
|
|
145
|
+
...(!parsedAssumptions.success
|
|
146
|
+
? localIssues("assumptions", parsedAssumptions.error.issues)
|
|
147
|
+
: []),
|
|
148
|
+
];
|
|
149
|
+
throw new TansoMappingError(issues);
|
|
150
|
+
}
|
|
151
|
+
const candidate = {
|
|
152
|
+
schemaVersion: parsedAssumptions.data.schemaVersion,
|
|
153
|
+
methodologyVersion: parsedAssumptions.data.methodologyVersion,
|
|
154
|
+
asOf: parsedSnapshot.data.asOf,
|
|
155
|
+
period: {
|
|
156
|
+
startDate: parsedAssumptions.data.period.startDate,
|
|
157
|
+
endDate: parsedAssumptions.data.period.endDate,
|
|
158
|
+
allocation: parsedAssumptions.data.period.allocation,
|
|
159
|
+
lowBalanceThreshold: parsedAssumptions.data.period.lowBalanceThreshold,
|
|
160
|
+
},
|
|
161
|
+
lookbackDays: parsedAssumptions.data.lookbackDays,
|
|
162
|
+
dailyUsage: parsedSnapshot.data.dailyUsage.map((entry) => ({
|
|
163
|
+
date: entry.date,
|
|
164
|
+
creditsUsed: entry.creditsUsed,
|
|
165
|
+
})),
|
|
166
|
+
balance: {
|
|
167
|
+
current: parsedSnapshot.data.currentBalance,
|
|
168
|
+
schedule: parsedAssumptions.data.scheduledBalanceDeltas.map((entry) => ({
|
|
169
|
+
date: entry.date,
|
|
170
|
+
creditDelta: entry.creditDelta,
|
|
171
|
+
...(entry.reason === undefined ? {} : { reason: entry.reason }),
|
|
172
|
+
})),
|
|
173
|
+
},
|
|
174
|
+
scenarios: [
|
|
175
|
+
{ key: "low", burnMultiplier: parsedAssumptions.data.scenarioMultipliers.low },
|
|
176
|
+
{ key: "base", burnMultiplier: parsedAssumptions.data.scenarioMultipliers.base },
|
|
177
|
+
{ key: "high", burnMultiplier: parsedAssumptions.data.scenarioMultipliers.high },
|
|
178
|
+
],
|
|
179
|
+
};
|
|
180
|
+
const parsedForecast = ForecastInputSchema.safeParse(candidate);
|
|
181
|
+
if (!parsedForecast.success) {
|
|
182
|
+
throw new TansoMappingError(forecastIssues(parsedForecast.error.issues));
|
|
183
|
+
}
|
|
184
|
+
return parsedForecast.data;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GAId,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsDxB,MAAM,gBAAgB,GAAG,CAAC;KACvB,MAAM,CAAC;IACN,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,mBAAmB;CACjC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,2BAA2B,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,mBAAmB;IAChC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,2BAA2B,GAAqC,CAAC;KACpE,MAAM,CAAC;IACN,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACrC,IAAI,EAAE,aAAa;IACnB,cAAc,EAAE,mBAAmB;IACnC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;CACtC,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,MAAM,8BAA8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AC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;aAChE,CAAC,CAAC;SACJ;QACD,SAAS,EAAE;YACT,EAAE,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE;YAC9E,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE;YAChF,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE;SACjF;KACO,CAAC;IAEX,MAAM,cAAc,GAAG,mBAAmB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAChE,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;QAC5B,MAAM,IAAI,iBAAiB,CACzB,cAAc,CAAC,cAAc,CAAC,KAAK,CAAC,MAAmC,CAAC,CACzE,CAAC;IACJ,CAAC;IAED,OAAO,cAAc,CAAC,IAAI,CAAC;AAC7B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tansohq/credit-forecast-tanso",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Optional pure Tanso snapshot adapter for provider-neutral credit forecasts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/tansohq/credit-estimator.git",
|
|
21
|
+
"directory": "packages/adapters/tanso"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/tansohq/credit-estimator#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/tansohq/credit-estimator/issues"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"zod": "^3.24.1",
|
|
32
|
+
"@tansohq/credit-forecast-schema": "0.1.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"typescript": "^5.7.2",
|
|
36
|
+
"@tansohq/credit-forecast-core": "0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -p tsconfig.build.json",
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
44
|
+
}
|
|
45
|
+
}
|