cas-parser-node 1.8.0 → 1.10.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.
Files changed (153) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -3
  3. package/client.d.mts +83 -18
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +83 -18
  6. package/client.d.ts.map +1 -1
  7. package/client.js +88 -28
  8. package/client.js.map +1 -1
  9. package/client.mjs +88 -28
  10. package/client.mjs.map +1 -1
  11. package/internal/utils/query.d.mts +5 -0
  12. package/internal/utils/query.d.mts.map +1 -0
  13. package/internal/utils/query.d.ts +5 -0
  14. package/internal/utils/query.d.ts.map +1 -0
  15. package/internal/utils/query.js +23 -0
  16. package/internal/utils/query.js.map +1 -0
  17. package/internal/utils/query.mjs +20 -0
  18. package/internal/utils/query.mjs.map +1 -0
  19. package/internal/utils.d.mts +1 -0
  20. package/internal/utils.d.ts +1 -0
  21. package/internal/utils.js +1 -0
  22. package/internal/utils.js.map +1 -1
  23. package/internal/utils.mjs +1 -0
  24. package/package.json +1 -1
  25. package/resources/access-token.d.mts +5 -0
  26. package/resources/access-token.d.mts.map +1 -1
  27. package/resources/access-token.d.ts +5 -0
  28. package/resources/access-token.d.ts.map +1 -1
  29. package/resources/access-token.js +5 -0
  30. package/resources/access-token.js.map +1 -1
  31. package/resources/access-token.mjs +5 -0
  32. package/resources/access-token.mjs.map +1 -1
  33. package/resources/cams-kfintech.d.mts +3 -0
  34. package/resources/cams-kfintech.d.mts.map +1 -1
  35. package/resources/cams-kfintech.d.ts +3 -0
  36. package/resources/cams-kfintech.d.ts.map +1 -1
  37. package/resources/cams-kfintech.js +3 -0
  38. package/resources/cams-kfintech.js.map +1 -1
  39. package/resources/cams-kfintech.mjs +3 -0
  40. package/resources/cams-kfintech.mjs.map +1 -1
  41. package/resources/cdsl/cdsl.d.mts +3 -0
  42. package/resources/cdsl/cdsl.d.mts.map +1 -1
  43. package/resources/cdsl/cdsl.d.ts +3 -0
  44. package/resources/cdsl/cdsl.d.ts.map +1 -1
  45. package/resources/cdsl/cdsl.js +3 -0
  46. package/resources/cdsl/cdsl.js.map +1 -1
  47. package/resources/cdsl/cdsl.mjs +3 -0
  48. package/resources/cdsl/cdsl.mjs.map +1 -1
  49. package/resources/cdsl/fetch.d.mts +4 -0
  50. package/resources/cdsl/fetch.d.mts.map +1 -1
  51. package/resources/cdsl/fetch.d.ts +4 -0
  52. package/resources/cdsl/fetch.d.ts.map +1 -1
  53. package/resources/cdsl/fetch.js +4 -0
  54. package/resources/cdsl/fetch.js.map +1 -1
  55. package/resources/cdsl/fetch.mjs +4 -0
  56. package/resources/cdsl/fetch.mjs.map +1 -1
  57. package/resources/contract-note.d.mts +3 -0
  58. package/resources/contract-note.d.mts.map +1 -1
  59. package/resources/contract-note.d.ts +3 -0
  60. package/resources/contract-note.d.ts.map +1 -1
  61. package/resources/contract-note.js +3 -0
  62. package/resources/contract-note.js.map +1 -1
  63. package/resources/contract-note.mjs +3 -0
  64. package/resources/contract-note.mjs.map +1 -1
  65. package/resources/credits.d.mts +4 -0
  66. package/resources/credits.d.mts.map +1 -1
  67. package/resources/credits.d.ts +4 -0
  68. package/resources/credits.d.ts.map +1 -1
  69. package/resources/credits.js +4 -0
  70. package/resources/credits.js.map +1 -1
  71. package/resources/credits.mjs +4 -0
  72. package/resources/credits.mjs.map +1 -1
  73. package/resources/inbound-email.d.mts +22 -0
  74. package/resources/inbound-email.d.mts.map +1 -1
  75. package/resources/inbound-email.d.ts +22 -0
  76. package/resources/inbound-email.d.ts.map +1 -1
  77. package/resources/inbound-email.js +22 -0
  78. package/resources/inbound-email.js.map +1 -1
  79. package/resources/inbound-email.mjs +22 -0
  80. package/resources/inbound-email.mjs.map +1 -1
  81. package/resources/inbox.d.mts +17 -0
  82. package/resources/inbox.d.mts.map +1 -1
  83. package/resources/inbox.d.ts +17 -0
  84. package/resources/inbox.d.ts.map +1 -1
  85. package/resources/inbox.js +17 -0
  86. package/resources/inbox.js.map +1 -1
  87. package/resources/inbox.mjs +17 -0
  88. package/resources/inbox.mjs.map +1 -1
  89. package/resources/kfintech.d.mts +3 -0
  90. package/resources/kfintech.d.mts.map +1 -1
  91. package/resources/kfintech.d.ts +3 -0
  92. package/resources/kfintech.d.ts.map +1 -1
  93. package/resources/kfintech.js +3 -0
  94. package/resources/kfintech.js.map +1 -1
  95. package/resources/kfintech.mjs +3 -0
  96. package/resources/kfintech.mjs.map +1 -1
  97. package/resources/logs.d.mts +4 -0
  98. package/resources/logs.d.mts.map +1 -1
  99. package/resources/logs.d.ts +4 -0
  100. package/resources/logs.d.ts.map +1 -1
  101. package/resources/logs.js +4 -0
  102. package/resources/logs.js.map +1 -1
  103. package/resources/logs.mjs +4 -0
  104. package/resources/logs.mjs.map +1 -1
  105. package/resources/nsdl.d.mts +3 -0
  106. package/resources/nsdl.d.mts.map +1 -1
  107. package/resources/nsdl.d.ts +3 -0
  108. package/resources/nsdl.d.ts.map +1 -1
  109. package/resources/nsdl.js +3 -0
  110. package/resources/nsdl.js.map +1 -1
  111. package/resources/nsdl.mjs +3 -0
  112. package/resources/nsdl.mjs.map +1 -1
  113. package/resources/smart.d.mts +3 -0
  114. package/resources/smart.d.mts.map +1 -1
  115. package/resources/smart.d.ts +3 -0
  116. package/resources/smart.d.ts.map +1 -1
  117. package/resources/smart.js +3 -0
  118. package/resources/smart.js.map +1 -1
  119. package/resources/smart.mjs +3 -0
  120. package/resources/smart.mjs.map +1 -1
  121. package/resources/verify-token.d.mts +5 -0
  122. package/resources/verify-token.d.mts.map +1 -1
  123. package/resources/verify-token.d.ts +5 -0
  124. package/resources/verify-token.d.ts.map +1 -1
  125. package/resources/verify-token.js +5 -0
  126. package/resources/verify-token.js.map +1 -1
  127. package/resources/verify-token.mjs +5 -0
  128. package/resources/verify-token.mjs.map +1 -1
  129. package/src/client.ts +91 -48
  130. package/src/internal/utils/query.ts +23 -0
  131. package/src/internal/utils.ts +1 -0
  132. package/src/resources/access-token.ts +5 -0
  133. package/src/resources/cams-kfintech.ts +3 -0
  134. package/src/resources/cdsl/cdsl.ts +3 -0
  135. package/src/resources/cdsl/fetch.ts +4 -0
  136. package/src/resources/contract-note.ts +3 -0
  137. package/src/resources/credits.ts +4 -0
  138. package/src/resources/inbound-email.ts +22 -0
  139. package/src/resources/inbox.ts +17 -0
  140. package/src/resources/kfintech.ts +3 -0
  141. package/src/resources/logs.ts +4 -0
  142. package/src/resources/nsdl.ts +3 -0
  143. package/src/resources/smart.ts +3 -0
  144. package/src/resources/verify-token.ts +5 -0
  145. package/src/version.ts +1 -1
  146. package/version.d.mts +1 -1
  147. package/version.d.mts.map +1 -1
  148. package/version.d.ts +1 -1
  149. package/version.d.ts.map +1 -1
  150. package/version.js +1 -1
  151. package/version.js.map +1 -1
  152. package/version.mjs +1 -1
  153. package/version.mjs.map +1 -1
