@invezgo/sdk 1.3.1 → 2.0.1

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 (56) hide show
  1. package/README.md +318 -313
  2. package/dist/cache.d.ts +27 -0
  3. package/dist/cache.d.ts.map +1 -0
  4. package/dist/client.d.ts +15 -18
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/errors.d.ts +71 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/generated/resources.d.ts +3291 -0
  9. package/dist/generated/resources.d.ts.map +1 -0
  10. package/dist/generated/types.d.ts +3449 -0
  11. package/dist/generated/types.d.ts.map +1 -0
  12. package/dist/http.d.ts +66 -0
  13. package/dist/http.d.ts.map +1 -0
  14. package/dist/index.d.ts +9 -15
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +755 -1005
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +775 -0
  19. package/dist/index.mjs.map +1 -0
  20. package/package.json +66 -60
  21. package/dist/endpoints/ai.d.ts +0 -98
  22. package/dist/endpoints/ai.d.ts.map +0 -1
  23. package/dist/endpoints/alerts.d.ts +0 -49
  24. package/dist/endpoints/alerts.d.ts.map +0 -1
  25. package/dist/endpoints/analysis.d.ts +0 -369
  26. package/dist/endpoints/analysis.d.ts.map +0 -1
  27. package/dist/endpoints/health.d.ts +0 -24
  28. package/dist/endpoints/health.d.ts.map +0 -1
  29. package/dist/endpoints/journals.d.ts +0 -49
  30. package/dist/endpoints/journals.d.ts.map +0 -1
  31. package/dist/endpoints/membership.d.ts +0 -35
  32. package/dist/endpoints/membership.d.ts.map +0 -1
  33. package/dist/endpoints/portfolios.d.ts +0 -14
  34. package/dist/endpoints/portfolios.d.ts.map +0 -1
  35. package/dist/endpoints/posts.d.ts +0 -42
  36. package/dist/endpoints/posts.d.ts.map +0 -1
  37. package/dist/endpoints/profile.d.ts +0 -34
  38. package/dist/endpoints/profile.d.ts.map +0 -1
  39. package/dist/endpoints/recommendation.d.ts +0 -10
  40. package/dist/endpoints/recommendation.d.ts.map +0 -1
  41. package/dist/endpoints/screener.d.ts +0 -45
  42. package/dist/endpoints/screener.d.ts.map +0 -1
  43. package/dist/endpoints/search.d.ts +0 -18
  44. package/dist/endpoints/search.d.ts.map +0 -1
  45. package/dist/endpoints/trades.d.ts +0 -31
  46. package/dist/endpoints/trades.d.ts.map +0 -1
  47. package/dist/endpoints/usage.d.ts +0 -11
  48. package/dist/endpoints/usage.d.ts.map +0 -1
  49. package/dist/endpoints/watchlists.d.ts +0 -64
  50. package/dist/endpoints/watchlists.d.ts.map +0 -1
  51. package/dist/index.esm.js +0 -1054
  52. package/dist/index.esm.js.map +0 -1
  53. package/dist/invezgo.d.ts +0 -40
  54. package/dist/invezgo.d.ts.map +0 -1
  55. package/dist/types.d.ts +0 -574
  56. package/dist/types.d.ts.map +0 -1
