snaptrade-typescript-sdk 9.0.20 → 9.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/common.js CHANGED
@@ -157,7 +157,7 @@ exports.removeTrailingSlash = removeTrailingSlash;
157
157
  * Wrap an axios request in a try/catch block to catch network errors and parse the response body
158
158
  */
159
159
  function wrapAxiosRequest(makeRequest) {
160
- var _a, _b, _c;
160
+ var _a, _b, _c, _d, _e;
161
161
  return __awaiter(this, void 0, void 0, function* () {
162
162
  try {
163
163
  return yield makeRequest();
@@ -168,13 +168,13 @@ function wrapAxiosRequest(makeRequest) {
168
168
  const responseBody = ((_a = e.response) === null || _a === void 0 ? void 0 : _a.data) instanceof ReadableStream
169
169
  ? yield (0, error_1.readableStreamToString)(e.response.data)
170
170
  : (_b = e.response) === null || _b === void 0 ? void 0 : _b.data;
171
- throw new error_1.SnaptradeError(e, (0, error_1.parseIfJson)(responseBody));
171
+ throw new error_1.SnaptradeError(e, (0, error_1.parseIfJson)(responseBody), (_c = e.response) === null || _c === void 0 ? void 0 : _c.headers);
172
172
  }
173
173
  catch (innerError) {
174
174
  if (innerError instanceof ReferenceError) {
175
175
  // Got: "ReferenceError: ReadableStream is not defined"
176
176
  // This means we are in a Node environment so just throw the original error
177
- throw new error_1.SnaptradeError(e, (_c = e.response) === null || _c === void 0 ? void 0 : _c.data);
177
+ throw new error_1.SnaptradeError(e, (_d = e.response) === null || _d === void 0 ? void 0 : _d.data, (_e = e.response) === null || _e === void 0 ? void 0 : _e.headers);
178
178
  }
179
179
  if (innerError instanceof error_1.SnaptradeError) {
180
180
  // Got "SnaptradeError" from the above try block
@@ -32,7 +32,7 @@ class Configuration {
32
32
  this.accessToken = param.accessToken;
33
33
  this.basePath = param.basePath;
34
34
  this.baseOptions = (_a = param.baseOptions) !== null && _a !== void 0 ? _a : {};
35
- this.userAgent = param.userAgent === undefined ? "Konfig/9.0.20/typescript" : param.userAgent;
35
+ this.userAgent = param.userAgent === undefined ? "Konfig/9.0.22/typescript" : param.userAgent;
36
36
  this.formDataCtor = param.formDataCtor;
37
37
  }
38
38
  /**
package/dist/error.d.ts CHANGED
@@ -30,7 +30,7 @@ export declare class SnaptradeError extends Error {
30
30
  * HTTP request method (see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods)
31
31
  */
32
32
  readonly method?: string;
33
- constructor(axiosError: AxiosError, responseBody: unknown);
33
+ constructor(axiosError: AxiosError, responseBody: unknown, headers: unknown);
34
34
  toJSON(): {
35
35
  name: string;
36
36
  message: string;
package/dist/error.js CHANGED
@@ -24,9 +24,10 @@ exports.parseIfJson = exports.readableStreamToString = exports.SnaptradeError =
24
24
  * This class provides a wrapper for network errors when making requests to SnapTrade
25
25
  */
26
26
  class SnaptradeError extends Error {
27
- constructor(axiosError, responseBody) {
27
+ constructor(axiosError, responseBody, headers) {
28
28
  var _a, _b, _c, _d, _e;
29
- super(axiosError.message);
29
+ const message = axiosError.message + "\nRESPONSE HEADERS:\n" + JSON.stringify(headers, null, 2);
30
+ super(message);
30
31
  this.name = "SnaptradeError";
31
32
  this.code = axiosError.code;
32
33
  this.method = (_b = (_a = axiosError.config) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.toUpperCase();
@@ -1,5 +1,4 @@
1
1
  import { AccountOrderRecordStatus } from './account-order-record-status';
2
- import { Action } from './action';
3
2
  import { OptionsSymbol } from './options-symbol';
4
3
  import { UniversalSymbol } from './universal-symbol';
5
4
  /**
@@ -40,11 +39,11 @@ export interface AccountOrderRecord {
40
39
  */
41
40
  'option_symbol'?: OptionsSymbol;
42
41
  /**
43
- * Trade Action
44
- * @type {Action}
42
+ * Trade Action potential values include (but are not limited to) - BUY - SELL - BUY_COVER - SELL_SHORT - BUY_OPEN - BUY_CLOSE - SELL_OPEN - SELL_CLOSE
43
+ * @type {string}
45
44
  * @memberof AccountOrderRecord
46
45
  */
47
- 'action'?: Action;
46
+ 'action'?: string;
48
47
  /**
49
48
  *
50
49
  * @type {number}
@@ -3,4 +3,4 @@
3
3
  * @export
4
4
  * @enum {string}
5
5
  */
6
- export type Action = 'BUY' | 'SELL';
6
+ export type ActionStrict = 'BUY' | 'SELL';
@@ -12,7 +12,7 @@ export interface DeleteUserResponse {
12
12
  */
13
13
  'status'?: string;
14
14
  /**
15
- * SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it\'s unique to a user
15
+ * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
16
16
  * @type {string}
17
17
  * @memberof DeleteUserResponse
18
18
  */
@@ -7,7 +7,7 @@ export * from './account-order-record';
7
7
  export * from './account-order-record-status';
8
8
  export * from './account-simple';
9
9
  export * from './account-sync-status';
10
- export * from './action';
10
+ export * from './action-strict';
11
11
  export * from './amount';
12
12
  export * from './authentication-login-snap-trade-user200-response';
13
13
  export * from './balance';
@@ -38,6 +38,7 @@ export * from './manual-trade';
38
38
  export * from './manual-trade-and-impact';
39
39
  export * from './manual-trade-balance';
40
40
  export * from './manual-trade-form';
41
+ export * from './manual-trade-form-notional-value';
41
42
  export * from './manual-trade-symbol';
42
43
  export * from './model400-failed-request-response';
43
44
  export * from './model401-failed-request-response';
@@ -54,6 +55,7 @@ export * from './model-portfolio-security';
54
55
  export * from './monthly-dividends';
55
56
  export * from './net-contributions';
56
57
  export * from './net-dividend';
58
+ export * from './notional-value';
57
59
  export * from './option-chain-inner';
58
60
  export * from './option-chain-inner-chain-per-root-inner';
59
61
  export * from './option-chain-inner-chain-per-root-inner-chain-per-strike-price-inner';
@@ -23,7 +23,7 @@ __exportStar(require("./account-order-record"), exports);
23
23
  __exportStar(require("./account-order-record-status"), exports);
24
24
  __exportStar(require("./account-simple"), exports);
25
25
  __exportStar(require("./account-sync-status"), exports);
26
- __exportStar(require("./action"), exports);
26
+ __exportStar(require("./action-strict"), exports);
27
27
  __exportStar(require("./amount"), exports);
28
28
  __exportStar(require("./authentication-login-snap-trade-user200-response"), exports);
29
29
  __exportStar(require("./balance"), exports);
@@ -54,6 +54,7 @@ __exportStar(require("./manual-trade"), exports);
54
54
  __exportStar(require("./manual-trade-and-impact"), exports);
55
55
  __exportStar(require("./manual-trade-balance"), exports);
56
56
  __exportStar(require("./manual-trade-form"), exports);
57
+ __exportStar(require("./manual-trade-form-notional-value"), exports);
57
58
  __exportStar(require("./manual-trade-symbol"), exports);
58
59
  __exportStar(require("./model400-failed-request-response"), exports);
59
60
  __exportStar(require("./model401-failed-request-response"), exports);
@@ -70,6 +71,7 @@ __exportStar(require("./model-portfolio-security"), exports);
70
71
  __exportStar(require("./monthly-dividends"), exports);
71
72
  __exportStar(require("./net-contributions"), exports);
72
73
  __exportStar(require("./net-dividend"), exports);
74
+ __exportStar(require("./notional-value"), exports);
73
75
  __exportStar(require("./option-chain-inner"), exports);
74
76
  __exportStar(require("./option-chain-inner-chain-per-root-inner"), exports);
75
77
  __exportStar(require("./option-chain-inner-chain-per-root-inner-chain-per-strike-price-inner"), exports);
@@ -0,0 +1,6 @@
1
+ import { NotionalValue } from './notional-value';
2
+ /**
3
+ * @type ManualTradeFormNotionalValue
4
+ * @export
5
+ */
6
+ export type ManualTradeFormNotionalValue = NotionalValue;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
- import { Action } from './action';
1
+ import { ActionStrict } from './action-strict';
2
+ import { ManualTradeFormNotionalValue } from './manual-trade-form-notional-value';
2
3
  import { OrderTypeStrict } from './order-type-strict';
3
4
  import { TimeInForceStrict } from './time-in-force-strict';
4
5
  /**
@@ -15,10 +16,10 @@ export interface ManualTradeForm {
15
16
  'account_id'?: string;
16
17
  /**
17
18
  * Trade Action
18
- * @type {Action}
19
+ * @type {ActionStrict}
19
20
  * @memberof ManualTradeForm
20
21
  */
21
- 'action'?: Action;
22
+ 'action'?: ActionStrict;
22
23
  /**
23
24
  * Order Type
24
25
  * @type {OrderTypeStrict}
@@ -57,8 +58,8 @@ export interface ManualTradeForm {
57
58
  'universal_symbol_id'?: string;
58
59
  /**
59
60
  *
60
- * @type {number}
61
+ * @type {ManualTradeFormNotionalValue}
61
62
  * @memberof ManualTradeForm
62
63
  */
63
- 'notional_value'?: number | null;
64
+ 'notional_value'?: ManualTradeFormNotionalValue | null;
64
65
  }
@@ -1,4 +1,4 @@
1
- import { Action } from './action';
1
+ import { ActionStrict } from './action-strict';
2
2
  import { ManualTradeSymbol } from './manual-trade-symbol';
3
3
  import { OrderTypeStrict } from './order-type-strict';
4
4
  /**
@@ -40,10 +40,10 @@ export interface ManualTrade {
40
40
  'symbol'?: ManualTradeSymbol;
41
41
  /**
42
42
  * Trade Action
43
- * @type {Action}
43
+ * @type {ActionStrict}
44
44
  * @memberof ManualTrade
45
45
  */
46
- 'action'?: Action;
46
+ 'action'?: ActionStrict;
47
47
  /**
48
48
  *
49
49
  * @type {number}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @type NotionalValue
3
+ * Dollar amount to trade. Cannot work with units. Can only work for market order types and day for time in force. **Only available for Alpaca, Alpaca Paper, and Robinhood.**
4
+ * @export
5
+ */
6
+ export type NotionalValue = number | string;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -24,7 +24,7 @@ export interface SessionEvent {
24
24
  */
25
25
  'session_id'?: string;
26
26
  /**
27
- * SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it\'s unique to a user
27
+ * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
28
28
  * @type {string}
29
29
  * @memberof SessionEvent
30
30
  */
@@ -48,5 +48,5 @@ export interface SessionEvent {
48
48
  */
49
49
  'brokerage_authorization_id'?: string;
50
50
  }
51
- type SessionEventSessionEventTypeEnum = 'CONNECTION_FAILED' | 'DISCLAIMER_ACCEPTED' | 'BROKERAGE_CONNECTION_INITIATED' | 'BROKERAGE_AUTHENTICATION' | 'MFA_AUTHORIZATION' | 'CONNECTION_SUCCESSFUL' | 'PARTNER_REDIRECT';
51
+ type SessionEventSessionEventTypeEnum = 'OAUTH_REDIRECT' | 'DISCLAIMER_ACCEPTED' | 'BROKERAGE_CONNECTION_INITIATED' | 'BROKERAGE_RECONNECT_INITIATED' | 'BROKERAGE_AUTHENTICATION' | 'OAUTH_BROKERAGE_AUTHENTICATION' | 'MFA_REQUESTED' | 'MFA_SUBMITTED' | 'MFA_CHOICE_REQUESTED' | 'MFA_CHOICE_SUBMITTED' | 'CONNECTION_SUCCESSFUL' | 'CONNECTION_FAILED' | 'PARTNER_REDIRECT' | 'CONNECTION_ABORTED' | 'SESSION_STARTED';
52
52
  export {};
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export interface SnapTradeRegisterUserRequestBody {
7
7
  /**
8
- * SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it\'s unique to a user
8
+ * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
9
9
  * @type {string}
10
10
  * @memberof SnapTradeRegisterUserRequestBody
11
11
  */
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export interface UserIDandSecret {
7
7
  /**
8
- * SnapTrade User ID. Provided by SnapTrade Partner. Can be any string, as long as it\'s unique to a user
8
+ * SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable.
9
9
  * @type {string}
10
10
  * @memberof UserIDandSecret
11
11
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snaptrade-typescript-sdk",
3
- "version": "9.0.20",
3
+ "version": "9.0.22",
4
4
  "description": "Client for SnapTrade",
5
5
  "author": "Konfig",
6
6
  "engines": {
File without changes