package/src/client.ts CHANGED
@@ -11,6 +11,7 @@ import type { APIResponseProps } from './internal/parse';
11
11
  import { getPlatformHeaders } from './internal/detect-platform';
12
12
  import * as Shims from './internal/shims';
13
13
  import * as Opts from './internal/request-options';
14
+ import { stringifyQuery } from './internal/utils/query';
14
15
  import { VERSION } from './version';
15
16
  import * as Errors from './core/error';
16
17
  import * as Uploads from './core/uploads';
@@ -71,13 +72,6 @@ import {
71
72
  } from './internal/utils/log';
72
73
  import { isEmptyObj } from './internal/utils/values';
73
74
 
74
- const environments = {
75
- production: 'https://portfolio-parser.api.casparser.in',
76
- environment_1: 'https://client-apis.casparser.in',
77
- environment_2: 'http://localhost:5000',
78
- };
79
- type Environment = keyof typeof environments;
80
-
81
75
  export interface ClientOptions {
82
76
  /**
83
77
  * Your API key for authentication.
@@ -86,16 +80,6 @@ export interface ClientOptions {
86
80
  */
87
81
  apiKey?: string | undefined;
88
82
 
89
- /**
90
- * Specifies the environment to use for the API.
91
- *
92
- * Each environment maps to a different base URL:
93
- * - `production` corresponds to `https://portfolio-parser.api.casparser.in`
94
- * - `environment_1` corresponds to `https://client-apis.casparser.in`
95
- * - `environment_2` corresponds to `http://localhost:5000`
96
- */
97
- environment?: Environment | undefined;
98
-
99
83
  /**
100
84
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
101
85
  *
@@ -187,8 +171,7 @@ export class CasParser {
187
171
  * API Client for interfacing with the Cas Parser API.
188
172
  *
189
173
  * @param {string | undefined} [opts.apiKey=process.env['CAS_PARSER_API_KEY'] ?? undefined]
190
- * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
191
- * @param {string} [opts.baseURL=process.env['CAS_PARSER_BASE_URL'] ?? https://portfolio-parser.api.casparser.in] - Override the default base URL for the API.
174
+ * @param {string} [opts.baseURL=process.env['CAS_PARSER_BASE_URL'] ?? https://api.casparser.in] - Override the default base URL for the API.
192
175
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
193
176
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
194
177
  * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -210,17 +193,10 @@ export class CasParser {
210
193
  const options: ClientOptions = {
211
194
  apiKey,
212
195
  ...opts,
213
- baseURL,
214
- environment: opts.environment ?? 'production',
196
+ baseURL: baseURL || `https://api.casparser.in`,
215
197
  };
216
198
 
217
- if (baseURL && opts.environment) {
218
- throw new Errors.CasParserError(
219
- 'Ambiguous URL; The `baseURL` option (or CAS_PARSER_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null',
220
- );
221
- }
222
-
223
- this.baseURL = options.baseURL || environments[options.environment || 'production'];
199
+ this.baseURL = options.baseURL!;
224
200
  this.timeout = options.timeout ?? CasParser.DEFAULT_TIMEOUT /* 1 minute */;
225
201
  this.logger = options.logger ?? console;
226
202
  const defaultLogLevel = 'warn';
@@ -246,8 +222,7 @@ export class CasParser {
246
222
  withOptions(options: Partial<ClientOptions>): this {
247
223
  const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({
248
224
  ...this._options,
249
- environment: options.environment ? options.environment : undefined,
250
- baseURL: options.environment ? undefined : this.baseURL,
225
+ baseURL: this.baseURL,
251
226
  maxRetries: this.maxRetries,
252
227
  timeout: this.timeout,
253
228
  logger: this.logger,
@@ -264,7 +239,7 @@ export class CasParser {
264
239
  * Check whether the base URL is set to its default.
265
240
  */
266
241
  #baseURLOverridden(): boolean {
267
- return this.baseURL !== environments[this._options.environment || 'production'];
242
+ return this.baseURL !== 'https://api.casparser.in';
268
243
  }
269
244
 
270
245
  protected defaultQuery(): Record<string, string | undefined> | undefined {
@@ -282,21 +257,8 @@ export class CasParser {
282
257
  /**
283
258
  * Basic re-implementation of `qs.stringify` for primitive types.
284
259
  */
285
- protected stringifyQuery(query: Record<string, unknown>): string {
286
- return Object.entries(query)
287
- .filter(([_, value]) => typeof value !== 'undefined')
288
- .map(([key, value]) => {
289
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
290
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
291
- }
292
- if (value === null) {
293
- return `${encodeURIComponent(key)}=`;
294
- }
295
- throw new Errors.CasParserError(
296
- `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
297
- );
298
- })
299
- .join('&');
260
+ protected stringifyQuery(query: object | Record<string, unknown>): string {
261
+ return stringifyQuery(query);
300
262
  }
301
263
 
302
264
  private getUserAgent(): string {
@@ -333,7 +295,7 @@ export class CasParser {
333
295
  }
334
296
 
335
297
  if (typeof query === 'object' && query && !Array.isArray(query)) {
336
- url.search = this.stringifyQuery(query as Record<string, unknown>);
298
+ url.search = this.stringifyQuery(query);
337
299
  }
338
300
 
339
301
  return url.toString();
@@ -772,7 +734,7 @@ export class CasParser {
772
734
  ) {
773
735
  return {
774
736
  bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
775
- body: this.stringifyQuery(body as Record<string, unknown>),
737
+ body: this.stringifyQuery(body),
776
738
  };
777
739
  } else {
778
740
  return this.#encoder({ body, headers });
@@ -798,17 +760,98 @@ export class CasParser {
798
760
 
799
761
  static toFile = Uploads.toFile;
800
762
 
763
+ /**
764
+ * Endpoints for checking API quota and credits usage.
765
+ * These endpoints help you monitor your API usage and remaining quota.
766
+ *
767
+ */
801
768
  credits: API.Credits = new API.Credits(this);
769
+ /**
770
+ * Endpoints for checking API quota and credits usage.
771
+ * These endpoints help you monitor your API usage and remaining quota.
772
+ *
773
+ */
802
774
  logs: API.Logs = new API.Logs(this);
775
+ /**
776
+ * Endpoints for managing access tokens for the Portfolio Connect SDK.
777
+ * Use these to generate short-lived `at_` prefixed tokens that can be safely passed to frontend applications.
778
+ * Access tokens can be used in place of API keys on all v4 endpoints.
779
+ *
780
+ */
803
781
  accessToken: API.AccessToken = new API.AccessToken(this);
782
+ /**
783
+ * Endpoints for managing access tokens for the Portfolio Connect SDK.
784
+ * Use these to generate short-lived `at_` prefixed tokens that can be safely passed to frontend applications.
785
+ * Access tokens can be used in place of API keys on all v4 endpoints.
786
+ *
787
+ */
804
788
  verifyToken: API.VerifyToken = new API.VerifyToken(this);
789
+ /**
790
+ * Endpoints for parsing CAS PDF files from different sources.
791
+ */
805
792
  camsKfintech: API.CamsKfintech = new API.CamsKfintech(this);
793
+ /**
794
+ * Endpoints for parsing CAS PDF files from different sources.
795
+ */
806
796
  cdsl: API.Cdsl = new API.Cdsl(this);
797
+ /**
798
+ * Endpoints for parsing Contract Note PDF files from various SEBI brokers like Zerodha, Groww, Upstox, ICICI etc.
799
+ */
807
800
  contractNote: API.ContractNote = new API.ContractNote(this);
801
+ /**
802
+ * Endpoints for importing CAS files directly from user email inboxes.
803
+ *
804
+ * **Supported Providers:** Gmail (more coming soon)
805
+ *
806
+ * **How it works:**
807
+ * 1. Call `POST /v4/inbox/connect` to get an OAuth URL
808
+ * 2. Redirect user to the OAuth URL for consent
809
+ * 3. User is redirected back to your `redirect_uri` with an encrypted `inbox_token`
810
+ * 4. Use the token to list/fetch CAS files from their inbox (`/v4/inbox/cas`)
811
+ * 5. Files are uploaded to temporary cloud storage (URLs expire in 24 hours)
812
+ *
813
+ * **Security:**
814
+ * - Read-only access (we cannot send emails)
815
+ * - Tokens are encrypted with server-side secret
816
+ * - User can revoke access anytime via `/v4/inbox/disconnect`
817
+ *
818
+ */
808
819
  inbox: API.Inbox = new API.Inbox(this);
820
+ /**
821
+ * Endpoints for generating new CAS documents via email mailback (KFintech).
822
+ */
809
823
  kfintech: API.Kfintech = new API.Kfintech(this);
824
+ /**
825
+ * Endpoints for parsing CAS PDF files from different sources.
826
+ */
810
827
  nsdl: API.Nsdl = new API.Nsdl(this);
828
+ /**
829
+ * Endpoints for parsing CAS PDF files from different sources.
830
+ */
811
831
  smart: API.Smart = new API.Smart(this);
832
+ /**
833
+ * Create dedicated inbound email addresses for investors to forward their CAS statements.
834
+ *
835
+ * **Use Case:** Your app wants to collect CAS statements from users without requiring OAuth or file upload.
836
+ *
837
+ * **How it works:**
838
+ * 1. Call `POST /v4/inbound-email` to create a unique inbound email address
839
+ * 2. Display this email to your user: "Forward your CAS statement to ie_xxx@import.casparser.in"
840
+ * 3. When user forwards a CAS email, we verify sender authenticity (SPF/DKIM) and call your webhook
841
+ * 4. Your webhook receives email metadata + attachment download URLs
842
+ *
843
+ * **Sender Validation:**
844
+ * - Only emails from verified CAS authorities are processed:
845
+ * - CDSL: `eCAS@cdslstatement.com`
846
+ * - NSDL: `NSDL-CAS@nsdl.co.in`
847
+ * - CAMS: `donotreply@camsonline.com`
848
+ * - KFintech: `samfS@kfintech.com`
849
+ * - Emails failing SPF/DKIM/DMARC are rejected
850
+ * - Forwarded emails must contain the original sender in headers
851
+ *
852
+ * **Billing:** 0.2 credits per successfully processed valid email
853
+ *
854
+ */
812
855
  inboundEmail: API.InboundEmail = new API.InboundEmail(this);
813
856
  }
814
857
 
@@ -0,0 +1,23 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { CasParserError } from '../../core/error';
4
+
5
+ /**
6
+ * Basic re-implementation of `qs.stringify` for primitive types.
7
+ */
8
+ export function stringifyQuery(query: object | Record<string, unknown>) {
9
+ return Object.entries(query)
10
+ .filter(([_, value]) => typeof value !== 'undefined')
11
+ .map(([key, value]) => {
12
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
13
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
14
+ }
15
+ if (value === null) {
16
+ return `${encodeURIComponent(key)}=`;
17
+ }
18
+ throw new CasParserError(
19
+ `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
20
+ );
21
+ })
22
+ .join('&');
23
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';
@@ -4,6 +4,11 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
+ /**
8
+ * Endpoints for managing access tokens for the Portfolio Connect SDK.
9
+ * Use these to generate short-lived `at_` prefixed tokens that can be safely passed to frontend applications.
10
+ * Access tokens can be used in place of API keys on all v4 endpoints.
11
+ */
7
12
  export class AccessToken extends APIResource {
8
13
  /**
9
14
  * Generate a short-lived access token from your API key.
@@ -6,6 +6,9 @@ import { APIPromise } from '../core/api-promise';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
  import { maybeMultipartFormRequestOptions } from '../internal/uploads';
8
8
 
9
+ /**
10
+ * Endpoints for parsing CAS PDF files from different sources.
11
+ */
9
12
  export class CamsKfintech extends APIResource {
10
13
  /**
11
14
  * This endpoint specifically parses CAMS/KFintech CAS (Consolidated Account
@@ -14,6 +14,9 @@ import { APIPromise } from '../../core/api-promise';
14
14
  import { RequestOptions } from '../../internal/request-options';
15
15
  import { maybeMultipartFormRequestOptions } from '../../internal/uploads';
16
16
 
17
+ /**
18
+ * Endpoints for parsing CAS PDF files from different sources.
19
+ */
17
20
  export class Cdsl extends APIResource {
18
21
  fetch: FetchAPI.Fetch = new FetchAPI.Fetch(this._client);
19
22
 
@@ -5,6 +5,10 @@ import { APIPromise } from '../../core/api-promise';
5
5
  import { RequestOptions } from '../../internal/request-options';
6
6
  import { path } from '../../internal/utils/path';
7
7
 
8
+ /**
9
+ * Endpoints for fetching CAS documents with instant download.
10
+ * Currently supports CDSL via OTP authentication.
11
+ */
8
12
  export class Fetch extends APIResource {
9
13
  /**
10
14
  * **Step 1 of 2**: Request OTP for CDSL CAS fetch.
@@ -5,6 +5,9 @@ import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
  import { maybeMultipartFormRequestOptions } from '../internal/uploads';
7
7
 
8
+ /**
9
+ * Endpoints for parsing Contract Note PDF files from various SEBI brokers like Zerodha, Groww, Upstox, ICICI etc.
10
+ */
8
11
  export class ContractNote extends APIResource {
9
12
  /**
10
13
  * This endpoint parses Contract Note PDF files from various brokers including
@@ -4,6 +4,10 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
+ /**
8
+ * Endpoints for checking API quota and credits usage.
9
+ * These endpoints help you monitor your API usage and remaining quota.
10
+ */
7
11
  export class Credits extends APIResource {
8
12
  /**
9
13
  * Check your remaining API credits and usage for the current billing period.
@@ -5,6 +5,28 @@ import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
  import { path } from '../internal/utils/path';
7
7
 
8
+ /**
9
+ * Create dedicated inbound email addresses for investors to forward their CAS statements.
10
+ *
11
+ * **Use Case:** Your app wants to collect CAS statements from users without requiring OAuth or file upload.
12
+ *
13
+ * **How it works:**
14
+ * 1. Call `POST /v4/inbound-email` to create a unique inbound email address
15
+ * 2. Display this email to your user: "Forward your CAS statement to ie_xxx@import.casparser.in"
16
+ * 3. When user forwards a CAS email, we verify sender authenticity (SPF/DKIM) and call your webhook
17
+ * 4. Your webhook receives email metadata + attachment download URLs
18
+ *
19
+ * **Sender Validation:**
20
+ * - Only emails from verified CAS authorities are processed:
21
+ * - CDSL: `eCAS@cdslstatement.com`
22
+ * - NSDL: `NSDL-CAS@nsdl.co.in`
23
+ * - CAMS: `donotreply@camsonline.com`
24
+ * - KFintech: `samfS@kfintech.com`
25
+ * - Emails failing SPF/DKIM/DMARC are rejected
26
+ * - Forwarded emails must contain the original sender in headers
27
+ *
28
+ * **Billing:** 0.2 credits per successfully processed valid email
29
+ */
8
30
  export class InboundEmail extends APIResource {
9
31
  /**
10
32
  * Create a dedicated inbound email address for collecting CAS statements via email
@@ -5,6 +5,23 @@ import { APIPromise } from '../core/api-promise';
5
5
  import { buildHeaders } from '../internal/headers';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
 
8
+ /**
9
+ * Endpoints for importing CAS files directly from user email inboxes.
10
+ *
11
+ * **Supported Providers:** Gmail (more coming soon)
12
+ *
13
+ * **How it works:**
14
+ * 1. Call `POST /v4/inbox/connect` to get an OAuth URL
15
+ * 2. Redirect user to the OAuth URL for consent
16
+ * 3. User is redirected back to your `redirect_uri` with an encrypted `inbox_token`
17
+ * 4. Use the token to list/fetch CAS files from their inbox (`/v4/inbox/cas`)
18
+ * 5. Files are uploaded to temporary cloud storage (URLs expire in 24 hours)
19
+ *
20
+ * **Security:**
21
+ * - Read-only access (we cannot send emails)
22
+ * - Tokens are encrypted with server-side secret
23
+ * - User can revoke access anytime via `/v4/inbox/disconnect`
24
+ */
8
25
  export class Inbox extends APIResource {
9
26
  /**
10
27
  * Verify if an `inbox_token` is still valid and check connection status.
@@ -4,6 +4,9 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
+ /**
8
+ * Endpoints for generating new CAS documents via email mailback (KFintech).
9
+ */
7
10
  export class Kfintech extends APIResource {
8
11
  /**
9
12
  * Generate CAS via KFintech mailback. The CAS PDF will be sent to the investor's
@@ -4,6 +4,10 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
+ /**
8
+ * Endpoints for checking API quota and credits usage.
9
+ * These endpoints help you monitor your API usage and remaining quota.
10
+ */
7
11
  export class Logs extends APIResource {
8
12
  /**
9
13
  * Retrieve detailed API usage logs for your account.
@@ -6,6 +6,9 @@ import { APIPromise } from '../core/api-promise';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
  import { maybeMultipartFormRequestOptions } from '../internal/uploads';
8
8
 
9
+ /**
10
+ * Endpoints for parsing CAS PDF files from different sources.
11
+ */
9
12
  export class Nsdl extends APIResource {
10
13
  /**
11
14
  * This endpoint specifically parses NSDL CAS (Consolidated Account Statement) PDF
@@ -6,6 +6,9 @@ import { APIPromise } from '../core/api-promise';
6
6
  import { RequestOptions } from '../internal/request-options';
7
7
  import { maybeMultipartFormRequestOptions } from '../internal/uploads';
8
8
 
9
+ /**
10
+ * Endpoints for parsing CAS PDF files from different sources.
11
+ */
9
12
  export class Smart extends APIResource {
10
13
  /**
11
14
  * This endpoint parses CAS (Consolidated Account Statement) PDF files from NSDL,
@@ -4,6 +4,11 @@ import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
+ /**
8
+ * Endpoints for managing access tokens for the Portfolio Connect SDK.
9
+ * Use these to generate short-lived `at_` prefixed tokens that can be safely passed to frontend applications.
10
+ * Access tokens can be used in place of API keys on all v4 endpoints.
11
+ */
7
12
  export class VerifyToken extends APIResource {
8
13
  /**
9
14
  * Verify an access token and check if it's still valid. Useful for debugging token
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.8.0'; // x-release-please-version
1
+ export const VERSION = '1.10.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.8.0";
1
+ export declare const VERSION = "1.10.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.8.0";
1
+ export declare const VERSION = "1.10.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '1.8.0'; // x-release-please-version
4
+ exports.VERSION = '1.10.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.8.0'; // x-release-please-version
1
+ export const VERSION = '1.10.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
package/version.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}