@financeable/aggregation 0.2.0 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/FUNCTIONS.md +1 -7
  2. package/README.md +938 -31
  3. package/docs/sdks/applications/README.md +2 -14
  4. package/jsr.json +1 -1
  5. package/lib/config.d.ts +3 -3
  6. package/lib/config.js +3 -3
  7. package/models/components/applicationresourcebulksubmission.d.ts +0 -6
  8. package/models/components/applicationresourcebulksubmission.d.ts.map +1 -1
  9. package/models/components/applicationresourcebulksubmission.js +0 -6
  10. package/models/components/applicationresourcebulksubmission.js.map +1 -1
  11. package/models/components/customerattributes.d.ts +5 -36
  12. package/models/components/customerattributes.d.ts.map +1 -1
  13. package/models/components/customerattributes.js +6 -41
  14. package/models/components/customerattributes.js.map +1 -1
  15. package/models/components/customeridtype.d.ts +28 -0
  16. package/models/components/customeridtype.d.ts.map +1 -0
  17. package/models/components/customeridtype.js +60 -0
  18. package/models/components/customeridtype.js.map +1 -0
  19. package/models/components/index.d.ts +1 -0
  20. package/models/components/index.d.ts.map +1 -1
  21. package/models/components/index.js +1 -0
  22. package/models/components/index.js.map +1 -1
  23. package/package.json +1 -1
  24. package/src/lib/config.ts +3 -3
  25. package/src/models/components/applicationresourcebulksubmission.ts +0 -12
  26. package/src/models/components/customerattributes.ts +13 -53
  27. package/src/models/components/customeridtype.ts +33 -0
  28. package/src/models/components/index.ts +1 -0
  29. package/financeable-typescript/.devcontainer/README.md +0 -30
  30. package/financeable-typescript/FUNCTIONS.md +0 -205
  31. package/financeable-typescript/README.md +0 -895
  32. package/financeable-typescript/RUNTIMES.md +0 -22
  33. package/financeable-typescript/docs/sdks/applications/README.md +0 -427
  34. package/financeable-typescript/docs/sdks/financeable/README.md +0 -5
  35. package/financeable-typescript/src/core.ts +0 -13
  36. package/financeable-typescript/src/funcs/applicationsCreate.ts +0 -124
  37. package/financeable-typescript/src/funcs/applicationsGet.ts +0 -128
  38. package/financeable-typescript/src/funcs/applicationsList.ts +0 -126
  39. package/financeable-typescript/src/hooks/hooks.ts +0 -129
  40. package/financeable-typescript/src/hooks/index.ts +0 -6
  41. package/financeable-typescript/src/hooks/types.ts +0 -109
  42. package/financeable-typescript/src/index.ts +0 -7
  43. package/financeable-typescript/src/lib/base64.ts +0 -37
  44. package/financeable-typescript/src/lib/config.ts +0 -59
  45. package/financeable-typescript/src/lib/dlv.ts +0 -53
  46. package/financeable-typescript/src/lib/encodings.ts +0 -449
  47. package/financeable-typescript/src/lib/env.ts +0 -37
  48. package/financeable-typescript/src/lib/files.ts +0 -40
  49. package/financeable-typescript/src/lib/http.ts +0 -323
  50. package/financeable-typescript/src/lib/is-plain-object.ts +0 -43
  51. package/financeable-typescript/src/lib/logger.ts +0 -9
  52. package/financeable-typescript/src/lib/matchers.ts +0 -322
  53. package/financeable-typescript/src/lib/primitives.ts +0 -122
  54. package/financeable-typescript/src/lib/retries.ts +0 -219
  55. package/financeable-typescript/src/lib/schemas.ts +0 -86
  56. package/financeable-typescript/src/lib/sdks.ts +0 -392
  57. package/financeable-typescript/src/lib/security.ts +0 -227
  58. package/financeable-typescript/src/lib/url.ts +0 -33
  59. package/financeable-typescript/src/models/components/addressattributes.ts +0 -148
  60. package/financeable-typescript/src/models/components/apierrorlinks.ts +0 -65
  61. package/financeable-typescript/src/models/components/applicationattributes.ts +0 -128
  62. package/financeable-typescript/src/models/components/applicationattributescreate.ts +0 -90
  63. package/financeable-typescript/src/models/components/applicationresourcebulksubmission.ts +0 -1000
  64. package/financeable-typescript/src/models/components/applicationstatus.ts +0 -39
  65. package/financeable-typescript/src/models/components/applicationtype.ts +0 -33
  66. package/financeable-typescript/src/models/components/assetattributes.ts +0 -400
  67. package/financeable-typescript/src/models/components/customerattributes.ts +0 -171
  68. package/financeable-typescript/src/models/components/customertitle.ts +0 -35
  69. package/financeable-typescript/src/models/components/errorsource.ts +0 -79
  70. package/financeable-typescript/src/models/components/forbiddenerror.ts +0 -207
  71. package/financeable-typescript/src/models/components/frequencytype.ts +0 -40
  72. package/financeable-typescript/src/models/components/index.ts +0 -20
  73. package/financeable-typescript/src/models/components/links.ts +0 -72
  74. package/financeable-typescript/src/models/components/loandetailsattributes.ts +0 -187
  75. package/financeable-typescript/src/models/components/repaymentstructure.ts +0 -40
  76. package/financeable-typescript/src/models/errors/apierror.ts +0 -27
  77. package/financeable-typescript/src/models/errors/createapplication.ts +0 -76
  78. package/financeable-typescript/src/models/errors/getapplication.ts +0 -76
  79. package/financeable-typescript/src/models/errors/getapplications.ts +0 -76
  80. package/financeable-typescript/src/models/errors/httpclienterrors.ts +0 -62
  81. package/financeable-typescript/src/models/errors/index.ts +0 -10
  82. package/financeable-typescript/src/models/errors/sdkvalidationerror.ts +0 -97
  83. package/financeable-typescript/src/models/operations/createapplication.ts +0 -1649
  84. package/financeable-typescript/src/models/operations/getapplication.ts +0 -1829
  85. package/financeable-typescript/src/models/operations/getapplications.ts +0 -1790
  86. package/financeable-typescript/src/models/operations/index.ts +0 -7
  87. package/financeable-typescript/src/sdk/applications.ts +0 -55
  88. package/financeable-typescript/src/sdk/index.ts +0 -5
  89. package/financeable-typescript/src/sdk/sdk.ts +0 -13
  90. package/financeable-typescript/src/types/blobs.ts +0 -31
  91. package/financeable-typescript/src/types/constdatetime.ts +0 -15
  92. package/financeable-typescript/src/types/enums.ts +0 -16
  93. package/financeable-typescript/src/types/fp.ts +0 -50
  94. package/financeable-typescript/src/types/index.ts +0 -11
  95. package/financeable-typescript/src/types/operations.ts +0 -105
  96. package/financeable-typescript/src/types/rfcdate.ts +0 -54
  97. package/financeable-typescript/src/types/streams.ts +0 -21
