@oatfi/oatfi-sdk-ts 0.11.66 → 0.11.67
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/README.md +5 -0
- package/dist/commonjs/funcs/internalProgramSettingsGet.d.ts +18 -0
- package/dist/commonjs/funcs/internalProgramSettingsGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/internalProgramSettingsGet.js +130 -0
- package/dist/commonjs/funcs/internalProgramSettingsGet.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/index.d.ts +4 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/lmsbusinesstype.d.ts +18 -0
- package/dist/commonjs/models/lmsbusinesstype.d.ts.map +1 -0
- package/dist/commonjs/models/lmsbusinesstype.js +52 -0
- package/dist/commonjs/models/lmsbusinesstype.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/internalprogramsettingscontrollergetprogramsettings.d.ts +15 -0
- package/dist/commonjs/models/operations/internalprogramsettingscontrollergetprogramsettings.d.ts.map +1 -0
- package/dist/commonjs/models/operations/internalprogramsettingscontrollergetprogramsettings.js +50 -0
- package/dist/commonjs/models/operations/internalprogramsettingscontrollergetprogramsettings.js.map +1 -0
- package/dist/commonjs/models/programonboardingsettingsdto.d.ts +41 -0
- package/dist/commonjs/models/programonboardingsettingsdto.d.ts.map +1 -0
- package/dist/commonjs/models/programonboardingsettingsdto.js +69 -0
- package/dist/commonjs/models/programonboardingsettingsdto.js.map +1 -0
- package/dist/commonjs/models/programsettingsresponsedto.d.ts +31 -0
- package/dist/commonjs/models/programsettingsresponsedto.d.ts.map +1 -0
- package/dist/commonjs/models/programsettingsresponsedto.js +64 -0
- package/dist/commonjs/models/programsettingsresponsedto.js.map +1 -0
- package/dist/commonjs/models/programunderwritingsettingsdto.d.ts +135 -0
- package/dist/commonjs/models/programunderwritingsettingsdto.d.ts.map +1 -0
- package/dist/commonjs/models/programunderwritingsettingsdto.js +135 -0
- package/dist/commonjs/models/programunderwritingsettingsdto.js.map +1 -0
- package/dist/commonjs/models/underwritingsettingsdto.d.ts +22 -30
- package/dist/commonjs/models/underwritingsettingsdto.d.ts.map +1 -1
- package/dist/commonjs/models/underwritingsettingsdto.js +30 -31
- package/dist/commonjs/models/underwritingsettingsdto.js.map +1 -1
- package/dist/commonjs/sdk/internalprogramsettings.d.ts +13 -0
- package/dist/commonjs/sdk/internalprogramsettings.d.ts.map +1 -0
- package/dist/commonjs/sdk/internalprogramsettings.js +22 -0
- package/dist/commonjs/sdk/internalprogramsettings.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/internalProgramSettingsGet.d.ts +18 -0
- package/dist/esm/funcs/internalProgramSettingsGet.d.ts.map +1 -0
- package/dist/esm/funcs/internalProgramSettingsGet.js +94 -0
- package/dist/esm/funcs/internalProgramSettingsGet.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/lmsbusinesstype.d.ts +18 -0
- package/dist/esm/models/lmsbusinesstype.d.ts.map +1 -0
- package/dist/esm/models/lmsbusinesstype.js +16 -0
- package/dist/esm/models/lmsbusinesstype.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/internalprogramsettingscontrollergetprogramsettings.d.ts +15 -0
- package/dist/esm/models/operations/internalprogramsettingscontrollergetprogramsettings.d.ts.map +1 -0
- package/dist/esm/models/operations/internalprogramsettingscontrollergetprogramsettings.js +13 -0
- package/dist/esm/models/operations/internalprogramsettingscontrollergetprogramsettings.js.map +1 -0
- package/dist/esm/models/programonboardingsettingsdto.d.ts +41 -0
- package/dist/esm/models/programonboardingsettingsdto.d.ts.map +1 -0
- package/dist/esm/models/programonboardingsettingsdto.js +32 -0
- package/dist/esm/models/programonboardingsettingsdto.js.map +1 -0
- package/dist/esm/models/programsettingsresponsedto.d.ts +31 -0
- package/dist/esm/models/programsettingsresponsedto.d.ts.map +1 -0
- package/dist/esm/models/programsettingsresponsedto.js +27 -0
- package/dist/esm/models/programsettingsresponsedto.js.map +1 -0
- package/dist/esm/models/programunderwritingsettingsdto.d.ts +135 -0
- package/dist/esm/models/programunderwritingsettingsdto.d.ts.map +1 -0
- package/dist/esm/models/programunderwritingsettingsdto.js +98 -0
- package/dist/esm/models/programunderwritingsettingsdto.js.map +1 -0
- package/dist/esm/models/underwritingsettingsdto.d.ts +22 -30
- package/dist/esm/models/underwritingsettingsdto.d.ts.map +1 -1
- package/dist/esm/models/underwritingsettingsdto.js +29 -30
- package/dist/esm/models/underwritingsettingsdto.js.map +1 -1
- package/dist/esm/sdk/internalprogramsettings.d.ts +13 -0
- package/dist/esm/sdk/internalprogramsettings.d.ts.map +1 -0
- package/dist/esm/sdk/internalprogramsettings.js +18 -0
- package/dist/esm/sdk/internalprogramsettings.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/scripts/fix-overlay.ts +449 -0
- package/src/funcs/internalProgramSettingsGet.ts +180 -0
- package/src/lib/config.ts +2 -2
- package/src/models/index.ts +4 -0
- package/src/models/lmsbusinesstype.ts +27 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/internalprogramsettingscontrollergetprogramsettings.ts +38 -0
- package/src/models/programonboardingsettingsdto.ts +81 -0
- package/src/models/programsettingsresponsedto.ts +74 -0
- package/src/models/programunderwritingsettingsdto.ts +236 -0
- package/src/models/underwritingsettingsdto.ts +71 -63
- package/src/sdk/internalprogramsettings.ts +29 -0
- package/src/sdk/sdk.ts +8 -0
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
#!/usr/bin/env -S npx tsx
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* fix-overlay.ts
|
|
5
|
+
*
|
|
6
|
+
* Analyzes the OpenAPI spec and generates missing method-name overlay entries
|
|
7
|
+
* for the Speakeasy SDK, mimicking the Web Studio's naming optimization.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* npx tsx scripts/fix-overlay.ts # dry-run (shows what would change)
|
|
11
|
+
* npx tsx scripts/fix-overlay.ts --apply # writes changes to overlay file
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { resolve } from "node:path";
|
|
16
|
+
import { parse as parseYaml } from "yaml";
|
|
17
|
+
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Paths
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
const ROOT = resolve(import.meta.dirname, "..");
|
|
22
|
+
const SPEC_PATH = resolve(ROOT, ".speakeasy/out.openapi.yaml");
|
|
23
|
+
const OVERLAY_PATH = resolve(ROOT, ".speakeasy/speakeasy-modifications-overlay.yaml");
|
|
24
|
+
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Types
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
interface SpecOperation {
|
|
29
|
+
path: string;
|
|
30
|
+
method: string;
|
|
31
|
+
operationId: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface NamingResult {
|
|
35
|
+
group: string | null;
|
|
36
|
+
methodName: string;
|
|
37
|
+
confidence: "high" | "low";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface OverlayEntry {
|
|
41
|
+
operation: SpecOperation;
|
|
42
|
+
naming: NamingResult;
|
|
43
|
+
yamlBlock: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
// 1. Parse the OpenAPI spec for all operations
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
function extractSpecOperations(specPath: string): SpecOperation[] {
|
|
50
|
+
console.log(`Reading spec from ${specPath}...`);
|
|
51
|
+
const content = readFileSync(specPath, "utf8");
|
|
52
|
+
const spec = parseYaml(content);
|
|
53
|
+
|
|
54
|
+
const operations: SpecOperation[] = [];
|
|
55
|
+
const httpMethods = new Set([
|
|
56
|
+
"get",
|
|
57
|
+
"post",
|
|
58
|
+
"put",
|
|
59
|
+
"patch",
|
|
60
|
+
"delete",
|
|
61
|
+
"head",
|
|
62
|
+
"options",
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
if (!spec.paths) {
|
|
66
|
+
throw new Error("No paths found in spec");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (const [path, pathObj] of Object.entries<any>(spec.paths)) {
|
|
70
|
+
for (const [method, opObj] of Object.entries<any>(pathObj)) {
|
|
71
|
+
if (httpMethods.has(method) && opObj?.operationId) {
|
|
72
|
+
operations.push({
|
|
73
|
+
path,
|
|
74
|
+
method,
|
|
75
|
+
operationId: opObj.operationId,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
console.log(` Found ${operations.length} operations in spec.`);
|
|
82
|
+
return operations;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// 2. Parse existing overlay to find covered operationIds
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
function extractCoveredOperationIds(overlayPath: string): Set<string> {
|
|
89
|
+
const content = readFileSync(overlayPath, "utf8");
|
|
90
|
+
const covered = new Set<string>();
|
|
91
|
+
|
|
92
|
+
// Extract operationId from "before:" metadata lines
|
|
93
|
+
// Format: before: sdk.Group.ControllerName_action()
|
|
94
|
+
const beforeRegex = /before:\s+sdk\.[^.]+\.(\w+Controller_\w+)\(\)/g;
|
|
95
|
+
let match: RegExpExecArray | null;
|
|
96
|
+
while ((match = beforeRegex.exec(content)) !== null) {
|
|
97
|
+
covered.add(match[1]);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
console.log(` Found ${covered.size} covered operations in overlay.`);
|
|
101
|
+
return covered;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
// 3. Parse current overlay version
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
function getOverlayVersion(overlayPath: string): string {
|
|
108
|
+
const content = readFileSync(overlayPath, "utf8");
|
|
109
|
+
const match = content.match(/version:\s+([\d.]+)/);
|
|
110
|
+
return match?.[1] ?? "0.0.0";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function bumpPatchVersion(version: string): string {
|
|
114
|
+
const parts = version.split(".");
|
|
115
|
+
parts[parts.length - 1] = String(Number(parts[parts.length - 1]) + 1);
|
|
116
|
+
return parts.join(".");
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
// 4. Naming rules
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
|
|
123
|
+
/** Split PascalCase into words: "BusinessFiles" -> ["Business", "Files"] */
|
|
124
|
+
function splitPascalCase(str: string): string[] {
|
|
125
|
+
return str.match(/[A-Z][a-z0-9]*/g) ?? [str];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** PascalCase to camelCase: "BusinessFiles" -> "businessFiles" */
|
|
129
|
+
function toCamelCase(str: string): string {
|
|
130
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Check if name has multiple PascalCase words */
|
|
134
|
+
function isMultiWord(name: string): boolean {
|
|
135
|
+
return splitPascalCase(name).length > 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** PascalCase to display form: "BusinessFiles" -> "Business Files" */
|
|
139
|
+
function toDisplayGroup(name: string): string {
|
|
140
|
+
return splitPascalCase(name).join(" ");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Simple English singularization */
|
|
144
|
+
function singularize(word: string): string {
|
|
145
|
+
if (word.endsWith("ies")) return word.slice(0, -3) + "y";
|
|
146
|
+
if (word.endsWith("ses") && !word.endsWith("sses"))
|
|
147
|
+
return word.slice(0, -2);
|
|
148
|
+
if (word.endsWith("s") && !word.endsWith("ss") && !word.endsWith("us"))
|
|
149
|
+
return word.slice(0, -1);
|
|
150
|
+
return word;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Derive a clean SDK method name from an operationId.
|
|
155
|
+
*
|
|
156
|
+
* Handles:
|
|
157
|
+
* - Standard CRUD: create, findAll, findOne, update, remove, delete, search
|
|
158
|
+
* - File operations: uploadFiles, downloadFile
|
|
159
|
+
* - CRUD with resource suffix: listBillingCycles -> list
|
|
160
|
+
* - Actions with resource suffix: submitApplication -> submit
|
|
161
|
+
* - Compound resource stripping: getAllBusinessBalances -> listBalances
|
|
162
|
+
* - Fallback: keeps action as-is with low confidence
|
|
163
|
+
*/
|
|
164
|
+
function deriveNames(operationId: string): NamingResult {
|
|
165
|
+
const underscoreIdx = operationId.indexOf("_");
|
|
166
|
+
if (underscoreIdx === -1) {
|
|
167
|
+
return {
|
|
168
|
+
group: null,
|
|
169
|
+
methodName: toCamelCase(operationId),
|
|
170
|
+
confidence: "low",
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const controllerPart = operationId.slice(0, underscoreIdx);
|
|
175
|
+
const action = operationId.slice(underscoreIdx + 1);
|
|
176
|
+
const resourceName = controllerPart.replace(/Controller$/, "");
|
|
177
|
+
|
|
178
|
+
// Group: multi-word controllers need explicit override
|
|
179
|
+
const group = isMultiWord(resourceName) ? toCamelCase(resourceName) : null;
|
|
180
|
+
|
|
181
|
+
// --- Exact CRUD mappings (highest confidence) ---
|
|
182
|
+
const exactMap: Record<string, string> = {
|
|
183
|
+
create: "create",
|
|
184
|
+
findAll: "list",
|
|
185
|
+
findOne: "get",
|
|
186
|
+
findById: "get",
|
|
187
|
+
update: "update",
|
|
188
|
+
remove: "delete",
|
|
189
|
+
delete: "delete",
|
|
190
|
+
search: "search",
|
|
191
|
+
uploadFiles: "upload",
|
|
192
|
+
downloadFile: "download",
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
if (exactMap[action]) {
|
|
196
|
+
return { group, methodName: exactMap[action], confidence: "high" };
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// --- CRUD + resource name stripping ---
|
|
200
|
+
const singularRes = singularize(resourceName);
|
|
201
|
+
const pluralRes = resourceName;
|
|
202
|
+
|
|
203
|
+
// Ordered by specificity: "getAll" before "get", "findBy" before "find"
|
|
204
|
+
const crudPrefixes: { prefix: string; verb: string }[] = [
|
|
205
|
+
{ prefix: "getAll", verb: "list" },
|
|
206
|
+
{ prefix: "findAll", verb: "list" },
|
|
207
|
+
{ prefix: "findBy", verb: "listBy" },
|
|
208
|
+
{ prefix: "list", verb: "list" },
|
|
209
|
+
{ prefix: "get", verb: "get" },
|
|
210
|
+
{ prefix: "create", verb: "create" },
|
|
211
|
+
{ prefix: "update", verb: "update" },
|
|
212
|
+
{ prefix: "delete", verb: "delete" },
|
|
213
|
+
{ prefix: "remove", verb: "remove" },
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
for (const { prefix, verb } of crudPrefixes) {
|
|
217
|
+
if (!action.startsWith(prefix) || action.length <= prefix.length) continue;
|
|
218
|
+
const suffix = action.slice(prefix.length);
|
|
219
|
+
|
|
220
|
+
// Full resource match: listBillingCycles -> list
|
|
221
|
+
if (suffix === singularRes || suffix === pluralRes) {
|
|
222
|
+
return { group, methodName: verb, confidence: "high" };
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Partial resource prefix match: getAllBusinessBalances -> listBalances
|
|
226
|
+
// (when controller is BusinessesController, singularRes = "Businesse" or "Business")
|
|
227
|
+
if (suffix.startsWith(singularRes) && suffix.length > singularRes.length) {
|
|
228
|
+
const remainder = suffix.slice(singularRes.length);
|
|
229
|
+
return {
|
|
230
|
+
group,
|
|
231
|
+
methodName: verb + remainder,
|
|
232
|
+
confidence: "high",
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Check using individual PascalCase words from resource name
|
|
237
|
+
const resourceWords = splitPascalCase(resourceName);
|
|
238
|
+
const suffixWords = splitPascalCase(suffix);
|
|
239
|
+
|
|
240
|
+
// Strip leading words that match resource words
|
|
241
|
+
let stripped = [...suffixWords];
|
|
242
|
+
for (const rw of resourceWords) {
|
|
243
|
+
if (
|
|
244
|
+
stripped.length > 0 &&
|
|
245
|
+
(stripped[0] === rw || stripped[0] === singularize(rw))
|
|
246
|
+
) {
|
|
247
|
+
stripped.shift();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
if (stripped.length > 0 && stripped.length < suffixWords.length) {
|
|
252
|
+
return {
|
|
253
|
+
group,
|
|
254
|
+
methodName: verb + stripped.join(""),
|
|
255
|
+
confidence: "high",
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Suffix resource match (e.g., regenerateApiKey on PlatformApiKeysController)
|
|
260
|
+
if (singularRes.endsWith(suffix) || singularRes.endsWith(singularize(suffix))) {
|
|
261
|
+
return { group, methodName: verb, confidence: "high" };
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// --- Action + resource suffix stripping ---
|
|
266
|
+
// e.g., submitApplication -> submit, acceptOrigination -> accept
|
|
267
|
+
const actionVerbs = [
|
|
268
|
+
"submit",
|
|
269
|
+
"approve",
|
|
270
|
+
"reject",
|
|
271
|
+
"accept",
|
|
272
|
+
"cancel",
|
|
273
|
+
"start",
|
|
274
|
+
"stop",
|
|
275
|
+
"regenerate",
|
|
276
|
+
"rotate",
|
|
277
|
+
"activate",
|
|
278
|
+
"deactivate",
|
|
279
|
+
"release",
|
|
280
|
+
"simulate",
|
|
281
|
+
"upsert",
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
for (const verb of actionVerbs) {
|
|
285
|
+
if (!action.startsWith(verb) || action === verb) continue;
|
|
286
|
+
const suffix = action.slice(verb.length);
|
|
287
|
+
|
|
288
|
+
if (suffix === singularRes || suffix === pluralRes) {
|
|
289
|
+
return { group, methodName: verb, confidence: "high" };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Partial: suffix is tail of resource name (e.g., ApiKey on PlatformApiKeys)
|
|
293
|
+
if (singularRes.endsWith(suffix) || singularRes.endsWith(singularize(suffix))) {
|
|
294
|
+
return { group, methodName: verb, confidence: "high" };
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// --- Fallback: use action as-is ---
|
|
299
|
+
return { group, methodName: toCamelCase(action), confidence: "low" };
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
// 5. Generate overlay YAML block
|
|
304
|
+
// ---------------------------------------------------------------------------
|
|
305
|
+
function generateOverlayEntry(op: SpecOperation, naming: NamingResult): string {
|
|
306
|
+
const now = Date.now();
|
|
307
|
+
const controllerPart = op.operationId.slice(0, op.operationId.indexOf("_"));
|
|
308
|
+
const resourceName = controllerPart.replace(/Controller$/, "");
|
|
309
|
+
|
|
310
|
+
// Determine the "after" group name
|
|
311
|
+
const afterGroup = naming.group ?? toCamelCase(resourceName);
|
|
312
|
+
const afterStr = `sdk.${afterGroup}.${naming.methodName}()`;
|
|
313
|
+
|
|
314
|
+
// Determine the "before" group name (Speakeasy default: PascalCase with spaces)
|
|
315
|
+
const beforeGroup = toDisplayGroup(resourceName);
|
|
316
|
+
const beforeStr = `sdk.${beforeGroup}.${op.operationId}()`;
|
|
317
|
+
|
|
318
|
+
let yaml = ` - target: $["paths"]["${op.path}"]["${op.method}"]\n`;
|
|
319
|
+
yaml += ` update:\n`;
|
|
320
|
+
if (naming.group) {
|
|
321
|
+
yaml += ` x-speakeasy-group: ${naming.group}\n`;
|
|
322
|
+
}
|
|
323
|
+
yaml += ` x-speakeasy-name-override: ${naming.methodName}\n`;
|
|
324
|
+
yaml += ` x-speakeasy-metadata:\n`;
|
|
325
|
+
yaml += ` after: ${afterStr}\n`;
|
|
326
|
+
yaml += ` before: ${beforeStr}\n`;
|
|
327
|
+
yaml += ` created_at: ${now}\n`;
|
|
328
|
+
yaml += ` reviewed_at: ${now}\n`;
|
|
329
|
+
yaml += ` type: method-name`;
|
|
330
|
+
|
|
331
|
+
return yaml;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// ---------------------------------------------------------------------------
|
|
335
|
+
// 6. Main
|
|
336
|
+
// ---------------------------------------------------------------------------
|
|
337
|
+
function main(): void {
|
|
338
|
+
const applyMode = process.argv.includes("--apply");
|
|
339
|
+
|
|
340
|
+
console.log("=== Speakeasy Overlay Fix ===\n");
|
|
341
|
+
|
|
342
|
+
// Extract operations from spec
|
|
343
|
+
const specOps = extractSpecOperations(SPEC_PATH);
|
|
344
|
+
|
|
345
|
+
// Extract covered operation IDs from overlay
|
|
346
|
+
const coveredIds = extractCoveredOperationIds(OVERLAY_PATH);
|
|
347
|
+
|
|
348
|
+
// Find uncovered operations
|
|
349
|
+
const uncoveredOps = specOps.filter(
|
|
350
|
+
(op) => !coveredIds.has(op.operationId)
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
if (uncoveredOps.length === 0) {
|
|
354
|
+
console.log("\nAll operations are already covered by the overlay. Nothing to do.");
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
console.log(`\nFound ${uncoveredOps.length} uncovered operation(s):\n`);
|
|
359
|
+
|
|
360
|
+
// Generate overlay entries
|
|
361
|
+
const entries: OverlayEntry[] = uncoveredOps.map((op) => {
|
|
362
|
+
const naming = deriveNames(op.operationId);
|
|
363
|
+
const yamlBlock = generateOverlayEntry(op, naming);
|
|
364
|
+
return { operation: op, naming, yamlBlock };
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// Display results grouped by confidence
|
|
368
|
+
const highConfidence = entries.filter((e) => e.naming.confidence === "high");
|
|
369
|
+
const lowConfidence = entries.filter((e) => e.naming.confidence === "low");
|
|
370
|
+
|
|
371
|
+
if (highConfidence.length > 0) {
|
|
372
|
+
console.log(`--- High confidence (${highConfidence.length}) ---`);
|
|
373
|
+
for (const entry of highConfidence) {
|
|
374
|
+
const groupStr = entry.naming.group
|
|
375
|
+
? `[group: ${entry.naming.group}] `
|
|
376
|
+
: "";
|
|
377
|
+
console.log(
|
|
378
|
+
` ${entry.operation.operationId} -> ${groupStr}${entry.naming.methodName}`
|
|
379
|
+
);
|
|
380
|
+
}
|
|
381
|
+
console.log();
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if (lowConfidence.length > 0) {
|
|
385
|
+
console.log(`--- Needs review (${lowConfidence.length}) ---`);
|
|
386
|
+
for (const entry of lowConfidence) {
|
|
387
|
+
const groupStr = entry.naming.group
|
|
388
|
+
? `[group: ${entry.naming.group}] `
|
|
389
|
+
: "";
|
|
390
|
+
console.log(
|
|
391
|
+
` ${entry.operation.operationId} -> ${groupStr}${entry.naming.methodName} <-- review this`
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
console.log();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
if (!applyMode) {
|
|
398
|
+
console.log(
|
|
399
|
+
"Dry run complete. Run with --apply to write changes to the overlay file."
|
|
400
|
+
);
|
|
401
|
+
console.log(` npx tsx scripts/fix-overlay.ts --apply\n`);
|
|
402
|
+
|
|
403
|
+
// Still show what would be written
|
|
404
|
+
console.log("--- Preview of new overlay entries ---\n");
|
|
405
|
+
for (const entry of entries) {
|
|
406
|
+
console.log(entry.yamlBlock);
|
|
407
|
+
console.log();
|
|
408
|
+
}
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// Apply changes
|
|
413
|
+
let overlayContent = readFileSync(OVERLAY_PATH, "utf8");
|
|
414
|
+
|
|
415
|
+
// Bump version
|
|
416
|
+
const currentVersion = getOverlayVersion(OVERLAY_PATH);
|
|
417
|
+
const newVersion = bumpPatchVersion(currentVersion);
|
|
418
|
+
overlayContent = overlayContent.replace(
|
|
419
|
+
`version: ${currentVersion}`,
|
|
420
|
+
`version: ${newVersion}`
|
|
421
|
+
);
|
|
422
|
+
|
|
423
|
+
// Append new entries (ensure trailing newline before appending)
|
|
424
|
+
if (!overlayContent.endsWith("\n")) {
|
|
425
|
+
overlayContent += "\n";
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
for (const entry of entries) {
|
|
429
|
+
overlayContent += entry.yamlBlock + "\n";
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
writeFileSync(OVERLAY_PATH, overlayContent, "utf8");
|
|
433
|
+
|
|
434
|
+
console.log(`Overlay updated: version ${currentVersion} -> ${newVersion}`);
|
|
435
|
+
console.log(`Added ${entries.length} new method-name entries.`);
|
|
436
|
+
|
|
437
|
+
if (lowConfidence.length > 0) {
|
|
438
|
+
console.log(
|
|
439
|
+
`\nWARNING: ${lowConfidence.length} entries need manual review (marked above).`
|
|
440
|
+
);
|
|
441
|
+
console.log(
|
|
442
|
+
"Edit .speakeasy/speakeasy-modifications-overlay.yaml to adjust before committing."
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
console.log("\nDone! Review changes with: git diff .speakeasy/speakeasy-modifications-overlay.yaml");
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
main();
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { OatFiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import { OatFiSDKError } from "../models/errors/oatfisdkerror.js";
|
|
21
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as models from "../models/index.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get program settings
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Returns the program settings for a loan program, including onboarding configuration and whether UW terms agreement is configured.
|
|
33
|
+
*/
|
|
34
|
+
export function internalProgramSettingsGet(
|
|
35
|
+
client: OatFiSDKCore,
|
|
36
|
+
request:
|
|
37
|
+
operations.InternalProgramSettingsControllerGetProgramSettingsRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
models.ProgramSettingsResponseDto,
|
|
42
|
+
| OatFiSDKError
|
|
43
|
+
| ResponseValidationError
|
|
44
|
+
| ConnectionError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| InvalidRequestError
|
|
48
|
+
| UnexpectedClientError
|
|
49
|
+
| SDKValidationError
|
|
50
|
+
>
|
|
51
|
+
> {
|
|
52
|
+
return new APIPromise($do(
|
|
53
|
+
client,
|
|
54
|
+
request,
|
|
55
|
+
options,
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function $do(
|
|
60
|
+
client: OatFiSDKCore,
|
|
61
|
+
request:
|
|
62
|
+
operations.InternalProgramSettingsControllerGetProgramSettingsRequest,
|
|
63
|
+
options?: RequestOptions,
|
|
64
|
+
): Promise<
|
|
65
|
+
[
|
|
66
|
+
Result<
|
|
67
|
+
models.ProgramSettingsResponseDto,
|
|
68
|
+
| OatFiSDKError
|
|
69
|
+
| ResponseValidationError
|
|
70
|
+
| ConnectionError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| InvalidRequestError
|
|
74
|
+
| UnexpectedClientError
|
|
75
|
+
| SDKValidationError
|
|
76
|
+
>,
|
|
77
|
+
APICall,
|
|
78
|
+
]
|
|
79
|
+
> {
|
|
80
|
+
const parsed = safeParse(
|
|
81
|
+
request,
|
|
82
|
+
(value) =>
|
|
83
|
+
operations
|
|
84
|
+
.InternalProgramSettingsControllerGetProgramSettingsRequest$outboundSchema
|
|
85
|
+
.parse(value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = null;
|
|
93
|
+
|
|
94
|
+
const path = pathToFunc("/v3/internal-program-settings")();
|
|
95
|
+
|
|
96
|
+
const query = encodeFormQuery({
|
|
97
|
+
"id": payload.id,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const headers = new Headers(compactMap({
|
|
101
|
+
Accept: "application/json",
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
const secConfig = await extractSecurity(client._options.bearer);
|
|
105
|
+
const securityInput = secConfig == null ? {} : { bearer: secConfig };
|
|
106
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
107
|
+
|
|
108
|
+
const context = {
|
|
109
|
+
options: client._options,
|
|
110
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
111
|
+
operationID: "InternalProgramSettingsController_getProgramSettings",
|
|
112
|
+
oAuth2Scopes: null,
|
|
113
|
+
|
|
114
|
+
resolvedSecurity: requestSecurity,
|
|
115
|
+
|
|
116
|
+
securitySource: client._options.bearer,
|
|
117
|
+
retryConfig: options?.retries
|
|
118
|
+
|| client._options.retryConfig
|
|
119
|
+
|| {
|
|
120
|
+
strategy: "backoff",
|
|
121
|
+
backoff: {
|
|
122
|
+
initialInterval: 500,
|
|
123
|
+
maxInterval: 60000,
|
|
124
|
+
exponent: 1.5,
|
|
125
|
+
maxElapsedTime: 120000,
|
|
126
|
+
},
|
|
127
|
+
retryConnectionErrors: true,
|
|
128
|
+
}
|
|
129
|
+
|| { strategy: "none" },
|
|
130
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const requestRes = client._createRequest(context, {
|
|
134
|
+
security: requestSecurity,
|
|
135
|
+
method: "GET",
|
|
136
|
+
baseURL: options?.serverURL,
|
|
137
|
+
path: path,
|
|
138
|
+
headers: headers,
|
|
139
|
+
query: query,
|
|
140
|
+
body: body,
|
|
141
|
+
userAgent: client._options.userAgent,
|
|
142
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
143
|
+
}, options);
|
|
144
|
+
if (!requestRes.ok) {
|
|
145
|
+
return [requestRes, { status: "invalid" }];
|
|
146
|
+
}
|
|
147
|
+
const req = requestRes.value;
|
|
148
|
+
|
|
149
|
+
const doResult = await client._do(req, {
|
|
150
|
+
context,
|
|
151
|
+
errorCodes: ["400", "403", "404", "429", "4XX", "5XX"],
|
|
152
|
+
retryConfig: context.retryConfig,
|
|
153
|
+
retryCodes: context.retryCodes,
|
|
154
|
+
});
|
|
155
|
+
if (!doResult.ok) {
|
|
156
|
+
return [doResult, { status: "request-error", request: req }];
|
|
157
|
+
}
|
|
158
|
+
const response = doResult.value;
|
|
159
|
+
|
|
160
|
+
const [result] = await M.match<
|
|
161
|
+
models.ProgramSettingsResponseDto,
|
|
162
|
+
| OatFiSDKError
|
|
163
|
+
| ResponseValidationError
|
|
164
|
+
| ConnectionError
|
|
165
|
+
| RequestAbortedError
|
|
166
|
+
| RequestTimeoutError
|
|
167
|
+
| InvalidRequestError
|
|
168
|
+
| UnexpectedClientError
|
|
169
|
+
| SDKValidationError
|
|
170
|
+
>(
|
|
171
|
+
M.json(200, models.ProgramSettingsResponseDto$inboundSchema),
|
|
172
|
+
M.fail([400, 403, 404, 429, "4XX"]),
|
|
173
|
+
M.fail("5XX"),
|
|
174
|
+
)(response, req);
|
|
175
|
+
if (!result.ok) {
|
|
176
|
+
return [result, { status: "complete", request: req, response }];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return [result, { status: "complete", request: req, response }];
|
|
180
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -69,8 +69,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
69
69
|
export const SDK_METADATA = {
|
|
70
70
|
language: "typescript",
|
|
71
71
|
openapiDocVersion: "3.0.0",
|
|
72
|
-
sdkVersion: "0.11.
|
|
72
|
+
sdkVersion: "0.11.67",
|
|
73
73
|
genVersion: "2.879.6",
|
|
74
74
|
userAgent:
|
|
75
|
-
"speakeasy-sdk/typescript 0.11.
|
|
75
|
+
"speakeasy-sdk/typescript 0.11.67 2.879.6 3.0.0 @oatfi/oatfi-sdk-ts",
|
|
76
76
|
} as const;
|
package/src/models/index.ts
CHANGED
|
@@ -102,6 +102,7 @@ export * from "./listprogramsettingsresponsedto.js";
|
|
|
102
102
|
export * from "./listprogramsresponsedto.js";
|
|
103
103
|
export * from "./listusersresponsedto.js";
|
|
104
104
|
export * from "./listusersupsertresponsedto.js";
|
|
105
|
+
export * from "./lmsbusinesstype.js";
|
|
105
106
|
export * from "./lmsinstallmenttype.js";
|
|
106
107
|
export * from "./lmsloanprogramconfigrisktier.js";
|
|
107
108
|
export * from "./lmspaymentrequeststatus.js";
|
|
@@ -143,8 +144,11 @@ export * from "./pooledardto.js";
|
|
|
143
144
|
export * from "./pooledarresponsedto.js";
|
|
144
145
|
export * from "./productbalancesummarydto.js";
|
|
145
146
|
export * from "./producttype.js";
|
|
147
|
+
export * from "./programonboardingsettingsdto.js";
|
|
146
148
|
export * from "./programresponsedto.js";
|
|
147
149
|
export * from "./programsettingdto.js";
|
|
150
|
+
export * from "./programsettingsresponsedto.js";
|
|
151
|
+
export * from "./programunderwritingsettingsdto.js";
|
|
148
152
|
export * from "./refreshtokendto.js";
|
|
149
153
|
export * from "./regenerateapikeydto.js";
|
|
150
154
|
export * from "./repaymentallocation.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Loan ownership type
|
|
10
|
+
*/
|
|
11
|
+
export const LmsBusinessType = {
|
|
12
|
+
Payee: "PAYEE",
|
|
13
|
+
Payor: "PAYOR",
|
|
14
|
+
} as const;
|
|
15
|
+
/**
|
|
16
|
+
* Loan ownership type
|
|
17
|
+
*/
|
|
18
|
+
export type LmsBusinessType = ClosedEnum<typeof LmsBusinessType>;
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const LmsBusinessType$inboundSchema: z.ZodNativeEnum<
|
|
22
|
+
typeof LmsBusinessType
|
|
23
|
+
> = z.nativeEnum(LmsBusinessType);
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const LmsBusinessType$outboundSchema: z.ZodNativeEnum<
|
|
26
|
+
typeof LmsBusinessType
|
|
27
|
+
> = LmsBusinessType$inboundSchema;
|
|
@@ -82,6 +82,7 @@ export * from "./holdscontrollerfindone.js";
|
|
|
82
82
|
export * from "./holdscontrollerrelease.js";
|
|
83
83
|
export * from "./holdscontrollerupdate.js";
|
|
84
84
|
export * from "./increasetransactionscontrollerlistincreasetransactions.js";
|
|
85
|
+
export * from "./internalprogramsettingscontrollergetprogramsettings.js";
|
|
85
86
|
export * from "./onboardingtermscontrollerfindall.js";
|
|
86
87
|
export * from "./originationscontrolleracceptorigination.js";
|
|
87
88
|
export * from "./originationscontrollercancelorigination.js";
|