@@ -0,0 +1,27 @@
1
+ /**
2
+ * In-memory (L1) LRU cache of raw response bodies.
3
+ *
4
+ * A `Map` keeps insertion order, so re-inserting a key on every hit makes the first key the
5
+ * least recently used. Bounded by entry count and total UTF-8 bytes; expired entries are
6
+ * dropped lazily on access or when evicted — no timers.
7
+ */
8
+ export declare class LruCache {
9
+ readonly maxEntries: number;
10
+ readonly maxBytes: number;
11
+ private readonly now;
12
+ private readonly map;
13
+ private totalBytes;
14
+ constructor(maxEntries: number, maxBytes: number, now?: () => number);
15
+ /** Number of entries currently stored (including not-yet-evicted expired ones). */
16
+ get size(): number;
17
+ /** Total bytes of all stored bodies. */
18
+ get bytes(): number;
19
+ get(key: string): string | undefined;
20
+ /** Store `body` for `ttlMs`. Bodies larger than `maxBytes` are not cached. */
21
+ set(key: string, body: string, ttlMs: number): void;
22
+ delete(key: string): void;
23
+ /** Delete every entry whose key matches `predicate`. */
24
+ deleteWhere(predicate: (key: string) => boolean): void;
25
+ clear(): void;
26
+ }
27
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,qBAAa,QAAQ;IAKjB,QAAQ,CAAC,UAAU,EAAE,MAAM;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;IANtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA4B;IAChD,OAAO,CAAC,UAAU,CAAK;gBAGZ,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EACR,GAAG,GAAE,MAAM,MAAgC;IAG9D,mFAAmF;IACnF,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,wCAAwC;IACxC,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAYpC,8EAA8E;IAC9E,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAanD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQzB,wDAAwD;IACxD,WAAW,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI;IAItD,KAAK,IAAI,IAAI;CAId"}
package/dist/client.d.ts CHANGED
@@ -1,21 +1,18 @@
1
- import type { InvezgoConfig, RequestOptions } from './types';
2
- export declare class InvezgoError extends Error {
3
- statusCode: number;
4
- message: string;
5
- error?: string | undefined;
6
- response?: any | undefined;
7
- constructor(statusCode: number, message: string, error?: string | undefined, response?: any | undefined);
8
- }
9
- export declare class HttpClient {
10
- baseURL: string;
11
- apiKey: string;
12
- private timeout;
1
+ import { InvezgoResources } from './generated/resources';
2
+ import { type InvezgoConfig } from './http';
3
+ /**
4
+ * Invezgo API client.
5
+ *
6
+ * ```ts
7
+ * const client = new Invezgo({ apiKey: process.env.INVEZGO_API_KEY! });
8
+ * const stocks = await client.analysis.getStockList();
9
+ * ```
10
+ */
11
+ export declare class Invezgo extends InvezgoResources {
12
+ #private;
13
13
  constructor(config: InvezgoConfig);
14
- private request;
15
- get<T>(path: string, params?: Record<string, any>, options?: RequestOptions): Promise<T>;
16
- post<T>(path: string, body?: any, options?: RequestOptions): Promise<T>;
17
- put<T>(path: string, body?: any, options?: RequestOptions): Promise<T>;
18
- patch<T>(path: string, body?: any, options?: RequestOptions): Promise<T>;
19
- delete<T>(path: string, params?: Record<string, any>, options?: RequestOptions): Promise<T>;
14
+ /** Drop every cached response. */
15
+ clearCache(): void;
20
16
  }
17
+ export { Invezgo as InvezgoClient };
21
18
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7D,qBAAa,YAAa,SAAQ,KAAK;IAE5B,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,MAAM;IACf,KAAK,CAAC,EAAE,MAAM;IACd,QAAQ,CAAC,EAAE,GAAG;gBAHd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,YAAA,EACd,QAAQ,CAAC,EAAE,GAAG,YAAA;CAMxB;AAED,qBAAa,UAAU;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,aAAa;YAYnB,OAAO;IA8Df,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAoBxF,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAgEvE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAyDtE,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IAyDxE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;CAmBlG"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvD;;;;;;;GAOG;AACH,qBAAa,OAAQ,SAAQ,gBAAgB;;gBAG/B,MAAM,EAAE,aAAa;IAMjC,kCAAkC;IAClC,UAAU,IAAI,IAAI;CAGnB;AAED,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,CAAC"}
@@ -0,0 +1,71 @@
1
+ /** Fields shared by every error thrown by the SDK. */
2
+ export interface InvezgoErrorInit {
3
+ status: number;
4
+ message: string;
5
+ error?: string;
6
+ requestId?: string;
7
+ path?: string;
8
+ body?: unknown;
9
+ cause?: unknown;
10
+ }
11
+ /**
12
+ * Base class of every SDK error. Use `instanceof` on the subclasses to branch.
13
+ *
14
+ * - `status` — HTTP status code (`0` for network/timeout errors)
15
+ * - `message` — human readable message from the API
16
+ * - `error` — HTTP status text from the API body (e.g. `Unauthorized`)
17
+ * - `requestId` — quote this to Invezgo support
18
+ * - `body` — decoded JSON error body (or raw text)
19
+ */
20
+ export declare class InvezgoError extends Error {
21
+ readonly status: number;
22
+ readonly error?: string;
23
+ readonly requestId?: string;
24
+ readonly path?: string;
25
+ readonly body?: unknown;
26
+ constructor(init: InvezgoErrorInit);
27
+ }
28
+ /** 400 / 422 — invalid parameters or body (see `message`). */
29
+ export declare class ValidationError extends InvezgoError {
30
+ }
31
+ /** 401 — API key missing, invalid or expired. */
32
+ export declare class AuthenticationError extends InvezgoError {
33
+ }
34
+ /** 402 — your subscription plan does not include this endpoint. */
35
+ export declare class PaymentRequiredError extends InvezgoError {
36
+ }
37
+ /** 404 — resource not found. */
38
+ export declare class NotFoundError extends InvezgoError {
39
+ }
40
+ /** >= 500 — server side error; usually safe to retry later. */
41
+ export declare class ServerError extends InvezgoError {
42
+ }
43
+ /** 429 — every configured API key is rate limited or out of monthly quota. */
44
+ export declare class RateLimitError extends InvezgoError {
45
+ /** Seconds until the earliest key becomes usable again. */
46
+ readonly retryAfter: number;
47
+ /** `X-RateLimit-Limit` of the last 429 response (requests per minute). */
48
+ readonly limit?: number;
49
+ /** `X-RateLimit-Remaining` of the last 429 response. */
50
+ readonly remaining?: number;
51
+ /** `X-RateLimit-Reset` of the last 429 response (Unix seconds). */
52
+ readonly reset?: number;
53
+ /** `true` when the monthly quota (not the per-minute limit) is exhausted. */
54
+ readonly quotaExceeded: boolean;
55
+ constructor(init: InvezgoErrorInit & {
56
+ retryAfter: number;
57
+ limit?: number;
58
+ remaining?: number;
59
+ reset?: number;
60
+ quotaExceeded: boolean;
61
+ });
62
+ }
63
+ /** Network failure: DNS, connection refused, TLS, aborted socket… (`status` = 0). */
64
+ export declare class ConnectionError extends InvezgoError {
65
+ }
66
+ /** The request exceeded the configured `timeout` (`status` = 0). */
67
+ export declare class TimeoutError extends ConnectionError {
68
+ }
69
+ /** Map an HTTP status to the matching error class. */
70
+ export declare function errorClassFor(status: number): new (init: InvezgoErrorInit) => InvezgoError;
71
+ //# sourceMappingURL=errors.d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