@@ -1,449 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { bytesToBase64 } from "./base64.js";
6
- import { isPlainObject } from "./is-plain-object.js";
7
-
8
- export class EncodingError extends Error {
9
- constructor(message: string) {
10
- super(message);
11
- this.name = "EncodingError";
12
- }
13
- }
14
-
15
- export function encodeMatrix(
16
- key: string,
17
- value: unknown,
18
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
19
- ): string {
20
- let out = "";
21
- const pairs: [string, unknown][] = options?.explode
22
- ? explode(key, value)
23
- : [[key, value]];
24
-
25
- const encodeString = (v: string) => {
26
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
27
- };
28
- const encodeValue = (v: unknown) => encodeString(serializeValue(v));
29
-
30
- pairs.forEach(([pk, pv]) => {
31
- let tmp = "";
32
- let encValue = "";
33
-
34
- if (pv === undefined) {
35
- return;
36
- } else if (Array.isArray(pv)) {
37
- encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(",");
38
- } else if (isPlainObject(pv)) {
39
- encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
40
- return `,${encodeString(k)},${encodeValue(v)}`;
41
- }).join("");
42
- encValue = encValue.slice(1);
43
- } else {
44
- encValue = `${encodeValue(pv)}`;
45
- }
46
-
47
- const keyPrefix = encodeString(pk);
48
- tmp = `${keyPrefix}=${encValue}`;
49
- // trim trailing '=' if value was empty
50
- if (tmp === `${keyPrefix}=`) {
51
- tmp = tmp.slice(0, -1);
52
- }
53
-
54
- // If we end up with the nothing then skip forward
55
- if (!tmp) {
56
- return;
57
- }
58
-
59
- out += `;${tmp}`;
60
- });
61
-
62
- return out;
63
- }
64
-
65
- export function encodeLabel(
66
- key: string,
67
- value: unknown,
68
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
69
- ): string {
70
- let out = "";
71
- const pairs: [string, unknown][] = options?.explode
72
- ? explode(key, value)
73
- : [[key, value]];
74
-
75
- const encodeString = (v: string) => {
76
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
77
- };
78
- const encodeValue = (v: unknown) => encodeString(serializeValue(v));
79
-
80
- pairs.forEach(([pk, pv]) => {
81
- let encValue = "";
82
-
83
- if (pv === undefined) {
84
- return;
85
- } else if (Array.isArray(pv)) {
86
- encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(".");
87
- } else if (isPlainObject(pv)) {
88
- encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
89
- return `.${encodeString(k)}.${encodeValue(v)}`;
90
- }).join("");
91
- encValue = encValue.slice(1);
92
- } else {
93
- const k =
94
- options?.explode && isPlainObject(value) ? `${encodeString(pk)}=` : "";
95
- encValue = `${k}${encodeValue(pv)}`;
96
- }
97
-
98
- out += `.${encValue}`;
99
- });
100
-
101
- return out;
102
- }
103
-
104
- type FormEncoder = (
105
- key: string,
106
- value: unknown,
107
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
108
- ) => string;
109
-
110
- function formEncoder(sep: string): FormEncoder {
111
- return (
112
- key: string,
113
- value: unknown,
114
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
115
- ) => {
116
- let out = "";
117
- const pairs: [string, unknown][] = options?.explode
118
- ? explode(key, value)
119
- : [[key, value]];
120
-
121
- const encodeString = (v: string) => {
122
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
123
- };
124
-
125
- const encodeValue = (v: unknown) => encodeString(serializeValue(v));
126
-
127
- const encodedSep = encodeString(sep);
128
-
129
- pairs.forEach(([pk, pv]) => {
130
- let tmp = "";
131
- let encValue = "";
132
-
133
- if (pv === undefined) {
134
- return;
135
- } else if (Array.isArray(pv)) {
136
- encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(encodedSep);
137
- } else if (isPlainObject(pv)) {
138
- encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
139
- return `${encodeString(k)}${encodedSep}${encodeValue(v)}`;
140
- }).join(encodedSep);
141
- } else {
142
- encValue = `${encodeValue(pv)}`;
143
- }
144
-
145
- tmp = `${encodeString(pk)}=${encValue}`;
146
-
147
- // If we end up with the nothing then skip forward
148
- if (!tmp || tmp === "=") {
149
- return;
150
- }
151
-
152
- out += `&${tmp}`;
153
- });
154
-
155
- return out.slice(1);
156
- };
157
- }
158
-
159
- export const encodeForm = formEncoder(",");
160
- export const encodeSpaceDelimited = formEncoder(" ");
161
- export const encodePipeDelimited = formEncoder("|");
162
-
163
- export function encodeBodyForm(
164
- key: string,
165
- value: unknown,
166
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
167
- ): string {
168
- let out = "";
169
- const pairs: [string, unknown][] = options?.explode
170
- ? explode(key, value)
171
- : [[key, value]];
172
-
173
- const encodeString = (v: string) => {
174
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
175
- };
176
-
177
- const encodeValue = (v: unknown) => encodeString(serializeValue(v));
178
-
179
- pairs.forEach(([pk, pv]) => {
180
- let tmp = "";
181
- let encValue = "";
182
-
183
- if (pv === undefined) {
184
- return;
185
- } else if (Array.isArray(pv)) {
186
- encValue = JSON.stringify(pv, jsonReplacer);
187
- } else if (isPlainObject(pv)) {
188
- encValue = JSON.stringify(pv, jsonReplacer);
189
- } else {
190
- encValue = `${encodeValue(pv)}`;
191
- }
192
-
193
- tmp = `${encodeString(pk)}=${encValue}`;
194
-
195
- // If we end up with the nothing then skip forward
196
- if (!tmp || tmp === "=") {
197
- return;
198
- }
199
-
200
- out += `&${tmp}`;
201
- });
202
-
203
- return out.slice(1);
204
- }
205
-
206
- export function encodeDeepObject(
207
- key: string,
208
- value: unknown,
209
- options?: { charEncoding?: "percent" | "none" },
210
- ): string {
211
- if (value == null) {
212
- return "";
213
- }
214
-
215
- if (!isPlainObject(value)) {
216
- throw new EncodingError(
217
- `Value of parameter '${key}' which uses deepObject encoding must be an object`,
218
- );
219
- }
220
-
221
- return encodeDeepObjectObject(key, value, options);
222
- }
223
-
224
- export function encodeDeepObjectObject(
225
- key: string,
226
- value: unknown,
227
- options?: { charEncoding?: "percent" | "none" },
228
- ): string {
229
- if (value == null) {
230
- return "";
231
- }
232
-
233
- let out = "";
234
-
235
- const encodeString = (v: string) => {
236
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
237
- };
238
-
239
- if (!isPlainObject(value)) {
240
- throw new EncodingError(`Expected parameter '${key}' to be an object.`);
241
- }
242
-
243
- Object.entries(value).forEach(([ck, cv]) => {
244
- if (cv === undefined) {
245
- return;
246
- }
247
-
248
- const pk = `${key}[${ck}]`;
249
-
250
- if (isPlainObject(cv)) {
251
- const objOut = encodeDeepObjectObject(pk, cv, options);
252
-
253
- out += `&${objOut}`;
254
-
255
- return;
256
- }
257
-
258
- const pairs: unknown[] = Array.isArray(cv) ? cv : [cv];
259
- let encoded = "";
260
-
261
- encoded = mapDefined(pairs, (v) => {
262
- return `${encodeString(pk)}=${encodeString(serializeValue(v))}`;
263
- }).join("&");
264
-
265
- out += `&${encoded}`;
266
- });
267
-
268
- return out.slice(1);
269
- }
270
-
271
- export function encodeJSON(
272
- key: string,
273
- value: unknown,
274
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
275
- ): string {
276
- if (typeof value === "undefined") {
277
- return "";
278
- }
279
-
280
- const encodeString = (v: string) => {
281
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
282
- };
283
-
284
- const encVal = encodeString(JSON.stringify(value, jsonReplacer));
285
-
286
- return options?.explode ? encVal : `${encodeString(key)}=${encVal}`;
287
- }
288
-
289
- export const encodeSimple = (
290
- key: string,
291
- value: unknown,
292
- options?: { explode?: boolean; charEncoding?: "percent" | "none" },
293
- ): string => {
294
- let out = "";
295
- const pairs: [string, unknown][] = options?.explode
296
- ? explode(key, value)
297
- : [[key, value]];
298
-
299
- const encodeString = (v: string) => {
300
- return options?.charEncoding === "percent" ? encodeURIComponent(v) : v;
301
- };
302
- const encodeValue = (v: unknown) => encodeString(serializeValue(v));
303
-
304
- pairs.forEach(([pk, pv]) => {
305
- let tmp = "";
306
-
307
- if (pv === undefined) {
308
- return;
309
- } else if (Array.isArray(pv)) {
310
- tmp = mapDefined(pv, (v) => `${encodeValue(v)}`).join(",");
311
- } else if (isPlainObject(pv)) {
312
- tmp = mapDefinedEntries(Object.entries(pv), ([k, v]) => {
313
- return `,${encodeString(k)},${encodeValue(v)}`;
314
- }).join("");
315
- tmp = tmp.slice(1);
316
- } else {
317
- const k = options?.explode && isPlainObject(value) ? `${pk}=` : "";
318
- tmp = `${k}${encodeValue(pv)}`;
319
- }
320
-
321
- // If we end up with the nothing then skip forward
322
- if (!tmp) {
323
- return;
324
- }
325
-
326
- out += `,${tmp}`;
327
- });
328
-
329
- return out.slice(1);
330
- };
331
-
332
- function explode(key: string, value: unknown): [string, unknown][] {
333
- if (Array.isArray(value)) {
334
- return value.map((v) => [key, v]);
335
- } else if (isPlainObject(value)) {
336
- const o = value ?? {};
337
- return Object.entries(o).map(([k, v]) => [k, v]);
338
- } else {
339
- return [[key, value]];
340
- }
341
- }
342
-
343
- function serializeValue(value: unknown): string {
344
- if (value === null) {
345
- return "null";
346
- } else if (typeof value === "undefined") {
347
- return "";
348
- } else if (value instanceof Date) {
349
- return value.toISOString();
350
- } else if (value instanceof Uint8Array) {
351
- return bytesToBase64(value);
352
- } else if (typeof value === "object") {
353
- return JSON.stringify(value, jsonReplacer);
354
- }
355
-
356
- return `${value}`;
357
- }
358
-
359
- function jsonReplacer(_: string, value: unknown): unknown {
360
- if (value instanceof Uint8Array) {
361
- return bytesToBase64(value);
362
- } else {
363
- return value;
364
- }
365
- }
366
-
367
- function mapDefined<T, R>(inp: T[], mapper: (v: T) => R): R[] {
368
- return inp.reduce<R[]>((acc, v) => {
369
- if (v === undefined) {
370
- return acc;
371
- }
372
-
373
- const m = mapper(v);
374
- if (m === undefined) {
375
- return acc;
376
- }
377
-
378
- acc.push(m);
379
-
380
- return acc;
381
- }, []);
382
- }
383
-
384
- function mapDefinedEntries<K, V, R>(
385
- inp: Iterable<[K, V]>,
386
- mapper: (v: [K, V]) => R,
387
- ): R[] {
388
- const acc: R[] = [];
389
- for (const [k, v] of inp) {
390
- if (v === undefined) {
391
- continue;
392
- }
393
-
394
- const m = mapper([k, v]);
395
- if (m === undefined) {
396
- continue;
397
- }
398
-
399
- acc.push(m);
400
- }
401
-
402
- return acc;
403
- }
404
-
405
- export function queryJoin(...args: string[]): string {
406
- return args.filter(Boolean).join("&");
407
- }
408
-
409
- type QueryEncoderOptions = {
410
- explode?: boolean;
411
- charEncoding?: "percent" | "none";
412
- };
413
-
414
- type QueryEncoder = (
415
- key: string,
416
- value: unknown,
417
- options?: QueryEncoderOptions,
418
- ) => string;
419
-
420
- type BulkQueryEncoder = (
421
- values: Record<string, unknown>,
422
- options?: QueryEncoderOptions,
423
- ) => string;
424
-
425
- export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
426
- const bulkEncode = function (
427
- values: Record<string, unknown>,
428
- options?: QueryEncoderOptions,
429
- ): string {
430
- const opts: QueryEncoderOptions = {
431
- ...options,
432
- explode: options?.explode ?? true,
433
- charEncoding: options?.charEncoding ?? "percent",
434
- };
435
-
436
- const encoded = Object.entries(values).map(([key, value]) => {
437
- return f(key, value, opts);
438
- });
439
- return queryJoin(...encoded);
440
- };
441
-
442
- return bulkEncode;
443
- }
444
-
445
- export const encodeJSONQuery = queryEncoder(encodeJSON);
446
- export const encodeFormQuery = queryEncoder(encodeForm);
447
- export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited);
448
- export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited);
449
- export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject);
@@ -1,37 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import { dlv } from "./dlv.js";
6
-
7
- import * as z from "zod";
8
-
9
- export interface Env {
10
- FINANCEABLE_DEBUG?: boolean | undefined;
11
- }
12
-
13
- export const envSchema: z.ZodType<Env, z.ZodTypeDef, unknown> = z.object({
14
- FINANCEABLE_DEBUG: z.coerce.boolean().optional(),
15
- });
16
-
17
- let envMemo: Env | undefined = undefined;
18
- /**
19
- * Reads and validates environment variables.
20
- */
21
- export function env(): Env {
22
- if (envMemo) {
23
- return envMemo;
24
- }
25
-
26
- envMemo = envSchema.parse(
27
- dlv(globalThis, "process.env") ?? dlv(globalThis, "Deno.env") ?? {},
28
- );
29
- return envMemo;
30
- }
31
-
32
- /**
33
- * Clears the cached env object. Useful for testing with a fresh environment.
34
- */
35
- export function resetEnv() {
36
- envMemo = undefined;
37
- }
@@ -1,40 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- /**
6
- * Consumes a stream and returns a concatenated array buffer. Useful in
7
- * situations where we need to read the whole file because it forms part of a
8
- * larger payload containing other fields, and we can't modify the underlying
9
- * request structure.
10
- */
11
- export async function readableStreamToArrayBuffer(
12
- readable: ReadableStream<Uint8Array>,
13
- ): Promise<ArrayBuffer> {
14
- const reader = readable.getReader();
15
- const chunks: Uint8Array[] = [];
16
-
17
- let totalLength = 0;
18
- let done = false;
19
-
20
- while (!done) {
21
- const { value, done: doneReading } = await reader.read();
22
-
23
- if (doneReading) {
24
- done = true;
25
- } else {
26
- chunks.push(value);
27
- totalLength += value.length;
28
- }
29
- }
30
-
31
- const concatenatedChunks = new Uint8Array(totalLength);
32
- let offset = 0;
33
-
34
- for (const chunk of chunks) {
35
- concatenatedChunks.set(chunk, offset);
36
- offset += chunk.length;
37
- }
38
-
39
- return concatenatedChunks.buffer;
40
- }