@brokerize/client 1.2.0 → 1.2.2

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/client.d.ts CHANGED
@@ -3811,6 +3811,18 @@ declare interface DecoupledOperationStatus {
3811
3811
  declare type DecoupledOperationStatus_2 = {
3812
3812
  text?: string;
3813
3813
  state: DecoupledOperationState_2;
3814
+ /**
3815
+ * If:
3816
+ * - the decoupled operation is an order creation
3817
+ * - *AND* it is in the state `AUTHORIZATION_USER_ACCEPTED`
3818
+ * - *AND* the broker supports retrieving this information
3819
+ *
3820
+ * This is the id of the created order. Note that depending on the broker, it is possible
3821
+ * (as with non-decoupled order creations as well), that the broker does not return this id, but
3822
+ * instead will add the order to the order book asynchronously. In this case it is not possible to directly
3823
+ * show an order receipt, but just a message (e.g. "Order has been created successfully - check order list for updates").
3824
+ */
3825
+ createdOrderId?: string;
3814
3826
  };
3815
3827
 
3816
3828
  declare function DecoupledOperationStatusFromJSON(json: any): DecoupledOperationStatus;
@@ -13902,17 +13914,18 @@ declare type WebSocketSubscriptionSuccessfulMessage = InvalidateMessage | Update
13902
13914
  declare namespace WebSocketTypes {
13903
13915
  export {
13904
13916
  WebSocketCommand,
13917
+ WebSocketCommandPing,
13905
13918
  WebSocketCommandUnsubscribe,
13906
13919
  WebSocketCommandSubscribe,
13907
13920
  SubscribeInvalidateDetails,
13908
13921
  SubscribeDecoupledOperation,
13922
+ WebSocketPingMessage,
13909
13923
  WebSocketMessage,
13910
13924
  WebSocketSubscriptionMessage,
13911
13925
  WebSocketSubscriptionSuccessfulMessage,
13912
13926
  WebSocketAuthenticatedMessage,
13913
13927
  WebSocketMessageErrorOnSubscription,
13914
13928
  InvalidateMessage,
13915
- WebSocketPingMessage,
13916
13929
  UpdateDecoupledOperationMessage,
13917
13930
  BrokerizeWebSocketError,
13918
13931
  WebSocketError,
package/dist/index.js CHANGED
@@ -90,12 +90,13 @@ export class Brokerize {
90
90
  }
91
91
  }
92
92
  function getGlobalObject() {
93
- let global;
94
- try {
95
- global = Function("return this")();
96
- }
97
- catch (e) {
98
- global = window;
99
- }
100
- return global;
93
+ if (typeof globalThis !== "undefined")
94
+ return globalThis;
95
+ if (typeof self !== "undefined")
96
+ return self;
97
+ if (typeof window !== "undefined")
98
+ return window;
99
+ if (typeof global !== "undefined")
100
+ return global;
101
+ throw new Error("Unable to determine global object");
101
102
  }
@@ -3,7 +3,7 @@ type WebSocketCommandAuthorize = {
3
3
  cmd: "authorize";
4
4
  idToken: string;
5
5
  };
6
- type WebSocketCommandPing = {
6
+ export type WebSocketCommandPing = {
7
7
  cmd: "ping";
8
8
  };
9
9
  export type WebSocketCommandUnsubscribe = {
@@ -35,6 +35,9 @@ export type SubscribeDecoupledOperation = {
35
35
  sessionId: string;
36
36
  decoupledOperationId: string;
37
37
  };
38
+ export type WebSocketPingMessage = {
39
+ cmd: "ping";
40
+ };
38
41
  export type WebSocketMessage = WebSocketSubscriptionMessage | WebSocketError | WebSocketAuthenticatedMessage | WebSocketPingMessage;
39
42
  export type WebSocketSubscriptionMessage = WebSocketMessageErrorOnSubscription | WebSocketSubscriptionSuccessfulMessage;
40
43
  export type WebSocketSubscriptionSuccessfulMessage = InvalidateMessage | UpdateDecoupledOperationMessage;
@@ -49,9 +52,6 @@ export type InvalidateMessage = {
49
52
  cmd: "invalidate";
50
53
  subscriptionId: number;
51
54
  };
52
- export type WebSocketPingMessage = {
53
- cmd: "ping";
54
- };
55
55
  export type UpdateDecoupledOperationMessage = {
56
56
  cmd: "updateDecoupledOperationStatus";
57
57
  subscriptionId: number;
@@ -67,5 +67,17 @@ export type DecoupledOperationState = "AUTHORIZATION_ABORTED" | "AUTHORIZATION_I
67
67
  export type DecoupledOperationStatus = {
68
68
  text?: string;
69
69
  state: DecoupledOperationState;
70
+ /**
71
+ * If:
72
+ * - the decoupled operation is an order creation
73
+ * - *AND* it is in the state `AUTHORIZATION_USER_ACCEPTED`
74
+ * - *AND* the broker supports retrieving this information
75
+ *
76
+ * This is the id of the created order. Note that depending on the broker, it is possible
77
+ * (as with non-decoupled order creations as well), that the broker does not return this id, but
78
+ * instead will add the order to the order book asynchronously. In this case it is not possible to directly
79
+ * show an order receipt, but just a message (e.g. "Order has been created successfully - check order list for updates").
80
+ */
81
+ createdOrderId?: string;
70
82
  };
71
83
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brokerize/client",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Client for the brokerize.com API",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/brokerize/client-js#readme",